refactor: checkbox to toggle parent doc cost center preference
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index db61995..e16b1b1 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -1464,7 +1464,7 @@
and not self.is_internal_transfer()
):
round_off_account, round_off_cost_center = get_round_off_account_and_cost_center(
- self.company, "Sales Invoice", self.name
+ self.company, "Sales Invoice", self.name, self.use_company_roundoff_cost_center
)
gl_entries.append(
@@ -1476,7 +1476,9 @@
self.rounding_adjustment, self.precision("rounding_adjustment")
),
"credit": flt(self.base_rounding_adjustment, self.precision("base_rounding_adjustment")),
- "cost_center": self.cost_center or round_off_cost_center,
+ "cost_center": round_off_cost_center
+ if self.use_company_roundoff_cost_center
+ else (self.cost_center or round_off_cost_center),
},
item=self,
)