diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 5d11797a5cb..dcfd8bb7ea4 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -363,7 +363,10 @@ class PurchaseInvoice(BuyingController): return gl_entries def make_supplier_gl_entry(self, gl_entries): - grand_total = self.rounded_total or self.grand_total + # Checked both rounding_adjustment and rounded_total + # because rounded_total had value even before introcution of posting GLE based on rounded total + grand_total = self.rounded_total if (self.rounding_adjustment and self.rounded_total) else self.grand_total + if grand_total: # Didnot use base_grand_total to book rounding loss gle grand_total_in_company_currency = flt(grand_total * self.conversion_rate, diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 27d35eb74f3..a6cd352b144 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -641,7 +641,9 @@ class SalesInvoice(SellingController): return gl_entries def make_customer_gl_entry(self, gl_entries): - grand_total = self.rounded_total or self.grand_total + # Checked both rounding_adjustment and rounded_total + # because rounded_total had value even before introcution of posting GLE based on rounded total + grand_total = self.rounded_total if (self.rounding_adjustment and self.rounded_total) else self.grand_total if grand_total: # Didnot use base_grand_total to book rounding loss gle grand_total_in_company_currency = flt(grand_total * self.conversion_rate,