fix: set against type in controllers
This commit is contained in:
@@ -1040,6 +1040,7 @@ class AccountsController(TransactionBase):
|
||||
)
|
||||
|
||||
credit_or_debit = "credit" if self.doctype == "Purchase Invoice" else "debit"
|
||||
against_type = "Supplier" if self.doctype == "Purchase Invoice" else "Customer"
|
||||
against = self.supplier if self.doctype == "Purchase Invoice" else self.customer
|
||||
|
||||
if precision_loss:
|
||||
@@ -1047,6 +1048,7 @@ class AccountsController(TransactionBase):
|
||||
self.get_gl_dict(
|
||||
{
|
||||
"account": round_off_account,
|
||||
"against_type": against_type,
|
||||
"against": against,
|
||||
credit_or_debit: precision_loss,
|
||||
"cost_center": round_off_cost_center
|
||||
@@ -1394,11 +1396,13 @@ class AccountsController(TransactionBase):
|
||||
if self.doctype == "Purchase Invoice":
|
||||
dr_or_cr = "credit"
|
||||
rev_dr_cr = "debit"
|
||||
against_type = "Supplier"
|
||||
supplier_or_customer = self.supplier
|
||||
|
||||
else:
|
||||
dr_or_cr = "debit"
|
||||
rev_dr_cr = "credit"
|
||||
against_type = "Customer"
|
||||
supplier_or_customer = self.customer
|
||||
|
||||
if enable_discount_accounting:
|
||||
@@ -1423,6 +1427,7 @@ class AccountsController(TransactionBase):
|
||||
self.get_gl_dict(
|
||||
{
|
||||
"account": item.discount_account,
|
||||
"against_type": against_type,
|
||||
"against": supplier_or_customer,
|
||||
dr_or_cr: flt(
|
||||
discount_amount * self.get("conversion_rate"), item.precision("discount_amount")
|
||||
@@ -1441,6 +1446,7 @@ class AccountsController(TransactionBase):
|
||||
self.get_gl_dict(
|
||||
{
|
||||
"account": income_or_expense_account,
|
||||
"against_type": against_type,
|
||||
"against": supplier_or_customer,
|
||||
rev_dr_cr: flt(
|
||||
discount_amount * self.get("conversion_rate"), item.precision("discount_amount")
|
||||
@@ -1464,6 +1470,7 @@ class AccountsController(TransactionBase):
|
||||
self.get_gl_dict(
|
||||
{
|
||||
"account": self.additional_discount_account,
|
||||
"against_type": against_type,
|
||||
"against": supplier_or_customer,
|
||||
dr_or_cr: self.base_discount_amount,
|
||||
"cost_center": self.cost_center,
|
||||
|
||||
Reference in New Issue
Block a user