[fixes] precision in purchase receipt and item group route

This commit is contained in:
Rushabh Mehta 2015-02-16 18:26:38 +05:30
parent 7a64cb2aa5
commit 36b84408a8
4 changed files with 15 additions and 3 deletions

View File

@ -12,6 +12,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.set_root_readonly = function(doc) {
// read-only for root item group
cur_frm.set_intro("");
if(!doc.parent_item_group) {
cur_frm.set_read_only();
cur_frm.set_intro(__("This is a root item group and cannot be edited."), true);

View File

@ -104,7 +104,7 @@
"in_list_view": 0,
"label": "Page Name",
"permlevel": 0,
"read_only": 1
"read_only": 0
},
{
"depends_on": "show_in_website",
@ -190,7 +190,7 @@
"in_create": 1,
"issingle": 0,
"max_attachments": 3,
"modified": "2015-02-05 05:11:39.844136",
"modified": "2015-02-16 05:44:59.435380",
"modified_by": "Administrator",
"module": "Setup",
"name": "Item Group",

View File

@ -34,6 +34,17 @@ class ItemGroup(NestedSet, WebsiteGenerator):
NestedSet.on_trash(self)
WebsiteGenerator.on_trash(self)
def set_parent_website_route(self):
"""Overwrite `parent_website_route` from `WebsiteGenerator`.
Only set `parent_website_route` if parent is visble.
e.g. If `show_in_website` is set for Products then url should be `/products`"""
if self.parent_item_group and frappe.db.get_value("Item Group",
self.parent_item_group, "show_in_website"):
super(WebsiteGenerator, self)()
else:
self.parent_website_route = ""
def validate_name_with_item(self):
if frappe.db.exists("Item", self.name):
frappe.throw(frappe._("An item exists with same name ({0}), please change the item group name or rename the item").format(self.name))

View File

@ -135,7 +135,7 @@ class PurchaseReceipt(BuyingController):
pr_qty = flt(d.qty) * flt(d.conversion_factor)
if pr_qty:
val_rate_db_precision = 6 if cint(self.precision("valuation_rate")) <= 6 else 9
val_rate_db_precision = 6 if cint(self.precision("valuation_rate", d)) <= 6 else 9
sl_entries.append(self.get_sl_entries(d, {
"actual_qty": flt(pr_qty),
"serial_no": cstr(d.serial_no).strip(),