From 1710e10b31104cb9b4cf009cff99d6ef7bc34d56 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sun, 14 Jan 2024 11:01:27 +0530 Subject: [PATCH] Revert "fix: set against type in inv gl dict" This reverts commit 19b220f39ca3596e416d99f3aef7c2485019b9fd. --- .../purchase_invoice/purchase_invoice.py | 23 +------------------ .../doctype/sales_invoice/sales_invoice.py | 21 ++++------------- 2 files changed, 5 insertions(+), 39 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index b8ecf983ec..fa365fcc7c 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -827,7 +827,6 @@ class PurchaseInvoice(BuyingController): "party_type": "Supplier", "party": self.supplier, "due_date": self.due_date, - "against_type": "Account", "against": self.against_expense_account, "against_link": self.against_expense_account, "credit": base_grand_total, @@ -902,7 +901,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "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, @@ -924,7 +922,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "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, @@ -943,7 +940,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "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")), @@ -962,7 +958,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "account": item.expense_account, - "against_type": "Supplier", "against": self.supplier, "against_link": self.supplier, "debit": warehouse_debit_amount, @@ -983,7 +978,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "account": account, - "against_type": "Account", "against": item.expense_account, "against_link": item.expense_account, "cost_center": item.cost_center, @@ -1005,7 +999,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "account": supplier_warehouse_account, - "against_type": "Account", "against": item.expense_account, "against_link": item.expense_account, "cost_center": item.cost_center, @@ -1062,7 +1055,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "account": expense_account, - "against_type": "Supplier", "against": self.supplier, "against_link": self.supplier, "debit": amount, @@ -1090,7 +1082,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "account": expense_account, - "against_type": "Supplier", "against": self.supplier, "against_link": self.supplier, "debit": discrepancy_caused_by_exchange_rate_difference, @@ -1105,7 +1096,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "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, @@ -1140,8 +1130,7 @@ class PurchaseInvoice(BuyingController): gl_entries.append( self.get_gl_dict( { - "account": stock_rbnb, - "against_type": "Supplier", + "account": self.stock_received_but_not_billed, "against": self.supplier, "against_link": self.supplier, "debit": flt(item.item_tax_amount, item.precision("item_tax_amount")), @@ -1204,7 +1193,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "account": cost_of_goods_sold_account, - "against_type": "Account", "against": item.expense_account, "against_link": item.expense_account, "debit": stock_adjustment_amt, @@ -1236,7 +1224,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "account": tax.account_head, - "against_type": "Supplier", "against": self.supplier, "against_link": self.supplier, dr_or_cr: base_amount, @@ -1286,7 +1273,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "account": tax.account_head, - "against_type": "Supplier", "cost_center": tax.cost_center, "against": self.supplier, "against_link": self.supplier, @@ -1307,7 +1293,6 @@ class PurchaseInvoice(BuyingController): { "account": tax.account_head, "cost_center": tax.cost_center, - "against_type": "Supplier", "against": self.supplier, "against_link": self.supplier, "credit": valuation_tax[tax.name], @@ -1324,7 +1309,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "account": self.unrealized_profit_loss_account, - "against_type": "Supplier", "against": self.supplier, "against_link": self.supplier, "credit": flt(self.total_taxes_and_charges), @@ -1347,7 +1331,6 @@ class PurchaseInvoice(BuyingController): "account": self.credit_to, "party_type": "Supplier", "party": self.supplier, - "against_type": "Account", "against": self.cash_bank_account, "against_link": self.cash_bank_account, "debit": self.base_paid_amount, @@ -1370,7 +1353,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "account": self.cash_bank_account, - "against_type": "Supplier", "against": self.supplier, "against_link": self.supplier, "credit": self.base_paid_amount, @@ -1396,7 +1378,6 @@ class PurchaseInvoice(BuyingController): "account": self.credit_to, "party_type": "Supplier", "party": self.supplier, - "against_type": "Account", "against": self.write_off_account, "against_link": self.write_off_account, "debit": self.base_write_off_amount, @@ -1418,7 +1399,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "account": self.write_off_account, - "against_type": "Supplier", "against": self.supplier, "against_link": self.supplier, "credit": flt(self.base_write_off_amount), @@ -1447,7 +1427,6 @@ class PurchaseInvoice(BuyingController): self.get_gl_dict( { "account": round_off_account, - "against_type": "Supplier", "against": self.supplier, "against_link": self.supplier, "debit_in_account_currency": self.rounding_adjustment, diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 8da45054c2..7f00f0fd4f 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -7,7 +7,7 @@ from frappe import _, msgprint, throw from frappe.contacts.doctype.address.address import get_address_display from frappe.model.mapper import get_mapped_doc from frappe.model.utils import get_fetch_values -from frappe.utils import add_days, cint, flt, formatdate, get_link_to_form, getdate, nowdate +from frappe.utils import add_days, cint, cstr, flt, formatdate, get_link_to_form, getdate, nowdate import erpnext from erpnext.accounts.deferred_revenue import validate_service_stop_date @@ -1233,7 +1233,6 @@ class SalesInvoice(SellingController): "party_type": "Customer", "party": self.customer, "due_date": self.due_date, - "against_type": "Account", "against": self.against_income_account, "against_link": self.against_income_account, "debit": base_grand_total, @@ -1264,7 +1263,6 @@ class SalesInvoice(SellingController): self.get_gl_dict( { "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")), @@ -1287,7 +1285,6 @@ class SalesInvoice(SellingController): self.get_gl_dict( { "account": self.unrealized_profit_loss_account, - "against_type": "Customer", "against": self.customer, "against_link": self.customer, "debit": flt(self.total_taxes_and_charges), @@ -1357,7 +1354,6 @@ class SalesInvoice(SellingController): add_asset_activity(asset.name, _("Asset sold")) 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)) @@ -1380,7 +1376,6 @@ class SalesInvoice(SellingController): self.get_gl_dict( { "account": income_account, - "against_type": "Customer", "against": self.customer, "against_link": self.customer, "credit": flt(base_amount, item.precision("base_net_amount")), @@ -1436,9 +1431,9 @@ class SalesInvoice(SellingController): "account": self.debit_to, "party_type": "Customer", "party": self.customer, - "against_type": "Account", - "against": self.loyalty_redemption_account, - "against_link": self.loyalty_redemption_account, + "against": "Expense account - " + + cstr(self.loyalty_redemption_account) + + " for the Loyalty Program", "credit": self.loyalty_amount, "against_voucher": self.return_against if cint(self.is_return) else self.name, "against_voucher_type": self.doctype, @@ -1452,7 +1447,6 @@ class SalesInvoice(SellingController): { "account": self.loyalty_redemption_account, "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, @@ -1481,7 +1475,6 @@ class SalesInvoice(SellingController): "account": self.debit_to, "party_type": "Customer", "party": self.customer, - "against_type": "Account", "against": payment_mode.account, "against_link": payment_mode.account, "credit": payment_mode.base_amount, @@ -1504,7 +1497,6 @@ class SalesInvoice(SellingController): self.get_gl_dict( { "account": payment_mode.account, - "against_type": "Customer", "against": self.customer, "against_link": self.customer, "debit": payment_mode.base_amount, @@ -1530,7 +1522,6 @@ class SalesInvoice(SellingController): "account": self.debit_to, "party_type": "Customer", "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), @@ -1553,7 +1544,6 @@ class SalesInvoice(SellingController): self.get_gl_dict( { "account": self.account_for_change_amount, - "against_type": "Customer", "against": self.customer, "against_link": self.customer, "credit": self.base_change_amount, @@ -1581,7 +1571,6 @@ class SalesInvoice(SellingController): "account": self.debit_to, "party_type": "Customer", "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")), @@ -1603,7 +1592,6 @@ class SalesInvoice(SellingController): self.get_gl_dict( { "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")), @@ -1633,7 +1621,6 @@ class SalesInvoice(SellingController): self.get_gl_dict( { "account": round_off_account, - "against_type": "Customer", "against": self.customer, "against_link": self.customer, "credit_in_account_currency": flt(