refactor: checkbox to toggle parent doc cost center preference

(cherry picked from commit 4ccce93394)
This commit is contained in:
ruthra kumar
2023-04-28 14:20:06 +05:30
committed by Mergify
parent 3810b02023
commit 8ac718d98c

View File

@@ -1450,7 +1450,7 @@ class SalesInvoice(SellingController):
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(
@@ -1462,7 +1462,9 @@ class SalesInvoice(SellingController):
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,
)