[shopping cart] show items, editable qty and show amount for that item

This commit is contained in:
Anand Doshi
2013-06-19 17:19:20 +05:30
parent 3dceb8438e
commit c2a352711f
14 changed files with 232 additions and 61 deletions

View File

@@ -33,6 +33,25 @@ class DocType(DocListController):
if self.doc.buying_or_selling not in ["Buying", "Selling"]:
msgprint(_(self.meta.get_label("buying_or_selling")) + " " + _("must be one of") + " " +
comma_or(["Buying", "Selling"]), raise_exception=True)
self.validate_use_for_website()
def validate_use_for_website(self):
if self.doc.use_for_website:
if self.doc.valid_for_all_countries:
if webnotes.conn.sql("""select name from `tabPrice List` where use_for_website=1
and valid_for_all_countries=1 and name!=%s""", self.doc.name):
webnotes.msgprint(_("Error: Another Price List already exists that is used for website and is valid for all countries."),
raise_exception=True)
elif self.doclist.get({"parentfield": "valid_for_countries"}):
for d in self.doclist.get({"parentfield": "valid_for_countries"}):
if webnotes.conn.sql("""select country from `tabPrice List Country` plc, `tabPrice List` pl
where plc.parent=pl.name and pl.use_for_website=1 and
ifnull(valid_for_all_countries, 0)=0 and country=%s and pl.name!=%s""",
(d.country, self.doc.name)):
webnotes.msgprint(_("Error: Another Price List already exists that is used for website and is valid for country")
+ ": " + d.country, raise_exception=True)
def on_trash(self):
webnotes.conn.sql("""delete from `tabItem Price` where price_list_name = %s""",

View File

@@ -2,13 +2,13 @@
{
"creation": "2013-01-25 11:35:09",
"docstatus": 0,
"modified": "2013-06-14 16:07:25",
"modified": "2013-06-19 15:24:23",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"allow_attach": 0,
"allow_copy": 1,
"allow_copy": 0,
"allow_email": 1,
"allow_print": 1,
"autoname": "field:price_list_name",