[fix] calculated rate on py side, added depends on for sales order item
This commit is contained in:
parent
1e428ae400
commit
dcd8b7773d
@ -129,9 +129,9 @@ def get_pricing_rule_for_item(args):
|
||||
# if ignore pricing rule then set the rate or amount field to zero
|
||||
if item_details.doctype in ["Quotation Item", "Sales Order Item"]:
|
||||
item_details.update({
|
||||
"type":"Percentage",
|
||||
"type":"",
|
||||
"rate_or_amount": 0.00
|
||||
})
|
||||
})
|
||||
return item_details
|
||||
|
||||
if not (args.item_group and args.brand):
|
||||
|
@ -61,7 +61,8 @@ class calculate_taxes_and_totals(object):
|
||||
|
||||
if item.doctype in ['Quotation Item', 'Sales Order Item']:
|
||||
item.total_margin = self.calculate_margin(item)
|
||||
item.rate = item.total_margin if item.total_margin > 0 else item.rate
|
||||
item.rate = flt(item.total_margin * (1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))\
|
||||
if item.total_margin > 0 else item.rate
|
||||
|
||||
item.net_rate = item.rate
|
||||
item.amount = flt(item.rate * item.qty, item.precision("amount"))
|
||||
|
@ -565,6 +565,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"depends_on": "eval: doc.type != \"\"",
|
||||
"fieldname": "rate_or_amount",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
@ -585,6 +586,31 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"depends_on": "eval: doc.type != \"\"",
|
||||
"fieldname": "total_margin",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Total Margin",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
|
Loading…
Reference in New Issue
Block a user