fix: set against type in inv gl dict
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 5597271..1dc67ef 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -623,6 +623,7 @@
"party_type": "Supplier",
"party": self.supplier,
"due_date": self.due_date,
+ "against_type": "Account",
"against": self.against_expense_account,
"credit": base_grand_total,
"credit_in_account_currency": base_grand_total
@@ -692,6 +693,7 @@
self.get_gl_dict(
{
"account": warehouse_account[item.warehouse]["account"],
+ "against_type": "Account",
"against": warehouse_account[item.from_warehouse]["account"],
"cost_center": item.cost_center,
"project": item.project or self.project,
@@ -712,6 +714,7 @@
self.get_gl_dict(
{
"account": warehouse_account[item.from_warehouse]["account"],
+ "against_type": "Account",
"against": warehouse_account[item.warehouse]["account"],
"cost_center": item.cost_center,
"project": item.project or self.project,
@@ -729,6 +732,7 @@
self.get_gl_dict(
{
"account": item.expense_account,
+ "against_type": "Supplier",
"against": self.supplier,
"debit": flt(item.base_net_amount, item.precision("base_net_amount")),
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
@@ -746,6 +750,7 @@
self.get_gl_dict(
{
"account": item.expense_account,
+ "against_type": "Supplier",
"against": self.supplier,
"debit": warehouse_debit_amount,
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
@@ -765,6 +770,7 @@
self.get_gl_dict(
{
"account": account,
+ "against_type": "Account",
"against": item.expense_account,
"cost_center": item.cost_center,
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
@@ -785,6 +791,7 @@
self.get_gl_dict(
{
"account": supplier_warehouse_account,
+ "against_type": "Account",
"against": item.expense_account,
"cost_center": item.cost_center,
"project": item.project or self.project,
@@ -842,6 +849,7 @@
self.get_gl_dict(
{
"account": expense_account,
+ "against_type": "Supplier",
"against": self.supplier,
"debit": amount,
"cost_center": item.cost_center,
@@ -868,6 +876,7 @@
self.get_gl_dict(
{
"account": expense_account,
+ "against_type": "Supplier",
"against": self.supplier,
"debit": discrepancy_caused_by_exchange_rate_difference,
"cost_center": item.cost_center,
@@ -881,6 +890,7 @@
self.get_gl_dict(
{
"account": self.get_company_default("exchange_gain_loss_account"),
+ "against_type": "Supplier",
"against": self.supplier,
"credit": discrepancy_caused_by_exchange_rate_difference,
"cost_center": item.cost_center,
@@ -901,6 +911,7 @@
self.get_gl_dict(
{
"account": expenses_included_in_asset_valuation,
+ "against_type": "Account",
"against": expense_account,
"cost_center": item.cost_center,
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
@@ -915,6 +926,7 @@
self.get_gl_dict(
{
"account": expense_account,
+ "against_type": "Account",
"against": expenses_included_in_asset_valuation,
"cost_center": item.cost_center,
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
@@ -954,6 +966,7 @@
self.get_gl_dict(
{
"account": self.stock_received_but_not_billed,
+ "against_type": "Supplier",
"against": self.supplier,
"debit": flt(item.item_tax_amount, item.precision("item_tax_amount")),
"remarks": self.remarks or _("Accounting Entry for Stock"),
@@ -993,6 +1006,7 @@
self.get_gl_dict(
{
"account": item.expense_account,
+ "against_type": "Supplier",
"against": self.supplier,
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
"debit": base_asset_amount,
@@ -1015,6 +1029,7 @@
self.get_gl_dict(
{
"account": eiiav_account,
+ "against_type": "Supplier",
"against": self.supplier,
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
"cost_center": item.cost_center,
@@ -1039,6 +1054,7 @@
self.get_gl_dict(
{
"account": cwip_account,
+ "against_type": "Supplier",
"against": self.supplier,
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
"debit": base_asset_amount,
@@ -1061,6 +1077,7 @@
self.get_gl_dict(
{
"account": eiiav_account,
+ "against_type": "Supplier",
"against": self.supplier,
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
"cost_center": item.cost_center,
@@ -1085,6 +1102,7 @@
self.get_gl_dict(
{
"account": eiiav_account,
+ "against_type": "Account",
"against": cwip_account,
"cost_center": item.cost_center,
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
@@ -1099,6 +1117,7 @@
self.get_gl_dict(
{
"account": cwip_account,
+ "against_type": "Account",
"against": eiiav_account,
"cost_center": item.cost_center,
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
@@ -1146,6 +1165,7 @@
self.get_gl_dict(
{
"account": cost_of_goods_sold_account,
+ "against_type": "Account",
"against": item.expense_account,
"debit": stock_adjustment_amt,
"remarks": self.get("remarks") or _("Stock Adjustment"),
@@ -1176,6 +1196,7 @@
self.get_gl_dict(
{
"account": tax.account_head,
+ "against_type": "Supplier",
"against": self.supplier,
dr_or_cr: base_amount,
dr_or_cr + "_in_account_currency": base_amount
@@ -1224,6 +1245,7 @@
self.get_gl_dict(
{
"account": tax.account_head,
+ "against_type": "Supplier",
"cost_center": tax.cost_center,
"against": self.supplier,
"credit": applicable_amount,
@@ -1243,6 +1265,7 @@
{
"account": tax.account_head,
"cost_center": tax.cost_center,
+ "against_type": "Supplier",
"against": self.supplier,
"credit": valuation_tax[tax.name],
"remarks": self.remarks or _("Accounting Entry for Stock"),
@@ -1258,6 +1281,7 @@
self.get_gl_dict(
{
"account": self.unrealized_profit_loss_account,
+ "against_type": "Supplier",
"against": self.supplier,
"credit": flt(self.total_taxes_and_charges),
"credit_in_account_currency": flt(self.base_total_taxes_and_charges),
@@ -1279,6 +1303,7 @@
"account": self.credit_to,
"party_type": "Supplier",
"party": self.supplier,
+ "against_type": "Account",
"against": self.cash_bank_account,
"debit": self.base_paid_amount,
"debit_in_account_currency": self.base_paid_amount
@@ -1300,6 +1325,7 @@
self.get_gl_dict(
{
"account": self.cash_bank_account,
+ "against_type": "Supplier",
"against": self.supplier,
"credit": self.base_paid_amount,
"credit_in_account_currency": self.base_paid_amount
@@ -1324,6 +1350,7 @@
"account": self.credit_to,
"party_type": "Supplier",
"party": self.supplier,
+ "against_type": "Account",
"against": self.write_off_account,
"debit": self.base_write_off_amount,
"debit_in_account_currency": self.base_write_off_amount
@@ -1344,6 +1371,7 @@
self.get_gl_dict(
{
"account": self.write_off_account,
+ "against_type": "Supplier",
"against": self.supplier,
"credit": flt(self.base_write_off_amount),
"credit_in_account_currency": self.base_write_off_amount
@@ -1371,6 +1399,7 @@
self.get_gl_dict(
{
"account": round_off_account,
+ "against_type": "Supplier",
"against": self.supplier,
"debit_in_account_currency": self.rounding_adjustment,
"debit": self.base_rounding_adjustment,
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 7bdb2b4..db3d5c6 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -1101,6 +1101,7 @@
"party_type": "Customer",
"party": self.customer,
"due_date": self.due_date,
+ "against_type": "Account",
"against": self.against_income_account,
"debit": base_grand_total,
"debit_in_account_currency": base_grand_total
@@ -1130,6 +1131,7 @@
self.get_gl_dict(
{
"account": tax.account_head,
+ "against_type": "Customer",
"against": self.customer,
"credit": flt(base_amount, tax.precision("tax_amount_after_discount_amount")),
"credit_in_account_currency": (
@@ -1151,6 +1153,7 @@
self.get_gl_dict(
{
"account": self.unrealized_profit_loss_account,
+ "against_type": "Customer",
"against": self.customer,
"debit": flt(self.total_taxes_and_charges),
"debit_in_account_currency": flt(self.base_total_taxes_and_charges),
@@ -1219,6 +1222,7 @@
add_asset_activity(asset.name, _("Asset sold"))
for gle in fixed_asset_gl_entries:
+ gle["against_type"] = "Customer"
gle["against"] = self.customer
gl_entries.append(self.get_gl_dict(gle, item=item))
@@ -1240,6 +1244,7 @@
self.get_gl_dict(
{
"account": income_account,
+ "against_type": "Customer",
"against": self.customer,
"credit": flt(base_amount, item.precision("base_net_amount")),
"credit_in_account_currency": (
@@ -1294,6 +1299,7 @@
"account": self.debit_to,
"party_type": "Customer",
"party": self.customer,
+ "against_type": "Account",
"against": "Expense account - "
+ cstr(self.loyalty_redemption_account)
+ " for the Loyalty Program",
@@ -1310,6 +1316,7 @@
{
"account": self.loyalty_redemption_account,
"cost_center": self.cost_center or self.loyalty_redemption_cost_center,
+ "against_type": "Customer",
"against": self.customer,
"debit": self.loyalty_amount,
"remark": "Loyalty Points redeemed by the customer",
@@ -1337,6 +1344,7 @@
"account": self.debit_to,
"party_type": "Customer",
"party": self.customer,
+ "against_type": "Account",
"against": payment_mode.account,
"credit": payment_mode.base_amount,
"credit_in_account_currency": payment_mode.base_amount
@@ -1358,6 +1366,7 @@
self.get_gl_dict(
{
"account": payment_mode.account,
+ "against_type": "Customer",
"against": self.customer,
"debit": payment_mode.base_amount,
"debit_in_account_currency": payment_mode.base_amount
@@ -1382,6 +1391,7 @@
"account": self.debit_to,
"party_type": "Customer",
"party": self.customer,
+ "against_type": "Account",
"against": self.account_for_change_amount,
"debit": flt(self.base_change_amount),
"debit_in_account_currency": flt(self.base_change_amount)
@@ -1403,6 +1413,7 @@
self.get_gl_dict(
{
"account": self.account_for_change_amount,
+ "against_type": "Customer",
"against": self.customer,
"credit": self.base_change_amount,
"cost_center": self.cost_center,
@@ -1429,6 +1440,7 @@
"account": self.debit_to,
"party_type": "Customer",
"party": self.customer,
+ "against_type": "Account",
"against": self.write_off_account,
"credit": flt(self.base_write_off_amount, self.precision("base_write_off_amount")),
"credit_in_account_currency": (
@@ -1449,6 +1461,7 @@
self.get_gl_dict(
{
"account": self.write_off_account,
+ "against_type": "Customer",
"against": self.customer,
"debit": flt(self.base_write_off_amount, self.precision("base_write_off_amount")),
"debit_in_account_currency": (
@@ -1477,6 +1490,7 @@
self.get_gl_dict(
{
"account": round_off_account,
+ "against_type": "Customer",
"against": self.customer,
"credit_in_account_currency": flt(
self.rounding_adjustment, self.precision("rounding_adjustment")