[fix] calculated rate on py side, added depends on for sales order item
This commit is contained in:
parent
1e428ae400
commit
dcd8b7773d
@ -129,7 +129,7 @@ def get_pricing_rule_for_item(args):
|
|||||||
# if ignore pricing rule then set the rate or amount field to zero
|
# if ignore pricing rule then set the rate or amount field to zero
|
||||||
if item_details.doctype in ["Quotation Item", "Sales Order Item"]:
|
if item_details.doctype in ["Quotation Item", "Sales Order Item"]:
|
||||||
item_details.update({
|
item_details.update({
|
||||||
"type":"Percentage",
|
"type":"",
|
||||||
"rate_or_amount": 0.00
|
"rate_or_amount": 0.00
|
||||||
})
|
})
|
||||||
return item_details
|
return item_details
|
||||||
|
@ -61,7 +61,8 @@ class calculate_taxes_and_totals(object):
|
|||||||
|
|
||||||
if item.doctype in ['Quotation Item', 'Sales Order Item']:
|
if item.doctype in ['Quotation Item', 'Sales Order Item']:
|
||||||
item.total_margin = self.calculate_margin(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.net_rate = item.rate
|
||||||
item.amount = flt(item.rate * item.qty, item.precision("amount"))
|
item.amount = flt(item.rate * item.qty, item.precision("amount"))
|
||||||
|
@ -565,6 +565,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
|
"depends_on": "eval: doc.type != \"\"",
|
||||||
"fieldname": "rate_or_amount",
|
"fieldname": "rate_or_amount",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -585,6 +586,31 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 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,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user