[Fix] Getting an error cost center is not defined in the purchase receipt, even if it's defined in the company (#10320)
This commit is contained in:
committed by
Nabin Hait
parent
aac8349391
commit
2e8232e7aa
@@ -83,10 +83,12 @@ class BuyingController(StockController):
|
||||
|
||||
def set_landed_cost_voucher_amount(self):
|
||||
for d in self.get("items"):
|
||||
lc_voucher_amount = frappe.db.sql("""select sum(applicable_charges)
|
||||
lc_voucher_data = frappe.db.sql("""select sum(applicable_charges), cost_center
|
||||
from `tabLanded Cost Item`
|
||||
where docstatus = 1 and purchase_receipt_item = %s""", d.name)
|
||||
d.landed_cost_voucher_amount = lc_voucher_amount[0][0] if lc_voucher_amount else 0.0
|
||||
d.landed_cost_voucher_amount = lc_voucher_data[0][0] if lc_voucher_data else 0.0
|
||||
if not d.cost_center and lc_voucher_data and lc_voucher_data[0][1]:
|
||||
d.db_set('cost_center', lc_voucher_data[0][1])
|
||||
|
||||
def set_total_in_words(self):
|
||||
from frappe.utils import money_in_words
|
||||
|
||||
Reference in New Issue
Block a user