mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-24 12:36:37 +00:00
fix: multiple pricing rule issue (#24509)
This commit is contained in:
@@ -121,7 +121,7 @@ class AccountsController(TransactionBase):
|
||||
|
||||
def before_cancel(self):
|
||||
validate_einvoice_fields(self)
|
||||
|
||||
|
||||
def on_trash(self):
|
||||
# delete sl and gl entries on deletion of transaction
|
||||
if frappe.db.get_single_value('Accounts Settings', 'delete_linked_ledger_entries'):
|
||||
|
||||
@@ -616,7 +616,6 @@ class calculate_taxes_and_totals(object):
|
||||
self.doc.precision("base_write_off_amount"))
|
||||
|
||||
def calculate_margin(self, item):
|
||||
|
||||
rate_with_margin = 0.0
|
||||
base_rate_with_margin = 0.0
|
||||
if item.price_list_rate:
|
||||
@@ -625,8 +624,8 @@ class calculate_taxes_and_totals(object):
|
||||
for d in get_applied_pricing_rules(item.pricing_rules):
|
||||
pricing_rule = frappe.get_cached_doc('Pricing Rule', d)
|
||||
|
||||
if (pricing_rule.margin_type in ['Amount', 'Percentage'] and pricing_rule.currency == self.doc.currency)\
|
||||
or (pricing_rule.margin_type == 'Percentage'):
|
||||
if (pricing_rule.margin_rate_or_amount and pricing_rule.currency == self.doc.currency and
|
||||
pricing_rule.margin_type in ['Amount', 'Percentage']):
|
||||
item.margin_type = pricing_rule.margin_type
|
||||
item.margin_rate_or_amount = pricing_rule.margin_rate_or_amount
|
||||
has_margin = True
|
||||
|
||||
Reference in New Issue
Block a user