Skip to content

ruthra-kumar/book_gain_loss_in_je [frappe] PR#35644

Bot Dokos requested to merge ft-pr-35644 into develop

See https://github.com/frappe/erpnext/pull/35644

Date: 2023-08-04T09:53:26+05:30

  • Merge pull request #35644 from ruthra-kumar/book_gain_loss_in_je
  • chore: cancel gain/loss je while posting reverse gl
  • chore: don't make gain/loss journal for base currency transactions
  • chore(test): use existing company for unit test
  • chore: rename some internal variables
  • chore: add msgprint for exc JE
  • chore: use frappetestcase
  • refactor(test): assert ledger outstanding
  • fix(test): test case breakage in Github Actions
  • test: assert ledger after cr note cancellation
  • fix: cr/dr note should be posted for exc gain/loss
  • test: cr notes against invoice
  • fix: incorrect gain/loss on allocation change on reconciliation tool
  • refactor: create gain/loss on Cr/Dr notes with different exc rates
  • refactor: convert class method to standalone function
  • refactor: split make_exchage_gain_loss_journal into smaller function
  • refactor: cr/dr note will be on single exchange rate
  • chore: type info
  • chore(test): fix broken test case
  • chore(test): fix broken unit test
  • test: journals against sales invoice
  • refactor: handle diff amount in various names
  • refactor: unit tests for journals
  • refactor: dr/cr logic for journals as payments
  • refactor: assert payment ledger outstanding in both currencies
  • refactor: cancel gain/loss JE on Journal as payment cancellation
  • refactor: linkage between journal as payment and gain/loss journal
  • chore: code cleanup
  • refactor: remove call for setting deductions in payment entry
  • refactor(test): difference amount no updated for exchange gain/loss
  • refactor(test): exc gain/loss journal for advance in purchase invoice
  • refactor: only post on base currency for exchange gain/loss
  • refactor(test): payment will have same exch rate - no gain/loss
  • refactor(test): assert Exc journal when reconciling Journa to invoic
  • chore: remove debugging statements and fixing failing unit tests
  • refactor: exc booking logic for Journal Entry
  • refactor(test): exc gain/loss booked through journal
  • refactor: assert exchange gain/loss amount in reference table
  • refactor: remove unused variable, pe should pull in parent exc rate
  • refactor: helper method
  • chore: fix logic for purchase invoice and some typos
  • refactor: add new reference type in journal entry account
  • chore: patch to update property setter for Journal Entry Accounts
  • refactor: replace with new method in purchase invoice
  • test: different scenarios for exchange booking
  • refactor: book exchange gain/loss through journal



Diagnostics

flake8...................................................................Failed
- hook id: flake8
- exit code: 1

erpnext/controllers/tests/test_accounts_controller.py:4:1: F401 'unittest' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:8:1: F401 'frappe.tests.utils.change_settings' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.utils.add_days' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.utils.flt' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:11:1: F401 'erpnext.get_default_cost_center' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:12:1: F401 'erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:109:37: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
erpnext/controllers/tests/test_accounts_controller.py:139:52: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.


pre-commit failed for source commit: 6e18bb6456b3a7a2cbad89b86dcc124978337e4d
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

erpnext/controllers/tests/test_accounts_controller.py:8:1: F401 'frappe.tests.utils.FrappeTestCase' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:8:1: F401 'frappe.tests.utils.change_settings' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.utils.add_days' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.utils.flt' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:11:1: F401 'erpnext.get_default_cost_center' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:12:1: F401 'erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:14:1: F401 'erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice.make_purchase_invoice' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:133:37: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
erpnext/controllers/tests/test_accounts_controller.py:163:52: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.


pre-commit failed for source commit: 73cc1ba654f39d81b7e1d9769ef6a0a8ceb689fe
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.FrappeTestCase' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.change_settings' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.add_days' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.flt' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:12:1: F401 'erpnext.get_default_cost_center' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:13:1: F401 'erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:15:1: F401 'erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice.make_purchase_invoice' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:146:16: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
erpnext/controllers/tests/test_accounts_controller.py:178:52: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.


pre-commit failed for source commit: 5695d6a5a62e634536c51a22e045eb8281a29d9d
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.FrappeTestCase' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.change_settings' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.add_days' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.flt' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:12:1: F401 'erpnext.get_default_cost_center' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:13:1: F401 'erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:15:1: F401 'erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice.make_purchase_invoice' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:146:16: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
erpnext/controllers/tests/test_accounts_controller.py:178:52: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.


pre-commit failed for source commit: f3363e813a353363696169602bae5b0a36ae0376
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.FrappeTestCase' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.change_settings' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.add_days' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.flt' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:12:1: F401 'erpnext.get_default_cost_center' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:13:1: F401 'erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:15:1: F401 'erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice.make_purchase_invoice' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:146:16: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
erpnext/controllers/tests/test_accounts_controller.py:178:52: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.


pre-commit failed for source commit: 70dd9d0671e1d77d50c814885c6a6f59508c4f62
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.FrappeTestCase' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.change_settings' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.add_days' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.flt' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:12:1: F401 'erpnext.get_default_cost_center' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:13:1: F401 'erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:15:1: F401 'erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice.make_purchase_invoice' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:144:16: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
erpnext/controllers/tests/test_accounts_controller.py:176:52: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.


pre-commit failed for source commit: e3d2a2c5bdd94364f22828acc40854f6834b66ce
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.FrappeTestCase' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.change_settings' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.add_days' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.flt' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:12:1: F401 'erpnext.get_default_cost_center' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:13:1: F401 'erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:15:1: F401 'erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice.make_purchase_invoice' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:144:16: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
erpnext/controllers/tests/test_accounts_controller.py:176:52: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.


pre-commit failed for source commit: ae424fdfedb49e6018d957eebb11eb4e03d9d410
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.FrappeTestCase' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.change_settings' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.add_days' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.flt' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:12:1: F401 'erpnext.get_default_cost_center' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:13:1: F401 'erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:15:1: F401 'erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice.make_purchase_invoice' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:144:16: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
erpnext/controllers/tests/test_accounts_controller.py:176:52: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.


pre-commit failed for source commit: 47bbb37291eba1e2bb8217837417a072f73f5634
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

erpnext/controllers/tests/test_accounts_controller.py:4:1: F401 'unittest' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.change_settings' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.add_days' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.flt' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:12:1: F401 'erpnext.get_default_cost_center' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:13:1: F401 'erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:15:1: F401 'erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice.make_purchase_invoice' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:142:16: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
erpnext/controllers/tests/test_accounts_controller.py:174:52: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.


pre-commit failed for source commit: 804afaa647b5727c37206fc4207c203652c10d53
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

erpnext/controllers/tests/test_accounts_controller.py:4:1: F401 'unittest' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:9:1: F401 'frappe.tests.utils.change_settings' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.add_days' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:10:1: F401 'frappe.utils.flt' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:12:1: F401 'erpnext.get_default_cost_center' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:13:1: F401 'erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:15:1: F401 'erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice.make_purchase_invoice' imported but unused
erpnext/controllers/tests/test_accounts_controller.py:142:16: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
erpnext/controllers/tests/test_accounts_controller.py:174:52: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.



Checkout instructions
# Checkout locally
git fetch upstream
git switch ft-pr-35644

# Make changes then rebase
git rebase -i upstream/develop --reapply-cherry-picks

# Fix or ignore conflicts
git checkout --theirs .
git rebase --continue

# Force-push changes
git push --force-with-lease

Merge request reports