mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
refactor: set transaction currency dr/cr in sales invoice
This commit is contained in:
@@ -1271,6 +1271,7 @@ class SalesInvoice(SellingController):
|
|||||||
"debit_in_account_currency": base_grand_total
|
"debit_in_account_currency": base_grand_total
|
||||||
if self.party_account_currency == self.company_currency
|
if self.party_account_currency == self.company_currency
|
||||||
else grand_total,
|
else grand_total,
|
||||||
|
"debit_in_transaction_currency": grand_total,
|
||||||
"against_voucher": against_voucher,
|
"against_voucher": against_voucher,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
@@ -1302,6 +1303,9 @@ class SalesInvoice(SellingController):
|
|||||||
if account_currency == self.company_currency
|
if account_currency == self.company_currency
|
||||||
else flt(amount, tax.precision("tax_amount_after_discount_amount"))
|
else flt(amount, tax.precision("tax_amount_after_discount_amount"))
|
||||||
),
|
),
|
||||||
|
"credit_in_transaction_currency": flt(
|
||||||
|
amount, tax.precision("tax_amount_after_discount_amount")
|
||||||
|
),
|
||||||
"cost_center": tax.cost_center,
|
"cost_center": tax.cost_center,
|
||||||
},
|
},
|
||||||
account_currency,
|
account_currency,
|
||||||
@@ -1319,6 +1323,7 @@ class SalesInvoice(SellingController):
|
|||||||
"against": self.customer,
|
"against": self.customer,
|
||||||
"debit": flt(self.total_taxes_and_charges),
|
"debit": flt(self.total_taxes_and_charges),
|
||||||
"debit_in_account_currency": flt(self.base_total_taxes_and_charges),
|
"debit_in_account_currency": flt(self.base_total_taxes_and_charges),
|
||||||
|
"debit_in_transaction_currency": flt(self.total_taxes_and_charges),
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
},
|
},
|
||||||
account_currency,
|
account_currency,
|
||||||
@@ -1417,6 +1422,7 @@ class SalesInvoice(SellingController):
|
|||||||
if account_currency == self.company_currency
|
if account_currency == self.company_currency
|
||||||
else flt(amount, item.precision("net_amount"))
|
else flt(amount, item.precision("net_amount"))
|
||||||
),
|
),
|
||||||
|
"credit_in_transaction_currency": flt(amount, item.precision("net_amount")),
|
||||||
"cost_center": item.cost_center,
|
"cost_center": item.cost_center,
|
||||||
"project": item.project or self.project,
|
"project": item.project or self.project,
|
||||||
},
|
},
|
||||||
@@ -1468,6 +1474,7 @@ class SalesInvoice(SellingController):
|
|||||||
+ cstr(self.loyalty_redemption_account)
|
+ cstr(self.loyalty_redemption_account)
|
||||||
+ " for the Loyalty Program",
|
+ " for the Loyalty Program",
|
||||||
"credit": self.loyalty_amount,
|
"credit": self.loyalty_amount,
|
||||||
|
"credit_in_transaction_currency": self.loyalty_amount,
|
||||||
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
@@ -1482,6 +1489,7 @@ class SalesInvoice(SellingController):
|
|||||||
"cost_center": self.cost_center or self.loyalty_redemption_cost_center,
|
"cost_center": self.cost_center or self.loyalty_redemption_cost_center,
|
||||||
"against": self.customer,
|
"against": self.customer,
|
||||||
"debit": self.loyalty_amount,
|
"debit": self.loyalty_amount,
|
||||||
|
"debit_in_transaction_currency": self.loyalty_amount,
|
||||||
"remark": "Loyalty Points redeemed by the customer",
|
"remark": "Loyalty Points redeemed by the customer",
|
||||||
},
|
},
|
||||||
item=self,
|
item=self,
|
||||||
@@ -1515,6 +1523,7 @@ class SalesInvoice(SellingController):
|
|||||||
"credit_in_account_currency": payment_mode.base_amount
|
"credit_in_account_currency": payment_mode.base_amount
|
||||||
if self.party_account_currency == self.company_currency
|
if self.party_account_currency == self.company_currency
|
||||||
else payment_mode.amount,
|
else payment_mode.amount,
|
||||||
|
"credit_in_transaction_currency": payment_mode.amount,
|
||||||
"against_voucher": against_voucher,
|
"against_voucher": against_voucher,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
@@ -1534,6 +1543,7 @@ class SalesInvoice(SellingController):
|
|||||||
"debit_in_account_currency": payment_mode.base_amount
|
"debit_in_account_currency": payment_mode.base_amount
|
||||||
if payment_mode_account_currency == self.company_currency
|
if payment_mode_account_currency == self.company_currency
|
||||||
else payment_mode.amount,
|
else payment_mode.amount,
|
||||||
|
"debit_in_transaction_currency": payment_mode.amount,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
},
|
},
|
||||||
payment_mode_account_currency,
|
payment_mode_account_currency,
|
||||||
@@ -1562,6 +1572,7 @@ class SalesInvoice(SellingController):
|
|||||||
"debit_in_account_currency": flt(self.base_change_amount)
|
"debit_in_account_currency": flt(self.base_change_amount)
|
||||||
if self.party_account_currency == self.company_currency
|
if self.party_account_currency == self.company_currency
|
||||||
else flt(self.change_amount),
|
else flt(self.change_amount),
|
||||||
|
"debit_in_transaction_currency": flt(self.change_amount),
|
||||||
"against_voucher": self.return_against
|
"against_voucher": self.return_against
|
||||||
if cint(self.is_return) and self.return_against
|
if cint(self.is_return) and self.return_against
|
||||||
else self.name,
|
else self.name,
|
||||||
@@ -1577,6 +1588,7 @@ class SalesInvoice(SellingController):
|
|||||||
"account": self.account_for_change_amount,
|
"account": self.account_for_change_amount,
|
||||||
"against": self.customer,
|
"against": self.customer,
|
||||||
"credit": self.base_change_amount,
|
"credit": self.base_change_amount,
|
||||||
|
"credit_in_transaction_currency": self.change_amount,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
},
|
},
|
||||||
item=self,
|
item=self,
|
||||||
@@ -1606,6 +1618,9 @@ class SalesInvoice(SellingController):
|
|||||||
if self.party_account_currency == self.company_currency
|
if self.party_account_currency == self.company_currency
|
||||||
else flt(self.write_off_amount, self.precision("write_off_amount"))
|
else flt(self.write_off_amount, self.precision("write_off_amount"))
|
||||||
),
|
),
|
||||||
|
"credit_in_transaction_currency": flt(
|
||||||
|
self.write_off_amount, self.precision("write_off_amount")
|
||||||
|
),
|
||||||
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
@@ -1626,6 +1641,9 @@ class SalesInvoice(SellingController):
|
|||||||
if write_off_account_currency == self.company_currency
|
if write_off_account_currency == self.company_currency
|
||||||
else flt(self.write_off_amount, self.precision("write_off_amount"))
|
else flt(self.write_off_amount, self.precision("write_off_amount"))
|
||||||
),
|
),
|
||||||
|
"debit_in_transaction_currency": flt(
|
||||||
|
self.write_off_amount, self.precision("write_off_amount")
|
||||||
|
),
|
||||||
"cost_center": self.cost_center or self.write_off_cost_center or default_cost_center,
|
"cost_center": self.cost_center or self.write_off_cost_center or default_cost_center,
|
||||||
},
|
},
|
||||||
write_off_account_currency,
|
write_off_account_currency,
|
||||||
@@ -1670,6 +1688,9 @@ class SalesInvoice(SellingController):
|
|||||||
"credit_in_account_currency": flt(
|
"credit_in_account_currency": flt(
|
||||||
self.rounding_adjustment, self.precision("rounding_adjustment")
|
self.rounding_adjustment, self.precision("rounding_adjustment")
|
||||||
),
|
),
|
||||||
|
"credit_in_transaction_currency": flt(
|
||||||
|
self.rounding_adjustment, self.precision("rounding_adjustment")
|
||||||
|
),
|
||||||
"credit": flt(
|
"credit": flt(
|
||||||
self.base_rounding_adjustment, self.precision("base_rounding_adjustment")
|
self.base_rounding_adjustment, self.precision("base_rounding_adjustment")
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user