[minor] [webshop] [fix]

This commit is contained in:
Anand Doshi
2013-07-15 18:28:14 +05:30
parent d4e76bc1db
commit cefccb921e
11 changed files with 102 additions and 48 deletions

View File

@@ -0,0 +1,7 @@
$.extend(cur_frm.cscript, {
onload: function() {
if(cur_frm.doc.__quotation_series) {
cur_frm.fields_dict.quotation_series.df.options = cur_frm.doc.__quotation_series;
}
}
});

View File

@@ -9,6 +9,9 @@ from webnotes.model.controller import DocListController
class ShoppingCartSetupError(webnotes.ValidationError): pass
class DocType(DocListController):
def onload(self):
self.doc.fields["__quotation_series"] = webnotes.get_doctype("Quotation").get_options("naming_series")
def validate(self):
if self.doc.enabled:
self.validate_price_lists()
@@ -17,6 +20,7 @@ class DocType(DocListController):
def on_update(self):
webnotes.conn.set_default("shopping_cart_enabled", self.doc.fields.get("enabled") or 0)
webnotes.conn.set_default("shopping_cart_quotation_series", self.doc.fields.get("quotation_series"))
def validate_overlapping_territories(self, parentfield, fieldname):
# for displaying message
@@ -91,16 +95,17 @@ class DocType(DocListController):
expected_to_exist = [currency + "-" + company_currency
for currency in price_list_currency_map.values()
if currency != company_currency]
exists = webnotes.conn.sql_list("""select name from `tabCurrency Exchange`
where name in (%s)""" % (", ".join(["%s"]*len(expected_to_exist)),),
tuple(expected_to_exist))
if expected_to_exist:
exists = webnotes.conn.sql_list("""select name from `tabCurrency Exchange`
where name in (%s)""" % (", ".join(["%s"]*len(expected_to_exist)),),
tuple(expected_to_exist))
missing = list(set(expected_to_exist).difference(exists))
missing = list(set(expected_to_exist).difference(exists))
if missing:
msgprint(_("Missing Currency Exchange Rates for" + ": " + comma_and(missing)),
raise_exception=ShoppingCartSetupError)
if missing:
msgprint(_("Missing Currency Exchange Rates for" + ": " + comma_and(missing)),
raise_exception=ShoppingCartSetupError)
def get_name_from_territory(self, territory, parentfield, fieldname):
name = None

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-06-19 15:57:32",
"docstatus": 0,
"modified": "2013-07-10 18:42:29",
"modified": "2013-07-15 17:33:05",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -78,6 +78,13 @@
"options": "Customer Group",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "quotation_series",
"fieldtype": "Select",
"label": "Quotation Series",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "section_break_6",