From 09439334cae6a7306dad8e54a9f81f9ffa483f8b Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Wed, 8 Nov 2023 12:57:00 +0530 Subject: [PATCH] refactor: use both fields to store against values --- erpnext/accounts/deferred_revenue.py | 2 ++ .../invoice_discounting.py | 2 ++ .../doctype/journal_entry/journal_entry.py | 17 +++++++++++---- .../doctype/payment_entry/payment_entry.py | 6 ++++++ .../purchase_invoice/purchase_invoice.py | 21 +++++++++++++++++++ .../doctype/sales_invoice/sales_invoice.py | 14 +++++++++++++ erpnext/assets/doctype/asset/asset.py | 2 ++ .../asset_capitalization.py | 5 +++++ .../doctype/asset_repair/asset_repair.py | 4 ++++ erpnext/controllers/accounts_controller.py | 4 ++++ erpnext/controllers/stock_controller.py | 5 +++++ .../regional/united_arab_emirates/utils.py | 1 + .../stock/doctype/stock_entry/stock_entry.py | 2 ++ 13 files changed, 81 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/deferred_revenue.py b/erpnext/accounts/deferred_revenue.py index 00d5ea3245..c2188c0da1 100644 --- a/erpnext/accounts/deferred_revenue.py +++ b/erpnext/accounts/deferred_revenue.py @@ -521,6 +521,7 @@ def make_gl_entries( "account": credit_account, "against_type": against_type, "against": against, + "against_link": against, "credit": base_amount, "credit_in_account_currency": amount, "cost_center": cost_center, @@ -541,6 +542,7 @@ def make_gl_entries( "account": debit_account, "against_type": against_type, "against": against, + "against_link": against, "debit": base_amount, "debit_in_account_currency": amount, "cost_center": cost_center, diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py index 744dff4670..ebfa0de3ae 100644 --- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py +++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py @@ -127,6 +127,7 @@ class InvoiceDiscounting(AccountsController): "party": d.customer, "against_type": "Account", "against": self.accounts_receivable_credit, + "against_link": self.accounts_receivable_credit, "credit": outstanding_in_company_currency, "credit_in_account_currency": outstanding_in_company_currency if inv.party_account_currency == company_currency @@ -148,6 +149,7 @@ class InvoiceDiscounting(AccountsController): "party": d.customer, "against_type": "Account", "against": inv.debit_to, + "against_link": inv.debit_to, "debit": outstanding_in_company_currency, "debit_in_account_currency": outstanding_in_company_currency if ar_credit_account_currency == company_currency diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 1c737fc543..9f76d9df19 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -683,10 +683,10 @@ class JournalEntry(AccountsController): else: against_type = "Supplier" + against_account = frappe.db.get_value(d.reference_type, d.reference_name, against_type.lower()) d.against_type = against_type - d.against_account = frappe.db.get_value( - d.reference_type, d.reference_name, against_type.lower() - ) + d.against_account = against_account + d.against_account_link = against_account else: self.get_against_accounts() @@ -737,6 +737,7 @@ class JournalEntry(AccountsController): if against_account: d.against_type = against_account.party_type or "Account" d.against_account = against_account.party or against_account.account + d.against_account_link = against_account.party or against_account.account def validate_debit_credit_amount(self): if not (self.voucher_type == "Exchange Gain Or Loss" and self.multi_currency): @@ -967,7 +968,13 @@ class JournalEntry(AccountsController): ) if not self.separate_against_account_entries: - gl_dict.update({"against_type": d.against_type, "against": d.against_account}) + gl_dict.update( + { + "against_type": d.against_type, + "against": d.against_account, + "against_link": d.against_account, + } + ) gl_map.append(gl_dict) elif d in self.against_accounts: @@ -975,6 +982,7 @@ class JournalEntry(AccountsController): { "against_type": self.split_account.get("party_type") or "Account", "against": self.split_account.get("party") or self.split_account.get("account"), + "against_link": self.split_account.get("party") or self.split_account.get("account"), } ) gl_map.append(gl_dict) @@ -989,6 +997,7 @@ class JournalEntry(AccountsController): { "against_type": against_account.party_type or "Account", "against": against_account.party or against_account.account, + "against_link": against_account.party or against_account.account, "debit": flt(debit, d.precision("debit")), "credit": flt(credit, d.precision("credit")), "account_currency": d.account_currency, diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index ff558b2f48..ff8695f770 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1078,6 +1078,7 @@ class PaymentEntry(AccountsController): "party": self.party, "against_type": "Account", "against": against_account, + "against_link": against_account, "account_currency": self.party_account_currency, "cost_center": self.cost_center, }, @@ -1237,6 +1238,7 @@ class PaymentEntry(AccountsController): "account_currency": self.paid_from_account_currency, "against_type": self.party_type if self.payment_type == "Pay" else "Account", "against": self.party if self.payment_type == "Pay" else self.paid_to, + "against_link": self.party if self.payment_type == "Pay" else self.paid_to, "credit_in_account_currency": self.paid_amount, "credit": self.base_paid_amount, "cost_center": self.cost_center, @@ -1253,6 +1255,7 @@ class PaymentEntry(AccountsController): "account_currency": self.paid_to_account_currency, "against_type": self.party_type if self.payment_type == "Receive" else "Account", "against": self.party if self.payment_type == "Receive" else self.paid_from, + "against_link": self.party if self.payment_type == "Receive" else self.paid_from, "debit_in_account_currency": self.received_amount, "debit": self.base_received_amount, "cost_center": self.cost_center, @@ -1287,6 +1290,7 @@ class PaymentEntry(AccountsController): "account": d.account_head, "against_type": against_type, "against": against, + "against_link": against, dr_or_cr: tax_amount, dr_or_cr + "_in_account_currency": base_tax_amount if account_currency == self.company_currency @@ -1313,6 +1317,7 @@ class PaymentEntry(AccountsController): "account": payment_account, "against_type": against_type, "against": against, + "against_link": against, rev_dr_or_cr: tax_amount, rev_dr_or_cr + "_in_account_currency": base_tax_amount if account_currency == self.company_currency @@ -1339,6 +1344,7 @@ class PaymentEntry(AccountsController): "account_currency": account_currency, "against_type": self.party_type or "Account", "against": self.party or self.paid_from, + "against_link": self.party or self.paid_from, "debit_in_account_currency": d.amount, "debit": d.amount, "cost_center": d.cost_center, diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index cf89b333c6..53c131a507 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -643,6 +643,7 @@ class PurchaseInvoice(BuyingController): "due_date": self.due_date, "against_type": "Account", "against": self.against_expense_account, + "against_link": self.against_expense_account, "credit": base_grand_total, "credit_in_account_currency": base_grand_total if self.party_account_currency == self.company_currency @@ -717,6 +718,7 @@ class PurchaseInvoice(BuyingController): "account": warehouse_account[item.warehouse]["account"], "against_type": "Account", "against": warehouse_account[item.from_warehouse]["account"], + "against_link": warehouse_account[item.from_warehouse]["account"], "cost_center": item.cost_center, "project": item.project or self.project, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), @@ -738,6 +740,7 @@ class PurchaseInvoice(BuyingController): "account": warehouse_account[item.from_warehouse]["account"], "against_type": "Account", "against": warehouse_account[item.warehouse]["account"], + "against_link": warehouse_account[item.warehouse]["account"], "cost_center": item.cost_center, "project": item.project or self.project, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), @@ -756,6 +759,7 @@ class PurchaseInvoice(BuyingController): "account": item.expense_account, "against_type": "Supplier", "against": self.supplier, + "against_link": self.supplier, "debit": flt(item.base_net_amount, item.precision("base_net_amount")), "remarks": self.get("remarks") or _("Accounting Entry for Stock"), "cost_center": item.cost_center, @@ -774,6 +778,7 @@ class PurchaseInvoice(BuyingController): "account": item.expense_account, "against_type": "Supplier", "against": self.supplier, + "against_link": self.supplier, "debit": warehouse_debit_amount, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), "cost_center": item.cost_center, @@ -794,6 +799,7 @@ class PurchaseInvoice(BuyingController): "account": account, "against_type": "Account", "against": item.expense_account, + "against_link": item.expense_account, "cost_center": item.cost_center, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), "credit": flt(amount["base_amount"]), @@ -815,6 +821,7 @@ class PurchaseInvoice(BuyingController): "account": supplier_warehouse_account, "against_type": "Account", "against": item.expense_account, + "against_link": item.expense_account, "cost_center": item.cost_center, "project": item.project or self.project, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), @@ -871,6 +878,7 @@ class PurchaseInvoice(BuyingController): "account": expense_account, "against_type": "Supplier", "against": self.supplier, + "against_link": self.supplier, "debit": amount, "cost_center": item.cost_center, "project": item.project or self.project, @@ -898,6 +906,7 @@ class PurchaseInvoice(BuyingController): "account": expense_account, "against_type": "Supplier", "against": self.supplier, + "against_link": self.supplier, "debit": discrepancy_caused_by_exchange_rate_difference, "cost_center": item.cost_center, "project": item.project or self.project, @@ -912,6 +921,7 @@ class PurchaseInvoice(BuyingController): "account": self.get_company_default("exchange_gain_loss_account"), "against_type": "Supplier", "against": self.supplier, + "against_link": self.supplier, "credit": discrepancy_caused_by_exchange_rate_difference, "cost_center": item.cost_center, "project": item.project or self.project, @@ -958,6 +968,7 @@ class PurchaseInvoice(BuyingController): "account": stock_rbnb, "against_type": "Supplier", "against": self.supplier, + "against_link": self.supplier, "debit": flt(item.item_tax_amount, item.precision("item_tax_amount")), "remarks": self.remarks or _("Accounting Entry for Stock"), "cost_center": self.cost_center, @@ -1007,6 +1018,7 @@ class PurchaseInvoice(BuyingController): "account": cost_of_goods_sold_account, "against_type": "Account", "against": item.expense_account, + "against_link": item.expense_account, "debit": stock_adjustment_amt, "remarks": self.get("remarks") or _("Stock Adjustment"), "cost_center": item.cost_center, @@ -1038,6 +1050,7 @@ class PurchaseInvoice(BuyingController): "account": tax.account_head, "against_type": "Supplier", "against": self.supplier, + "against_link": self.supplier, dr_or_cr: base_amount, dr_or_cr + "_in_account_currency": base_amount if account_currency == self.company_currency @@ -1088,6 +1101,7 @@ class PurchaseInvoice(BuyingController): "against_type": "Supplier", "cost_center": tax.cost_center, "against": self.supplier, + "against_link": self.supplier, "credit": applicable_amount, "remarks": self.remarks or _("Accounting Entry for Stock"), }, @@ -1107,6 +1121,7 @@ class PurchaseInvoice(BuyingController): "cost_center": tax.cost_center, "against_type": "Supplier", "against": self.supplier, + "against_link": self.supplier, "credit": valuation_tax[tax.name], "remarks": self.remarks or _("Accounting Entry for Stock"), }, @@ -1123,6 +1138,7 @@ class PurchaseInvoice(BuyingController): "account": self.unrealized_profit_loss_account, "against_type": "Supplier", "against": self.supplier, + "against_link": self.supplier, "credit": flt(self.total_taxes_and_charges), "credit_in_account_currency": flt(self.base_total_taxes_and_charges), "cost_center": self.cost_center, @@ -1145,6 +1161,7 @@ class PurchaseInvoice(BuyingController): "party": self.supplier, "against_type": "Account", "against": self.cash_bank_account, + "against_link": self.cash_bank_account, "debit": self.base_paid_amount, "debit_in_account_currency": self.base_paid_amount if self.party_account_currency == self.company_currency @@ -1167,6 +1184,7 @@ class PurchaseInvoice(BuyingController): "account": self.cash_bank_account, "against_type": "Supplier", "against": self.supplier, + "against_link": self.supplier, "credit": self.base_paid_amount, "credit_in_account_currency": self.base_paid_amount if bank_account_currency == self.company_currency @@ -1192,6 +1210,7 @@ class PurchaseInvoice(BuyingController): "party": self.supplier, "against_type": "Account", "against": self.write_off_account, + "against_link": self.write_off_account, "debit": self.base_write_off_amount, "debit_in_account_currency": self.base_write_off_amount if self.party_account_currency == self.company_currency @@ -1213,6 +1232,7 @@ class PurchaseInvoice(BuyingController): "account": self.write_off_account, "against_type": "Supplier", "against": self.supplier, + "against_link": self.supplier, "credit": flt(self.base_write_off_amount), "credit_in_account_currency": self.base_write_off_amount if write_off_account_currency == self.company_currency @@ -1241,6 +1261,7 @@ class PurchaseInvoice(BuyingController): "account": round_off_account, "against_type": "Supplier", "against": self.supplier, + "against_link": self.supplier, "debit_in_account_currency": self.rounding_adjustment, "debit": self.base_rounding_adjustment, "cost_center": round_off_cost_center diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index a059c32dfa..87b40c09bd 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -1042,6 +1042,7 @@ class SalesInvoice(SellingController): "due_date": self.due_date, "against_type": "Account", "against": self.against_income_account, + "against_link": self.against_income_account, "debit": base_grand_total, "debit_in_account_currency": base_grand_total if self.party_account_currency == self.company_currency @@ -1072,6 +1073,7 @@ class SalesInvoice(SellingController): "account": tax.account_head, "against_type": "Customer", "against": self.customer, + "against_link": self.customer, "credit": flt(base_amount, tax.precision("tax_amount_after_discount_amount")), "credit_in_account_currency": ( flt(base_amount, tax.precision("base_tax_amount_after_discount_amount")) @@ -1094,6 +1096,7 @@ class SalesInvoice(SellingController): "account": self.unrealized_profit_loss_account, "against_type": "Customer", "against": self.customer, + "against_link": self.customer, "debit": flt(self.total_taxes_and_charges), "debit_in_account_currency": flt(self.base_total_taxes_and_charges), "cost_center": self.cost_center, @@ -1163,6 +1166,7 @@ class SalesInvoice(SellingController): for gle in fixed_asset_gl_entries: gle["against_type"] = "Customer" gle["against"] = self.customer + gle["against_link"] = self.customer gl_entries.append(self.get_gl_dict(gle, item=item)) self.set_asset_status(asset) @@ -1185,6 +1189,7 @@ class SalesInvoice(SellingController): "account": income_account, "against_type": "Customer", "against": self.customer, + "against_link": self.customer, "credit": flt(base_amount, item.precision("base_net_amount")), "credit_in_account_currency": ( flt(base_amount, item.precision("base_net_amount")) @@ -1240,6 +1245,7 @@ class SalesInvoice(SellingController): "party": self.customer, "against_type": "Account", "against": self.loyalty_redemption_account, + "against_link": self.loyalty_redemption_account, "credit": self.loyalty_amount, "against_voucher": self.return_against if cint(self.is_return) else self.name, "against_voucher_type": self.doctype, @@ -1255,6 +1261,7 @@ class SalesInvoice(SellingController): "cost_center": self.cost_center or self.loyalty_redemption_cost_center, "against_type": "Customer", "against": self.customer, + "against_link": self.customer, "debit": self.loyalty_amount, "remark": "Loyalty Points redeemed by the customer", }, @@ -1283,6 +1290,7 @@ class SalesInvoice(SellingController): "party": self.customer, "against_type": "Account", "against": payment_mode.account, + "against_link": payment_mode.account, "credit": payment_mode.base_amount, "credit_in_account_currency": payment_mode.base_amount if self.party_account_currency == self.company_currency @@ -1305,6 +1313,7 @@ class SalesInvoice(SellingController): "account": payment_mode.account, "against_type": "Customer", "against": self.customer, + "against_link": self.customer, "debit": payment_mode.base_amount, "debit_in_account_currency": payment_mode.base_amount if payment_mode_account_currency == self.company_currency @@ -1330,6 +1339,7 @@ class SalesInvoice(SellingController): "party": self.customer, "against_type": "Account", "against": self.account_for_change_amount, + "against_link": self.account_for_change_amount, "debit": flt(self.base_change_amount), "debit_in_account_currency": flt(self.base_change_amount) if self.party_account_currency == self.company_currency @@ -1352,6 +1362,7 @@ class SalesInvoice(SellingController): "account": self.account_for_change_amount, "against_type": "Customer", "against": self.customer, + "against_link": self.customer, "credit": self.base_change_amount, "cost_center": self.cost_center, }, @@ -1379,6 +1390,7 @@ class SalesInvoice(SellingController): "party": self.customer, "against_type": "Account", "against": self.write_off_account, + "against_link": self.write_off_account, "credit": flt(self.base_write_off_amount, self.precision("base_write_off_amount")), "credit_in_account_currency": ( flt(self.base_write_off_amount, self.precision("base_write_off_amount")) @@ -1400,6 +1412,7 @@ class SalesInvoice(SellingController): "account": self.write_off_account, "against_type": "Customer", "against": self.customer, + "against_link": self.customer, "debit": flt(self.base_write_off_amount, self.precision("base_write_off_amount")), "debit_in_account_currency": ( flt(self.base_write_off_amount, self.precision("base_write_off_amount")) @@ -1429,6 +1442,7 @@ class SalesInvoice(SellingController): "account": round_off_account, "against_type": "Customer", "against": self.customer, + "against_link": self.customer, "credit_in_account_currency": flt( self.rounding_adjustment, self.precision("rounding_adjustment") ), diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py index 32518a109a..8908d8e5d0 100644 --- a/erpnext/assets/doctype/asset/asset.py +++ b/erpnext/assets/doctype/asset/asset.py @@ -610,6 +610,7 @@ class Asset(AccountsController): "account": cwip_account, "against_type": "Account", "against": fixed_asset_account, + "against_link": fixed_asset_account, "remarks": self.get("remarks") or _("Accounting Entry for Asset"), "posting_date": self.available_for_use_date, "credit": self.purchase_receipt_amount, @@ -626,6 +627,7 @@ class Asset(AccountsController): "account": fixed_asset_account, "against_type": "Account", "against": cwip_account, + "against_link": cwip_account, "remarks": self.get("remarks") or _("Accounting Entry for Asset"), "posting_date": self.available_for_use_date, "debit": self.purchase_receipt_amount, diff --git a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py index 229c16d18a..31aee3386d 100644 --- a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py +++ b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py @@ -432,6 +432,7 @@ class AssetCapitalization(StockController): "account": account, "against_type": "Account", "against": target_account, + "against_link": target_account, "cost_center": item_row.cost_center, "project": item_row.get("project") or self.get("project"), "remarks": self.get("remarks") or "Accounting Entry for Stock", @@ -474,6 +475,7 @@ class AssetCapitalization(StockController): for gle in fixed_asset_gl_entries: gle["against_type"] = "Account" gle["against"] = target_account + gle["against_link"] = target_account gl_entries.append(self.get_gl_dict(gle, item=item)) target_against.add(gle["account"]) @@ -491,6 +493,7 @@ class AssetCapitalization(StockController): "account": item_row.expense_account, "against_type": "Account", "against": target_account, + "against_link": target_account, "cost_center": item_row.cost_center, "project": item_row.get("project") or self.get("project"), "remarks": self.get("remarks") or "Accounting Entry for Stock", @@ -510,6 +513,7 @@ class AssetCapitalization(StockController): "account": self.target_fixed_asset_account, "against_type": "Account", "against": target_account, + "against_link": target_account, "remarks": self.get("remarks") or _("Accounting Entry for Asset"), "debit": flt(self.total_value, precision) / len(target_against), "cost_center": self.get("cost_center"), @@ -530,6 +534,7 @@ class AssetCapitalization(StockController): "account": account, "against_type": "Account", "against": target_account, + "against_link": target_account, "cost_center": self.cost_center, "project": self.get("project"), "remarks": self.get("remarks") or "Accounting Entry for Stock", diff --git a/erpnext/assets/doctype/asset_repair/asset_repair.py b/erpnext/assets/doctype/asset_repair/asset_repair.py index 65d2f8ef18..0b072b2a69 100644 --- a/erpnext/assets/doctype/asset_repair/asset_repair.py +++ b/erpnext/assets/doctype/asset_repair/asset_repair.py @@ -243,6 +243,7 @@ class AssetRepair(AccountsController): "debit_in_account_currency": self.repair_cost, "against_type": "Account", "against": pi_expense_account, + "against_link": pi_expense_account, "voucher_type": self.doctype, "voucher_no": self.name, "cost_center": self.cost_center, @@ -263,6 +264,7 @@ class AssetRepair(AccountsController): "credit_in_account_currency": self.repair_cost, "against_type": "Account", "against": fixed_asset_account, + "against_link": fixed_asset_account, "voucher_type": self.doctype, "voucher_no": self.name, "cost_center": self.cost_center, @@ -298,6 +300,7 @@ class AssetRepair(AccountsController): "credit_in_account_currency": item.amount, "against_type": "Account", "against": fixed_asset_account, + "against_link": fixed_asset_account, "voucher_type": self.doctype, "voucher_no": self.name, "cost_center": self.cost_center, @@ -316,6 +319,7 @@ class AssetRepair(AccountsController): "debit_in_account_currency": item.amount, "against_type": "Account", "against": item.expense_account or default_expense_account, + "against_link": item.expense_account or default_expense_account, "voucher_type": self.doctype, "voucher_no": self.name, "cost_center": self.cost_center, diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index e984730d74..c9c248c3ea 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1098,6 +1098,7 @@ class AccountsController(TransactionBase): "account": round_off_account, "against_type": against_type, "against": against, + "against_link": against, credit_or_debit: precision_loss, "cost_center": round_off_cost_center if self.use_company_roundoff_cost_center @@ -1479,6 +1480,7 @@ class AccountsController(TransactionBase): "account": item.discount_account, "against_type": against_type, "against": supplier_or_customer, + "against_link": supplier_or_customer, dr_or_cr: flt( discount_amount * self.get("conversion_rate"), item.precision("discount_amount") ), @@ -1498,6 +1500,7 @@ class AccountsController(TransactionBase): "account": income_or_expense_account, "against_type": against_type, "against": supplier_or_customer, + "against_link": supplier_or_customer, rev_dr_cr: flt( discount_amount * self.get("conversion_rate"), item.precision("discount_amount") ), @@ -1522,6 +1525,7 @@ class AccountsController(TransactionBase): "account": self.additional_discount_account, "against_type": against_type, "against": supplier_or_customer, + "against_link": supplier_or_customer, dr_or_cr: self.base_discount_amount, "cost_center": self.cost_center or erpnext.get_default_cost_center(self.company), }, diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 335f2b0ea6..a005c8cb8a 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -164,6 +164,7 @@ class StockController(AccountsController): "account": warehouse_account[sle.warehouse]["account"], "against_type": "Account", "against": expense_account, + "against_link": expense_account, "cost_center": item_row.cost_center, "project": item_row.project or self.get("project"), "remarks": self.get("remarks") or _("Accounting Entry for Stock"), @@ -181,6 +182,7 @@ class StockController(AccountsController): "account": expense_account, "against_type": "Account", "against": warehouse_account[sle.warehouse]["account"], + "against_link": warehouse_account[sle.warehouse]["account"], "cost_center": item_row.cost_center, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), "debit": -1 * flt(sle.stock_value_difference, precision), @@ -214,6 +216,7 @@ class StockController(AccountsController): "account": expense_account, "against_type": "Account", "against": warehouse_asset_account, + "against_link": warehouse_asset_account, "cost_center": item_row.cost_center, "project": item_row.project or self.get("project"), "remarks": _("Rounding gain/loss Entry for Stock Transfer"), @@ -231,6 +234,7 @@ class StockController(AccountsController): "account": warehouse_asset_account, "against_type": "Account", "against": expense_account, + "against_link": expense_account, "cost_center": item_row.cost_center, "remarks": _("Rounding gain/loss Entry for Stock Transfer"), "credit": sle_rounding_diff, @@ -847,6 +851,7 @@ class StockController(AccountsController): "credit": credit, "against_type": against_type, "against": against_account, + "against_link": against_account, "remarks": remarks, } diff --git a/erpnext/regional/united_arab_emirates/utils.py b/erpnext/regional/united_arab_emirates/utils.py index a850d5be7c..250a4b1495 100644 --- a/erpnext/regional/united_arab_emirates/utils.py +++ b/erpnext/regional/united_arab_emirates/utils.py @@ -155,6 +155,7 @@ def make_gl_entry(tax, gl_entries, doc, tax_accounts): "posting_date": doc.posting_date, "against_type": "Supplier", "against": doc.supplier, + "against_link": doc.supplier, dr_or_cr: tax.base_tax_amount_after_discount_amount, dr_or_cr + "_in_account_currency": tax.base_tax_amount_after_discount_amount if account_currency == doc.company_currency diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 1ed2f98a9d..e87658bc98 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -1388,6 +1388,7 @@ class StockEntry(StockController): "account": account, "against_type": "Account", "against": d.expense_account, + "against_link": d.expense_account, "cost_center": d.cost_center, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), "credit_in_account_currency": flt(amount["amount"]), @@ -1403,6 +1404,7 @@ class StockEntry(StockController): "account": d.expense_account, "against_type": "Account", "against": account, + "against_link": account, "cost_center": d.cost_center, "remarks": self.get("remarks") or _("Accounting Entry for Stock"), "credit": -1