Skip to content

Commit

Permalink
Merge pull request #73 from 8848digital/purchase_receipt_save_issue
Browse files Browse the repository at this point in the history
fix: purchase_issue_save_issue
  • Loading branch information
aasif-patel authored Sep 27, 2024
2 parents 64c8d03 + d5d8ce7 commit abda06d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions erpnext/controllers/buying_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,19 @@ def get_asset_items(self):
def set_landed_cost_voucher_amount(self):
for d in self.get("items"):
lc_voucher_data = frappe.db.sql(
"""select sum(applicable_charges), cost_center
"""select sum(applicable_charges) as total_applicable_charges, cost_center
from `tabLanded Cost Item`
where docstatus = 1 and purchase_receipt_item = %s and receipt_document = %s""",
where docstatus = 1 and purchase_receipt_item = %s and receipt_document = %s
group by cost_center""",
(d.name, self.name),
)
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])

if lc_voucher_data:
d.landed_cost_voucher_amount = lc_voucher_data[0][0] or 0.0
if not d.cost_center and lc_voucher_data[0][1]:
d.db_set("cost_center", lc_voucher_data[0][1])
else:
d.landed_cost_voucher_amount = 0.0

def validate_from_warehouse(self):
for item in self.get("items"):
Expand Down

0 comments on commit abda06d

Please sign in to comment.