chore: cancel gain/loss je while posting reverse gl
This commit is contained in:
parent
567c0ce1e8
commit
46ea814400
@ -18,6 +18,7 @@ from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category
|
|||||||
)
|
)
|
||||||
from erpnext.accounts.party import get_party_account
|
from erpnext.accounts.party import get_party_account
|
||||||
from erpnext.accounts.utils import (
|
from erpnext.accounts.utils import (
|
||||||
|
cancel_exchange_gain_loss_journal,
|
||||||
get_account_currency,
|
get_account_currency,
|
||||||
get_balance_on,
|
get_balance_on,
|
||||||
get_stock_accounts,
|
get_stock_accounts,
|
||||||
@ -942,6 +943,8 @@ class JournalEntry(AccountsController):
|
|||||||
merge_entries=merge_entries,
|
merge_entries=merge_entries,
|
||||||
update_outstanding=update_outstanding,
|
update_outstanding=update_outstanding,
|
||||||
)
|
)
|
||||||
|
if cancel:
|
||||||
|
cancel_exchange_gain_loss_journal(frappe._dict(doctype=self.doctype, name=self.name))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_balance(self, difference_account=None):
|
def get_balance(self, difference_account=None):
|
||||||
|
|||||||
@ -28,7 +28,12 @@ from erpnext.accounts.general_ledger import (
|
|||||||
process_gl_map,
|
process_gl_map,
|
||||||
)
|
)
|
||||||
from erpnext.accounts.party import get_party_account
|
from erpnext.accounts.party import get_party_account
|
||||||
from erpnext.accounts.utils import get_account_currency, get_balance_on, get_outstanding_invoices
|
from erpnext.accounts.utils import (
|
||||||
|
cancel_exchange_gain_loss_journal,
|
||||||
|
get_account_currency,
|
||||||
|
get_balance_on,
|
||||||
|
get_outstanding_invoices,
|
||||||
|
)
|
||||||
from erpnext.controllers.accounts_controller import (
|
from erpnext.controllers.accounts_controller import (
|
||||||
AccountsController,
|
AccountsController,
|
||||||
get_supplier_block_status,
|
get_supplier_block_status,
|
||||||
@ -1018,7 +1023,10 @@ class PaymentEntry(AccountsController):
|
|||||||
gl_entries = self.build_gl_map()
|
gl_entries = self.build_gl_map()
|
||||||
gl_entries = process_gl_map(gl_entries)
|
gl_entries = process_gl_map(gl_entries)
|
||||||
make_gl_entries(gl_entries, cancel=cancel, adv_adj=adv_adj)
|
make_gl_entries(gl_entries, cancel=cancel, adv_adj=adv_adj)
|
||||||
self.make_exchange_gain_loss_journal()
|
if cancel:
|
||||||
|
cancel_exchange_gain_loss_journal(frappe._dict(doctype=self.doctype, name=self.name))
|
||||||
|
else:
|
||||||
|
self.make_exchange_gain_loss_journal()
|
||||||
|
|
||||||
def add_party_gl_entries(self, gl_entries):
|
def add_party_gl_entries(self, gl_entries):
|
||||||
if self.party_account:
|
if self.party_account:
|
||||||
|
|||||||
@ -23,7 +23,7 @@ from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category
|
|||||||
)
|
)
|
||||||
from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center
|
from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center
|
||||||
from erpnext.accounts.party import get_due_date, get_party_account, get_party_details
|
from erpnext.accounts.party import get_due_date, get_party_account, get_party_details
|
||||||
from erpnext.accounts.utils import get_account_currency
|
from erpnext.accounts.utils import cancel_exchange_gain_loss_journal, get_account_currency
|
||||||
from erpnext.assets.doctype.asset.depreciation import (
|
from erpnext.assets.doctype.asset.depreciation import (
|
||||||
depreciate_asset,
|
depreciate_asset,
|
||||||
get_disposal_account_and_cost_center,
|
get_disposal_account_and_cost_center,
|
||||||
@ -1032,6 +1032,7 @@ class SalesInvoice(SellingController):
|
|||||||
|
|
||||||
self.make_exchange_gain_loss_journal()
|
self.make_exchange_gain_loss_journal()
|
||||||
elif self.docstatus == 2:
|
elif self.docstatus == 2:
|
||||||
|
cancel_exchange_gain_loss_journal(frappe._dict(doctype=self.doctype, name=self.name))
|
||||||
make_reverse_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
|
make_reverse_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
|
||||||
|
|
||||||
if update_outstanding == "No":
|
if update_outstanding == "No":
|
||||||
|
|||||||
@ -15,7 +15,7 @@ from erpnext.accounts.general_ledger import (
|
|||||||
make_reverse_gl_entries,
|
make_reverse_gl_entries,
|
||||||
process_gl_map,
|
process_gl_map,
|
||||||
)
|
)
|
||||||
from erpnext.accounts.utils import get_fiscal_year
|
from erpnext.accounts.utils import cancel_exchange_gain_loss_journal, get_fiscal_year
|
||||||
from erpnext.controllers.accounts_controller import AccountsController
|
from erpnext.controllers.accounts_controller import AccountsController
|
||||||
from erpnext.stock import get_warehouse_account_map
|
from erpnext.stock import get_warehouse_account_map
|
||||||
from erpnext.stock.doctype.inventory_dimension.inventory_dimension import (
|
from erpnext.stock.doctype.inventory_dimension.inventory_dimension import (
|
||||||
@ -534,6 +534,7 @@ class StockController(AccountsController):
|
|||||||
make_sl_entries(sl_entries, allow_negative_stock, via_landed_cost_voucher)
|
make_sl_entries(sl_entries, allow_negative_stock, via_landed_cost_voucher)
|
||||||
|
|
||||||
def make_gl_entries_on_cancel(self):
|
def make_gl_entries_on_cancel(self):
|
||||||
|
cancel_exchange_gain_loss_journal(frappe._dict(doctype=self.doctype, name=self.name))
|
||||||
if frappe.db.sql(
|
if frappe.db.sql(
|
||||||
"""select name from `tabGL Entry` where voucher_type=%s
|
"""select name from `tabGL Entry` where voucher_type=%s
|
||||||
and voucher_no=%s""",
|
and voucher_no=%s""",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user