sets tax category to "Total" if all items are non-stock items (#9295)
This commit is contained in:
parent
5da3ac63bf
commit
476c4fec1d
@ -73,10 +73,14 @@ class BuyingController(StockController):
|
|||||||
|
|
||||||
def validate_stock_or_nonstock_items(self):
|
def validate_stock_or_nonstock_items(self):
|
||||||
if self.meta.get_field("taxes") and not self.get_stock_items():
|
if self.meta.get_field("taxes") and not self.get_stock_items():
|
||||||
tax_for_valuation = [d.account_head for d in self.get("taxes")
|
tax_for_valuation = [d for d in self.get("taxes")
|
||||||
if d.category in ["Valuation", "Valuation and Total"]]
|
if d.category in ["Valuation", "Valuation and Total"]]
|
||||||
|
|
||||||
if tax_for_valuation:
|
if tax_for_valuation:
|
||||||
frappe.throw(_("Tax Category can not be 'Valuation' or 'Valuation and Total' as all items are non-stock items"))
|
for d in tax_for_valuation:
|
||||||
|
d.db_set("category", 'Total')
|
||||||
|
msgprint("Tax Category has been changed to \"Total\" because all Items in the Purchase Order "
|
||||||
|
"are non-stock items")
|
||||||
|
|
||||||
def set_landed_cost_voucher_amount(self):
|
def set_landed_cost_voucher_amount(self):
|
||||||
for d in self.get("items"):
|
for d in self.get("items"):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user