mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-08 17:35:08 +00:00
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com> fix: shipping rule applied twice on non stock items (#53655)
This commit is contained in:
@@ -152,7 +152,9 @@ class ShippingRule(Document):
|
||||
frappe.throw(_("Shipping rule only applicable for Buying"))
|
||||
|
||||
shipping_charge["doctype"] = "Purchase Taxes and Charges"
|
||||
shipping_charge["category"] = "Valuation and Total"
|
||||
shipping_charge["category"] = (
|
||||
"Valuation and Total" if doc.get_stock_items() or doc.get_asset_items() else "Total"
|
||||
)
|
||||
shipping_charge["add_deduct_tax"] = "Add"
|
||||
|
||||
existing_shipping_charge = doc.get("taxes", filters=shipping_charge)
|
||||
|
||||
@@ -2289,6 +2289,16 @@ class AccountsController(TransactionBase):
|
||||
|
||||
return stock_items
|
||||
|
||||
def get_asset_items(self):
|
||||
asset_items = []
|
||||
item_codes = list(set(item.item_code for item in self.get("items")))
|
||||
if item_codes:
|
||||
asset_items = frappe.db.get_values(
|
||||
"Item", {"name": ["in", item_codes], "is_fixed_asset": 1}, pluck="name", cache=True
|
||||
)
|
||||
|
||||
return asset_items
|
||||
|
||||
def calculate_total_advance_from_ledger(self):
|
||||
adv = frappe.qb.DocType("Advance Payment Ledger Entry")
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user