Minor fixes

This commit is contained in:
Nabin Hait 2014-06-20 19:37:53 +05:30
parent 3c946b2a72
commit 56f6d01757
2 changed files with 16 additions and 16 deletions

View File

@ -126,18 +126,18 @@
"options": "Supplier Type",
"permlevel": 0
},
{
"fieldname": "max_qty",
"fieldtype": "Float",
"label": "Max Qty",
"permlevel": 0
},
{
"fieldname": "min_qty",
"fieldtype": "Float",
"label": "Min Qty",
"permlevel": 0
},
{
"fieldname": "max_qty",
"fieldtype": "Float",
"label": "Max Qty",
"permlevel": 0
},
{
"fieldname": "col_break1",
"fieldtype": "Column Break",
@ -235,7 +235,7 @@
"icon": "icon-gift",
"idx": 1,
"istable": 0,
"modified": "2014-06-19 15:00:09.962572",
"modified": "2014-06-20 19:36:22.502381",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Pricing Rule",
@ -244,8 +244,8 @@
{
"create": 1,
"delete": 1,
"export": 0,
"import": 0,
"export": 1,
"import": 1,
"permlevel": 0,
"read": 1,
"report": 1,
@ -290,7 +290,6 @@
"permlevel": 0,
"read": 1,
"report": 1,
"restrict": 1,
"role": "System Manager",
"write": 1
}

View File

@ -66,7 +66,7 @@ class PricingRule(Document):
if self.price_or_discount == "Discount Percentage" and self.item_code:
max_discount = frappe.db.get_value("Item", self.item_code, "max_discount")
if max_discount and flt(self.discount_percentage) > flt(max_discount):
throw(_("Max discount allowed for item: {0} is {1}%".format(self.item_code, max_discount)))
throw(_("Max discount allowed for item: {0} is {1}%").format(self.item_code, max_discount))
#--------------------------------------------------------------------------------
@ -141,7 +141,8 @@ def get_pricing_rule_for_item(args):
item_details.pricing_rule = pricing_rule.name
if pricing_rule.price_or_discount == "Price":
item_details.update({
"price_list_rate": pricing_rule.price*flt(args.plc_conversion_rate)/flt(args.conversion_rate),
"price_list_rate": pricing_rule.price/flt(args.conversion_rate) \
if args.conversion_rate else 0.0,
"discount_percentage": 0.0
})
else:
@ -167,10 +168,10 @@ def get_pricing_rules(args):
conditions = ""
for field in ["company", "customer", "supplier", "supplier_type", "campaign", "sales_partner"]:
if args.get(field):
conditions += " and ifnull("+field+", '') in (%("+field+")s, '')"
else:
conditions += " and ifnull("+field+", '') = ''"
if args.get(field):
conditions += " and ifnull("+field+", '') in (%("+field+")s, '')"
else:
conditions += " and ifnull("+field+", '') = ''"
for parenttype in ["Customer Group", "Territory"]:
group_condition = _get_tree_conditions(parenttype)