Merge branch 'responsive' of git://github.com/webnotes/erpnext into responsive

This commit is contained in:
Saurabh 2013-07-09 10:18:39 +05:30
commit ebe50397d9
49 changed files with 287 additions and 275 deletions

View File

@ -12,5 +12,6 @@ test_records = [
"income_account": "Sales - _TC",
"cost_center": "_Test Cost Center - _TC",
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"naming_series": "_T-Sales Invoice-"
}]
]

View File

@ -58,16 +58,7 @@ class DocType(BuyingController):
self.clear_unallocated_advances("Purchase Invoice Advance", "advance_allocation_details")
self.check_for_acc_head_of_supplier()
self.check_for_stopped_status()
self.po_list, self.pr_list = [], []
for d in getlist(self.doclist, 'entries'):
self.validate_supplier(d)
self.validate_po_pr(d)
if not d.purchase_order in self.po_list:
self.po_list.append(d.purchase_order)
if not d.purhcase_receipt in self.pr_list:
self.pr_list.append(d.purchase_receipt)
self.validate_with_previous_doc()
if not self.doc.is_opening:
self.doc.is_opening = 'No'
@ -156,10 +147,7 @@ class DocType(BuyingController):
if (self.doc.currency == default_currency and flt(self.doc.conversion_rate) != 1.00) or not self.doc.conversion_rate or (self.doc.currency != default_currency and flt(self.doc.conversion_rate) == 1.00):
msgprint("Message: Please Enter Appropriate Conversion Rate.")
raise Exception
# 1. Check whether bill is already booked against this bill no. or not
# 2. Add Remarks
# ---------------------------------------------------------------------
def validate_bill_no(self):
if self.doc.bill_no and self.doc.bill_no.lower().strip() not in ['na', 'not applicable', 'none']:
b_no = sql("select bill_no, name, ifnull(is_opening,'') from `tabPurchase Invoice` where bill_no = '%s' and credit_to = '%s' and docstatus = 1 and name != '%s' " % (self.doc.bill_no, self.doc.credit_to, self.doc.name))
@ -172,16 +160,10 @@ class DocType(BuyingController):
if not self.doc.remarks:
self.doc.remarks = "No Remarks"
# Validate Bill No Date
# ---------------------
def validate_bill_no_date(self):
if self.doc.bill_no and not self.doc.bill_date and self.doc.bill_no.lower().strip() not in ['na', 'not applicable', 'none']:
msgprint(_("Please enter Bill Date"), raise_exception=1)
# 1. Credit To Account Exists
# 2. Is a Credit Account
# 3. Is not a PL Account
# ----------------------------
def validate_credit_acc(self):
acc = sql("select debit_or_credit, is_pl_account from tabAccount where name = %s",
self.doc.credit_to)
@ -215,50 +197,30 @@ class DocType(BuyingController):
if stopped:
msgprint("One cannot do any transaction against 'Purchase Order' : %s, it's status is 'Stopped'" % (d.purhcase_order))
raise Exception
# Validate Supplier
# -----------------
def validate_supplier(self, d):
supplier = ''
if d.purchase_order and not d.purchase_order in self.po_list:
supplier = sql("select supplier from `tabPurchase Order` where name = '%s'" % d.purchase_order)[0][0]
if supplier and not cstr(self.doc.supplier) == cstr(supplier):
msgprint("Supplier name %s do not match with supplier name of purhase order: %s." %(self.doc.supplier,cstr(d.purchase_order)))
raise Exception , " Validation Error "
if d.purchase_receipt and not d.purchase_receipt in self.pr_list:
supplier = sql("select supplier from `tabPurchase Receipt` where name = '%s'" % d.purchase_receipt)[0][0]
if supplier and not cstr(self.doc.supplier) == cstr(supplier):
msgprint("Supplier name %s do not match with supplier name of %s %s." %(self.doc.supplier,cstr(d.purchase_receipt)))
raise Exception , " Validation Error "
def validate_reference_value(self):
pass
# Validate PO and PR
# -------------------
def validate_po_pr(self, d):
# check po / pr for qty and rates and currency and conversion rate
# currency, import_rate must be equal to currency, import_rate of purchase order
if d.purchase_order and not d.purchase_order in self.po_list:
# currency
currency = cstr(sql("select currency from `tabPurchase Order` where name = '%s'" % d.purchase_order)[0][0])
if not cstr(currency) == cstr(self.doc.currency):
msgprint("Purchase Order: " + cstr(d.purchase_order) + " currency : " + cstr(currency) + " does not match with currency of current document.")
raise Exception
# import_rate
rate = flt(sql('select import_rate from `tabPurchase Order Item` where item_code=%s and parent=%s and name = %s', (d.item_code, d.purchase_order, d.po_detail))[0][0])
if abs(rate - flt(d.import_rate)) > 1 and cint(webnotes.defaults.get_global_default('maintain_same_rate')):
msgprint("Import Rate for %s in the Purchase Order is %s. Rate must be same as Purchase Order Rate" % (d.item_code,rate))
raise Exception
if d.purchase_receipt and not d.purchase_receipt in self.pr_list:
# currency , conversion_rate
data = sql("select currency, conversion_rate from `tabPurchase Receipt` where name = '%s'" % d.purchase_receipt, as_dict = 1)
if not cstr(data[0]['currency']) == cstr(self.doc.currency):
msgprint("Purchase Receipt: " + cstr(d.purchase_receipt) + " currency : " + cstr(data[0]['currency']) + " does not match with currency of current document.")
raise Exception
def validate_with_previous_doc(self):
super(DocType, self).validate_with_previous_doc(self.tname, {
"Purchase Order": {
"ref_dn_field": "purchase_order",
"compare_fields": [["supplier", "="], ["company", "="], ["currency", "="]],
},
"Purchase Order Item": {
"ref_dn_field": "po_detail",
"compare_fields": [["export_rate", "="], ["project_name", "="], ["item_code", "="],
["uom", "="]],
"is_child_table": True
},
"Purchase Receipt": {
"ref_dn_field": "purchase_receipt",
"compare_fields": [["customer", "="], ["company", "="], ["currency", "="]],
},
"Purchase Receipt Item": {
"ref_dn_field": "pr_detail",
"compare_fields": [["export_rate", "="], ["project_name", "="], ["item_code", "="],
["uom", "="]],
"is_child_table": True
}
})
def set_aging_date(self):
if self.doc.is_opening != 'Yes':

View File

@ -366,6 +366,7 @@ test_records = [
# parent
{
"doctype": "Purchase Invoice",
"naming_series": "_T-Purchase Invoice-",
"supplier_name": "_Test Supplier",
"credit_to": "_Test Supplier - _TC",
"bill_no": "NA",

View File

@ -59,6 +59,7 @@ class DocType(SellingController):
self.validate_posting_time()
self.so_dn_required()
self.validate_proj_cust()
self.validate_with_previous_doc()
sales_com_obj = get_obj('Sales Common')
sales_com_obj.check_stop_sales_order(self)
sales_com_obj.check_active_sales_items(self)
@ -66,7 +67,6 @@ class DocType(SellingController):
sales_com_obj.validate_max_discount(self, 'entries')
sales_com_obj.validate_fiscal_year(self.doc.fiscal_year,
self.doc.posting_date,'Posting Date')
self.validate_customer()
self.validate_customer_account()
self.validate_debit_acc()
self.validate_fixed_asset_account()
@ -91,11 +91,9 @@ class DocType(SellingController):
self.set_aging_date()
self.set_against_income_account()
self.validate_c_form()
self.validate_rate_with_refdoc()
self.validate_time_logs_are_submitted()
self.validate_recurring_invoice()
def on_submit(self):
if cint(self.doc.update_stock) == 1:
sl_obj = get_obj("Stock Ledger")
@ -361,19 +359,6 @@ class DocType(SellingController):
(not acc_head and (self.doc.debit_to != cstr(self.doc.customer) + " - " + self.get_company_abbr())):
msgprint("Debit To: %s do not match with Customer: %s for Company: %s.\n If both correctly entered, please select Master Type \
and Master Name in account master." %(self.doc.debit_to, self.doc.customer,self.doc.company), raise_exception=1)
def validate_customer(self):
""" Validate customer name with SO and DN"""
if self.doc.customer:
for d in getlist(self.doclist,'entries'):
dt = d.delivery_note and 'Delivery Note' or d.sales_order and 'Sales Order' or ''
if dt:
dt_no = d.delivery_note or d.sales_order
cust = webnotes.conn.get_value(dt, dt_no, "customer")
if cust and cstr(cust) != cstr(self.doc.customer):
msgprint("Customer %s does not match with customer of %s: %s."
%(self.doc.customer, dt, dt_no), raise_exception=1)
def validate_debit_acc(self):
@ -400,6 +385,31 @@ class DocType(SellingController):
elif item and item[0][1] == 'Yes' and not acc[0][0] == 'Fixed Asset Account':
msgprint("Please select income head with account type 'Fixed Asset Account' as Item %s is an asset item" % d.item_code)
raise Exception
def validate_with_previous_doc(self):
super(DocType, self).validate_with_previous_doc(self.tname, {
"Sales Order": {
"ref_dn_field": "sales_order",
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
["currency", "="]],
},
"Sales Order Item": {
"ref_dn_field": "so_detail",
"compare_fields": [["export_rate", "="]],
"is_child_table": True
},
"Delivery Note": {
"ref_dn_field": "delivery_note",
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
["currency", "="]],
},
"Delivery Note Item": {
"ref_dn_field": "dn_detail",
"compare_fields": [["export_rate", "="]],
"is_child_table": True
}
})
def set_aging_date(self):
if self.doc.is_opening != 'Yes':
@ -475,22 +485,6 @@ class DocType(SellingController):
webnotes.conn.set(self.doc, 'c_form_no', '')
def validate_rate_with_refdoc(self):
"""Validate values with reference document with previous document"""
for d in self.doclist.get({"parentfield": "entries"}):
if d.so_detail:
self.check_value("Sales Order", d.sales_order, d.so_detail,
d.export_rate, d.item_code)
if d.dn_detail:
self.check_value("Delivery Note", d.delivery_note, d.dn_detail,
d.export_rate, d.item_code)
def check_value(self, ref_dt, ref_dn, ref_item_dn, val, item_code):
ref_val = webnotes.conn.get_value(ref_dt + " Item", ref_item_dn, "export_rate")
if flt(ref_val, 2) != flt(val, 2):
msgprint(_("Rate is not matching with ") + ref_dt + ": " + ref_dn +
_(" for item: ") + item_code, raise_exception=True)
def update_current_stock(self):
for d in getlist(self.doclist, 'entries'):
if d.item_code and d.warehouse:

View File

@ -423,6 +423,7 @@ class TestSalesInvoice(unittest.TestCase):
from stock.doctype.purchase_receipt.test_purchase_receipt import test_records \
as pr_test_records
pr = webnotes.bean(copy=pr_test_records[0])
pr.doc.naming_series = "_T-Purchase Receipt-"
pr.run_method("calculate_taxes_and_totals")
pr.insert()
pr.submit()
@ -431,6 +432,7 @@ class TestSalesInvoice(unittest.TestCase):
from stock.doctype.delivery_note.test_delivery_note import test_records \
as dn_test_records
dn = webnotes.bean(copy=dn_test_records[0])
dn.doc.naming_series = "_T-Delivery Note-"
dn.insert()
dn.submit()
return dn

View File

@ -32,6 +32,7 @@ test_records = [
[
{
"doctype": "Shipping Rule",
"label": "_Test Shipping Rule",
"calculate_based_on": "Net Total",
"company": "_Test Company",
"account": "_Test Account Shipping Charges - _TC",

View File

@ -204,16 +204,6 @@ wn.module_page["Accounts"] = [
route: "query-report/Bank Reconciliation Statement",
doctype: "Journal Voucher"
},
{
"label":wn._("Delivered Items To Be Billed"),
route: "query-report/Delivered Items To Be Billed",
doctype: "Sales Invoice"
},
{
"label":wn._("Received Items To Be Billed"),
route: "query-report/Received Items To Be Billed",
doctype: "Purchase Invoice"
},
{
"label":wn._("Ordered Items To Be Billed"),
route: "query-report/Ordered Items To Be Billed",

View File

@ -1,22 +0,0 @@
[
{
"creation": "2013-05-02 15:20:25",
"docstatus": 0,
"modified": "2013-07-08 11:08:23",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
"query": "select \n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n`tabDelivery Note`.`status` as \"Status\",\n `tabDelivery Note`.`posting_date` as \"Date:Date\",\n `tabDelivery Note`.`project_name` as \"Project\",\n `tabDelivery Note Item`.item_code as \"Item:Link/Item:120\",\n `tabDelivery Note Item`.amount as \"Amount:Currency:110\",\n (`tabDelivery Note Item`.billed_amt * ifnull(`tabDelivery Note`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabDelivery Note Item`.amount,0) - (ifnull(`tabDelivery Note Item`.billed_amt,0) * ifnull(`tabDelivery Note`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabDelivery Note Item`.item_name as \"Item Name::150\",\n `tabDelivery Note Item`.description as \"Description:Data:200\",\n `tabDelivery Note Item`.prevdoc_docname as \"Sales Order:Link/Sales Order:120\",\n `tabDelivery Note Item`.prevdoc_date as \"SO Date:Date:100\",\n `tabDelivery Note`.address_display as \"Customer Address::150\"\nfrom\n `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note Item`.`parent` = `tabDelivery Note`.`name`\n and `tabDelivery Note`.docstatus = 1\n and `tabDelivery Note`.status != \"Stopped\"\n and ifnull(`tabDelivery Note Item`.billed_amt,0) < ifnull(`tabDelivery Note Item`.export_amount,0)\norder by `tabDelivery Note`.posting_date asc",
"ref_doctype": "Sales Invoice",
"report_name": "Delivered Items To Be Billed",
"report_type": "Query Report"
},
{
"doctype": "Report",
"name": "Delivered Items To Be Billed"
}
]

View File

@ -1,23 +0,0 @@
[
{
"creation": "2013-05-28 15:57:59",
"docstatus": 0,
"modified": "2013-06-05 12:59:17",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
"query": "select \n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`posting_date` as \"Date:Date:100\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n `tabPurchase Receipt Item`.`project_name` as \"Project\",\n\t`tabPurchase Receipt Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Receipt Item`.amount as \"Amount:Currency:100\",\n\t`tabPurchase Receipt Item`.billed_amt as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Receipt Item`.amount - ifnull(`tabPurchase Receipt Item`.billed_amt, 0)) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Receipt Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.description as \"Description::200\"\nfrom\n\t`tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n\t`tabPurchase Receipt Item`.`parent` = `tabPurchase Receipt`.`name`\n\tand `tabPurchase Receipt`.docstatus = 1\n\tand `tabPurchase Receipt`.status != \"Stopped\"\n\tand ifnull(`tabPurchase Receipt Item`.billed_amt, 0) < ifnull(`tabPurchase Receipt Item`.amount, 0)\norder by `tabPurchase Receipt`.posting_date asc",
"ref_doctype": "Purchase Invoice",
"report_name": "Received Items To Be Billed",
"report_type": "Query Report"
},
{
"doctype": "Report",
"name": "Received Items To Be Billed"
}
]

View File

@ -17,8 +17,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import add_days, cint, cstr, flt
from webnotes.model.doc import addchild
from webnotes.utils import add_days, cstr, flt
from webnotes.model.bean import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint, _
@ -184,29 +183,6 @@ class DocType(BuyingController):
if item[0][1] != 'Yes' and item[0][2] != 'Yes':
msgprint("Item %s is not a purchase item or sub-contracted item. Please check" % (d.item_code), raise_exception=True)
if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname:
# check warehouse, uom in previous doc and in current doc are same.
data = sql("select item_code, warehouse, uom from `tab%s` where name = '%s'" % ( self.doctype_dict[d.prevdoc_doctype], d.prevdoc_detail_docname), as_dict = 1)
if not data:
msgprint("Please fetch data in Row " + cstr(d.idx) + " once again or please contact Administrator.")
raise Exception
# Check if Item Code has been modified.
if not cstr(data[0]['item_code']) == cstr(d.item_code):
msgprint("Please check Item %s is not present in %s %s ." % (d.item_code, d.prevdoc_doctype, d.prevdoc_docname))
raise Exception
if cstr(data[0]['warehouse']) and \
not cstr(data[0]['warehouse']) == cstr(d.warehouse):
msgprint("""Please check warehouse %s of Item %s
which is not present in %s %s""" % (d.warehouse, d.item_code,
d.prevdoc_doctype, d.prevdoc_docname), raise_exception=1)
# Check if UOM has been modified.
if not cstr(data[0]['uom']) == cstr(d.uom) and not cstr(d.prevdoc_doctype) == 'Material Request':
msgprint("Please check UOM %s of Item %s which is not present in %s %s ." % \
(d.uom, d.item_code, d.prevdoc_doctype, d.prevdoc_docname), raise_exception=True)
# list criteria that should not repeat if item is stock item
e = [d.schedule_date, d.item_code, d.description, d.warehouse, d.uom, d.fields.has_key('prevdoc_docname') and d.prevdoc_docname or '', d.fields.has_key('prevdoc_detail_docname') and d.prevdoc_detail_docname or '', d.fields.has_key('batch_no') and d.batch_no or '']
@ -215,7 +191,7 @@ class DocType(BuyingController):
ch = sql("select is_stock_item from `tabItem` where name = '%s'"%d.item_code)
if ch and ch[0][0] == 'Yes':
if ch and ch[0][0] == 'Yes':
# check for same items
if e in check_list:
msgprint("""Item %s has been entered more than once with same description, schedule date, warehouse and uom.\n
@ -239,8 +215,6 @@ class DocType(BuyingController):
msgprint("One cannot do any transaction against %s : %s, it's status is 'Stopped'" %
( doctype, docname), raise_exception=1)
def validate_reference_value(self, obj=None):
pass
# Check Docstatus of Next DocType on Cancel AND of Previous DocType on Submit
def check_docstatus(self, check, doctype, docname , detail_doctype = ''):

View File

@ -47,15 +47,28 @@ class DocType(BuyingController):
pc_obj = get_obj(dt='Purchase Common')
pc_obj.validate_for_items(self)
pc_obj.get_prevdoc_date(self)
self.validate_doc(pc_obj)
self.check_for_stopped_status(pc_obj)
self.validate_with_previous_doc()
self.validate_for_subcontracting()
self.update_raw_materials_supplied("po_raw_material_details")
def validate_fiscal_year(self):
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'PO Date')
def validate_with_previous_doc(self):
super(DocType, self).validate_with_previous_doc(self.tname, {
"Supplier Quotation": {
"ref_dn_field": "supplier_quotation",
"compare_fields": [["supplier", "="], ["company", "="], ["currency", "="]],
},
"Supplier Quotation Item": {
"ref_dn_field": "supplier_quotation_item",
"compare_fields": [["export_rate", "="], ["project_name", "="], ["item_code", "="],
["uom", "="]],
"is_child_table": True
}
})
# get available qty at warehouse
def get_bin_details(self, arg = ''):
@ -69,10 +82,6 @@ class DocType(BuyingController):
def get_last_purchase_rate(self):
get_obj('Purchase Common').get_last_purchase_rate(self)
def validate_doc(self,pc_obj):
# Validate values with reference document
pc_obj.validate_reference_value(obj = self)
# Check for Stopped status
def check_for_stopped_status(self, pc_obj):

View File

@ -37,6 +37,7 @@ class TestPurchaseOrder(unittest.TestCase):
self.assertEquals(pr[0]["doctype"], "Purchase Receipt")
self.assertEquals(len(pr), len(test_records[0]))
pr[0].naming_series = "_T-Purchase Receipt-"
webnotes.bean(pr).insert()
def test_make_purchase_invocie(self):
@ -54,6 +55,7 @@ class TestPurchaseOrder(unittest.TestCase):
self.assertEquals(pi[0]["doctype"], "Purchase Invoice")
self.assertEquals(len(pi), len(test_records[0]))
pi[0].bill_no = "NA"
webnotes.bean(pi).insert()
def test_subcontracting(self):
@ -75,6 +77,7 @@ test_records = [
[
{
"company": "_Test Company",
"naming_series": "_T-Purchase Order-",
"conversion_rate": 1.0,
"currency": "INR",
"doctype": "Purchase Order",
@ -86,7 +89,6 @@ test_records = [
"net_total": 5000.0,
"grand_total": 5000.0,
"grand_total_import": 5000.0,
},
{
"conversion_factor": 1.0,
@ -101,6 +103,7 @@ test_records = [
"warehouse": "_Test Warehouse",
"stock_uom": "Nos",
"uom": "_Test UOM",
"schedule_date": "2013-03-01"
}
],
]

View File

@ -36,6 +36,7 @@ class DocType(BuyingController):
self.validate_fiscal_year()
self.validate_common()
self.validate_with_previous_doc()
def on_submit(self):
purchase_controller = webnotes.get_obj("Purchase Common")
@ -53,11 +54,24 @@ class DocType(BuyingController):
get_obj(dt = 'Purchase Common').validate_fiscal_year( \
self.doc.fiscal_year, self.doc.transaction_date, 'Quotation Date')
def validate_with_previous_doc(self):
super(DocType, self).validate_with_previous_doc(self.tname, {
"Material Request": {
"ref_dn_field": "prevdoc_docname",
"compare_fields": [["company", "="]],
},
"Material Request Item": {
"ref_dn_field": "prevdoc_detail_docname",
"compare_fields": [["item_code", "="], ["uom", "="]],
"is_child_table": True
}
})
def validate_common(self):
pc = get_obj('Purchase Common')
pc.validate_for_items(self)
pc.get_prevdoc_date(self)
pc.validate_reference_value(self)
@webnotes.whitelist()
def make_purchase_order(source_name, target_doclist=None):

View File

@ -36,6 +36,12 @@ class TestPurchaseOrder(unittest.TestCase):
self.assertEquals(po[0]["doctype"], "Purchase Order")
self.assertEquals(len(po), len(sq.doclist))
po[0]["naming_series"] = "_T-Purchase Order-"
for doc in po:
if doc.get("item_code"):
doc["schedule_date"] = "2013-04-12"
webnotes.bean(po).insert()
test_records = [
@ -53,7 +59,7 @@ test_records = [
"net_total": 5000.0,
"grand_total": 5000.0,
"grand_total_import": 5000.0,
"naming_series": "_T-Supplier Quotation-"
},
{
"description": "_Test FG Item",

View File

@ -358,6 +358,7 @@ class AccountsController(TransactionBase):
def get_company_default(self, fieldname):
from accounts.utils import get_company_default
return get_company_default(self.doc.company, fieldname)
@property
def stock_items(self):

View File

@ -55,7 +55,7 @@ class SellingController(StockController):
def set_price_list_and_item_details(self):
self.set_price_list_currency("Selling")
self.set_missing_item_details(get_item_details)
def get_other_charges(self):
self.doclist = self.doc.clear_table(self.doclist, "other_charges")
self.set_taxes("other_charges", "charge")

View File

@ -2,7 +2,7 @@
{
"creation": "2013-01-22 15:11:38",
"docstatus": 0,
"modified": "2013-07-05 14:27:38",
"modified": "2013-07-08 16:18:33",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -247,7 +247,6 @@
"print_hide": 0
},
{
"default": "No Toolbar",
"doctype": "DocField",
"fieldname": "flat_bom_details",
"fieldtype": "Table",

View File

@ -19,7 +19,7 @@ patch_list = [
"execute:webnotes.reload_doc('core', 'doctype', 'docfield')",
"execute:webnotes.reload_doc('core', 'doctype', 'docperm') # 2013-04-07",
"execute:webnotes.reload_doc('core', 'doctype', 'report')",
"execute:webnotes.reload_doc('core', 'doctype', 'doctype') # 2013-07-04",
"execute:webnotes.reload_doc('core', 'doctype', 'doctype') # 2013-07-08",
"patches.mar_2012.clean_property_setter",
"patches.april_2012.naming_series_patch",
"patches.mar_2012.cleanup_control_panel",
@ -246,4 +246,6 @@ patch_list = [
"patches.june_2013.p09_update_global_defaults",
"patches.june_2013.p10_lead_address",
"patches.july_2013.p01_remove_doctype_mappers",
"execute:webnotes.delete_doc('Report', 'Delivered Items To Be Billed')",
"execute:webnotes.delete_doc('Report', 'Received Items To Be Billed')",
]

View File

@ -52,7 +52,6 @@ class DocType(TransactionBase):
sales_com_obj = get_obj(dt = 'Sales Common')
sales_com_obj.check_active_sales_items(self)
sales_com_obj.get_prevdoc_date(self)
self.validate_reference_value()
def validate_prev_docname(self):
for d in getlist(self.doclist, 'installed_item_details'):
@ -63,9 +62,6 @@ class DocType(TransactionBase):
def validate_fiscal_year(self):
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year, self.doc.inst_date,
'Installation Date')
def validate_reference_value(self):
pass
def is_serial_no_added(self, item_code, serial_no):
ar_required = webnotes.conn.get_value("Item", item_code, "has_serial_no")

View File

@ -100,7 +100,17 @@ class DocType(SellingController):
@webnotes.whitelist()
def make_customer(source_name, target_doclist=None):
from webnotes.model.mapper import get_mapped_doclist
def set_missing_values(source, target):
if source.doc.company_name:
target[0].customer_type = "Company"
target[0].customer_name = source.doc.company_name
else:
target[0].customer_type = "Individual"
target[0].customer_name = source.doc.lead_name
target[0].customer_group = webnotes.conn.get_default("customer_group")
doclist = get_mapped_doclist("Lead", source_name,
{"Lead": {
"doctype": "Customer",
@ -110,7 +120,7 @@ def make_customer(source_name, target_doclist=None):
"contact_no": "phone_1",
"fax": "fax_1"
}
}}, target_doclist)
}}, target_doclist, set_missing_values)
return [d.fields for d in doclist]

View File

@ -2,7 +2,7 @@ from __future__ import unicode_literals
test_records = [
[{"doctype":"Lead", "lead_name": "_Test Lead", "status":"Open",
"email_id":"test_lead@example.com"}],
"email_id":"test_lead@example.com", "territory": "_Test Territory"}],
[{"doctype":"Lead", "lead_name": "_Test Lead 1", "status":"Open",
"email_id":"test_lead1@example.com"}],
[{"doctype":"Lead", "lead_name": "_Test Lead 2", "status":"Contacted",
@ -21,6 +21,7 @@ class TestLead(unittest.TestCase):
customer = make_customer("_T-Lead-00001")
self.assertEquals(customer[0]["doctype"], "Customer")
self.assertEquals(customer[0]["lead_name"], "_T-Lead-00001")
customer[0].customer_group = "_Test Customer Group"
webnotes.bean(customer).insert()

View File

@ -22,9 +22,7 @@ class TestQuotation(unittest.TestCase):
self.assertEquals(sales_order[0]["customer"], "_Test Customer")
sales_order[0]["delivery_date"] = "2014-01-01"
webnotes.print_messages = True
sales_order[0]["naming_series"] = "_T-Quotation-"
webnotes.bean(sales_order).insert()
@ -34,6 +32,7 @@ test_records = [
"company": "_Test Company",
"conversion_rate": 1.0,
"currency": "INR",
"quotation_to": "Customer",
"customer": "_Test Customer",
"customer_name": "_Test Customer",
"customer_group": "_Test Customer Group",

View File

@ -292,7 +292,7 @@ class DocType(TransactionBase):
return obj.doclist
# delete from doclist
obj.doclist = filter(lambda d: d.name not in delete_list, obj.doclist)
obj.doclist = webnotes.doclist(filter(lambda d: d.name not in delete_list, obj.doclist))
# delete from db
webnotes.conn.sql("""\

View File

@ -173,6 +173,8 @@ class DocType(SellingController):
sales_com_obj.validate_max_discount(self,'sales_order_details')
self.doclist = sales_com_obj.make_packing_list(self,'sales_order_details')
self.validate_with_previous_doc()
if not self.doc.status:
self.doc.status = "Draft"
@ -183,6 +185,15 @@ class DocType(SellingController):
if not self.doc.billing_status: self.doc.billing_status = 'Not Billed'
if not self.doc.delivery_status: self.doc.delivery_status = 'Not Delivered'
def validate_with_previous_doc(self):
super(DocType, self).validate_with_previous_doc(self.tname, {
"Quotation": {
"ref_dn_field": "prevdoc_docname",
"compare_fields": [["customer", "="], ["company", "="], ["currency", "="]]
}
})
def check_prev_docstatus(self):
for d in getlist(self.doclist, 'sales_order_details'):
cancel_quo = sql("select name from `tabQuotation` where docstatus = 2 and name = '%s'" % d.prevdoc_docname)

View File

@ -59,11 +59,12 @@ class TestSalesOrder(unittest.TestCase):
def create_so(self, so_doclist = None):
if not so_doclist:
so_doclist =test_records[0]
so_doclist = test_records[0]
w = webnotes.bean(copy=so_doclist)
w.insert()
w.submit()
return w
def create_dn_against_so(self, so, delivered_qty=0):
@ -290,6 +291,7 @@ test_records = [
"transaction_date": "2013-02-21",
"grand_total": 1000.0,
"grand_total_export": 1000.0,
"naming_series": "_T-Sales Order-"
},
{
"description": "CPU",

View File

@ -230,6 +230,10 @@ class DocType:
cc.update({"doctype": "Cost Center"})
cc_bean = webnotes.bean(cc)
cc_bean.ignore_permissions = True
if cc.get("cost_center_name") == self.doc.name:
cc_bean.ignore_mandatory = True
cc_bean.insert()
webnotes.conn.set(self.doc, "cost_center", "Main - " + self.doc.abbr)

View File

@ -3,7 +3,7 @@ test_records = [
"doctype": "Currency Exchange",
"from_currency": "USD",
"to_currency": "INR",
"exchange_rate": 1
"exchange_rate": 60.0
}],
[{
"doctype": "Currency Exchange",

View File

@ -169,7 +169,14 @@ def import_defaults():
{'uom_name': 'Minute', 'doctype': 'UOM', 'name': 'Minute'},
]
from webnotes.modules import scrub
for r in records:
if not webnotes.conn.exists(r['doctype'], r['name']):
bean = webnotes.bean(r)
# ignore mandatory for root
parent_link_field = ("parent_" + scrub(bean.doc.doctype))
if parent_link_field in bean.doc.fields and not bean.doc.fields.get(parent_link_field):
bean.ignore_mandatory = True
bean.insert()

View File

@ -118,11 +118,26 @@ class DocType(SellingController):
# Set actual qty for each item in selected warehouse
self.update_current_stock()
self.validate_with_previous_doc()
self.doc.status = 'Draft'
if not self.doc.billing_status: self.doc.billing_status = 'Not Billed'
if not self.doc.installation_status: self.doc.installation_status = 'Not Installed'
if not self.doc.installation_status: self.doc.installation_status = 'Not Installed'
def validate_with_previous_doc(self):
super(DocType, self).validate_with_previous_doc(self.tname, {
"Sales Order": {
"ref_dn_field": "prevdoc_docname",
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
["currency", "="]],
},
"Sales Order Item": {
"ref_dn_field": "prevdoc_detail_docname",
"compare_fields": [["export_rate", "="]],
"is_child_table": True
}
})
def validate_proj_cust(self):
"""check for does customer belong to same project as entered.."""

View File

@ -102,7 +102,7 @@
"fieldname": "customer_address",
"fieldtype": "Link",
"in_filter": 1,
"label": "Select Shipping Address",
"label": "Billing Address Name",
"options": "Address",
"print_hide": 1,
"read_only": 1
@ -112,6 +112,22 @@
"fieldname": "address_display",
"fieldtype": "Small Text",
"hidden": 1,
"label": "Billing Address",
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "shipping_address_name",
"fieldtype": "Link",
"label": "Shipping Address Name",
"options": "Address",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "shipping_address",
"fieldtype": "Small Text",
"hidden": 1,
"label": "Shipping Address",
"read_only": 1
},

View File

@ -109,6 +109,7 @@ test_records = [
"net_total": 500.0,
"grand_total": 500.0,
"grand_total_export": 500.0,
"naming_series": "_T-Delivery Note-"
},
{
"description": "CPU",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-03 10:45:46",
"docstatus": 0,
"modified": "2013-07-05 16:24:34",
"modified": "2013-07-08 14:05:47",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -202,7 +202,7 @@
"label": "Is Stock Item",
"oldfieldname": "is_stock_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "Yes\nNo",
"read_only": 0,
"reqd": 1
},
@ -270,7 +270,7 @@
"label": "Is Asset Item",
"oldfieldname": "is_asset_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "Yes\nNo",
"read_only": 0,
"reqd": 1
},
@ -283,7 +283,7 @@
"label": "Has Batch No",
"oldfieldname": "has_batch_no",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "Yes\nNo",
"read_only": 0,
"reqd": 1
},
@ -298,7 +298,7 @@
"label": "Has Serial No",
"oldfieldname": "has_serial_no",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "Yes\nNo",
"read_only": 0,
"reqd": 1
},
@ -399,7 +399,7 @@
"label": "Is Purchase Item",
"oldfieldname": "is_purchase_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "Yes\nNo",
"read_only": 0,
"reqd": 1
},
@ -525,7 +525,7 @@
"label": "Is Sales Item",
"oldfieldname": "is_sales_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "Yes\nNo",
"read_only": 0,
"reqd": 1
},
@ -540,7 +540,7 @@
"label": "Is Service Item",
"oldfieldname": "is_service_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "Yes\nNo",
"read_only": 0,
"reqd": 1
},
@ -554,7 +554,7 @@
"label": "Allow Samples",
"oldfieldname": "is_sample_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "Yes\nNo",
"read_only": 0,
"reqd": 1
},
@ -706,7 +706,7 @@
"label": "Allow Bill of Materials",
"oldfieldname": "is_manufactured_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "Yes\nNo",
"read_only": 0,
"reqd": 1
},
@ -732,7 +732,7 @@
"label": "Allow Production Order",
"oldfieldname": "is_pro_applicable",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "Yes\nNo",
"read_only": 0,
"reqd": 1
},
@ -745,7 +745,7 @@
"label": "Is Sub Contracted Item",
"oldfieldname": "is_sub_contracted_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"options": "Yes\nNo",
"read_only": 0,
"reqd": 1
},

View File

@ -69,7 +69,8 @@ test_records = [
"parentfield": "item_reorder",
"warehouse": "_Test Warehouse",
"warehouse_reorder_level": 20,
"warehouse_reorder_qty": 20
"warehouse_reorder_qty": 20,
"material_request_type": "Purchase"
}, {
"doctype": "Item Price",
"parentfield": "ref_rate_details",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-03-07 14:48:38",
"docstatus": 0,
"modified": "2013-07-08 15:40:01",
"modified": "2013-07-08 16:18:00",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -99,7 +99,7 @@
"options": "Material Request Item"
},
{
"default": "Give additional details about the indent.",
"description": "Give additional details about the indent.",
"doctype": "DocField",
"fieldname": "more_info",
"fieldtype": "Section Break",

View File

@ -321,7 +321,8 @@ test_records = [
"doctype": "Material Request",
"fiscal_year": "_Test Fiscal Year 2013",
"transaction_date": "2013-02-18",
"material_request_type": "Purchase"
"material_request_type": "Purchase",
"naming_series": "_T-Material Request-"
},
{
"description": "_Test Item Home Desktop 100",

View File

@ -94,6 +94,20 @@ class DocType(BuyingController):
if exists:
webnotes.msgprint("Another Purchase Receipt using the same Challan No. already exists.\
Please enter a valid Challan No.", raise_exception=1)
def validate_with_previous_doc(self):
super(DocType, self).validate_with_previous_doc(self.tname, {
"Purchase Order": {
"ref_dn_field": "prevdoc_docname",
"compare_fields": [["supplier", "="], ["company", "="], ["currency", "="]],
},
"Purchase Order Item": {
"ref_dn_field": "prevdoc_detail_docname",
"compare_fields": [["export_rate", "="], ["project_name", "="], ["warehouse", "="],
["uom", "="], ["item_code", "="]],
"is_child_table": True
}
})
def po_required(self):
if webnotes.conn.get_single_value("Buying Settings", "po_required") == 'Yes':
@ -114,6 +128,7 @@ class DocType(BuyingController):
import utilities
utilities.validate_status(self.doc.status, ["Draft", "Submitted", "Cancelled"])
self.validate_with_previous_doc()
self.validate_accepted_rejected_qty()
self.validate_inspection() # Validate Inspection
get_obj('Stock Ledger').validate_serial_no(self, 'purchase_receipt_details')
@ -122,7 +137,6 @@ class DocType(BuyingController):
pc_obj = get_obj(dt='Purchase Common')
pc_obj.validate_for_items(self)
pc_obj.get_prevdoc_date(self)
pc_obj.validate_reference_value(self)
self.check_for_stopped_status(pc_obj)
# sub-contracting

View File

@ -102,6 +102,7 @@ test_records = [
"supplier": "_Test Supplier",
"net_total": 500.0,
"grand_total": 720.0,
"naming_series": "_T-Purchase Receipt-",
},
{
"conversion_factor": 1.0,

View File

@ -278,7 +278,9 @@ class TestStockEntry(unittest.TestCase):
self._insert_material_receipt()
from stock.doctype.delivery_note.test_delivery_note \
import test_records as delivery_note_test_records, make_sales_invoice
import test_records as delivery_note_test_records
from stock.doctype.delivery_note.delivery_note import make_sales_invoice
actual_qty_0 = self._get_actual_qty()
@ -361,9 +363,8 @@ class TestStockEntry(unittest.TestCase):
def _test_delivery_note_return_against_sales_order(self, item_code, delivered_qty, returned_qty):
self._insert_material_receipt()
from selling.doctype.sales_order.test_sales_order \
import test_records as sales_order_test_records,
make_sales_invoice, make_delivery_note
from selling.doctype.sales_order.test_sales_order import test_records as sales_order_test_records
from selling.doctype.sales_order.sales_order import make_sales_invoice, make_delivery_note
actual_qty_0 = self._get_actual_qty()
@ -418,8 +419,9 @@ class TestStockEntry(unittest.TestCase):
actual_qty_0 = self._get_actual_qty()
from stock.doctype.purchase_receipt.test_purchase_receipt \
import test_records as purchase_receipt_test_records,
make_purchase_invoice
import test_records as purchase_receipt_test_records
from stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
# submit purchase receipt
pr = webnotes.bean(copy=purchase_receipt_test_records[0])
@ -443,6 +445,7 @@ class TestStockEntry(unittest.TestCase):
d.cost_center = "_Test Cost Center - _TC"
pi.run_method("calculate_taxes_and_totals")
pi.doc.bill_no = "NA"
pi.insert()
pi.submit()
@ -506,7 +509,9 @@ class TestStockEntry(unittest.TestCase):
actual_qty_0 = self._get_actual_qty()
from buying.doctype.purchase_order.test_purchase_order \
import test_records as purchase_order_test_records,
import test_records as purchase_order_test_records
from buying.doctype.purchase_order.purchase_order import \
make_purchase_receipt, make_purchase_invoice
# submit purchase receipt
@ -540,6 +545,7 @@ class TestStockEntry(unittest.TestCase):
d.cost_center = "_Test Cost Center - _TC"
pi.run_method("calculate_taxes_and_totals")
pi.doc.bill_no = "NA"
pi.insert()
pi.submit()

View File

@ -9,6 +9,7 @@ test_records = [
"doctype": "Warehouse",
"warehouse_name": "_Test Warehouse 1",
"warehouse_type": "_Test Warehouse Type",
"company": "_Test Company"
}],
[{
"doctype": "Warehouse",

View File

@ -20,7 +20,6 @@ import webnotes
from webnotes.utils import add_days, cstr, getdate
from webnotes.model.doc import addchild
from webnotes.model.bean import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint
sql = webnotes.conn.sql
@ -191,11 +190,7 @@ class DocType(TransactionBase):
msgprint("Maintenance Schedule against "+d.prevdoc_docname+" already exist")
raise Exception
# Validate values with reference document
#----------------------------------------
def validate_reference_value(self):
pass
def validate_serial_no(self):
for d in getlist(self.doclist, 'item_maintenance_detail'):
cur_s_no=[]
@ -219,8 +214,6 @@ class DocType(TransactionBase):
def validate(self):
self.validate_maintenance_detail()
self.validate_sales_order()
if self.doc.sales_order_no:
self.validate_reference_value()
self.validate_serial_no()
self.validate_start_date()

View File

@ -19,7 +19,6 @@ import webnotes
from webnotes.utils import cstr
from webnotes.model.bean import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint
sql = webnotes.conn.sql
@ -38,13 +37,7 @@ class DocType(TransactionBase):
'item_name' : item and item[0]['item_name'] or '',
'description' : item and item[0]['description'] or ''
}
return ret
def validate_reference_value(self, check_for):
if check_for == 'Sales Order':
pass
elif check_for == 'Customer Issue':
pass
return ret
def validate_serial_no(self):
for d in getlist(self.doclist, 'maintenance_visit_details'):
@ -57,16 +50,6 @@ class DocType(TransactionBase):
if not getlist(self.doclist, 'maintenance_visit_details'):
msgprint("Please enter maintenance details")
raise Exception
check_for = ''
for d in getlist(self.doclist, 'maintenance_visit_details'):
if d.prevdoc_doctype == 'Sales Order':
check_for = 'Sales Order'
elif d.prevdoc_doctype == 'Customer Issue':
check_for = 'Customer Issue'
if check_for:
self.validate_reference_value(check_for)
self.validate_serial_no()

View File

@ -298,6 +298,26 @@ class TransactionBase(StatusUpdater):
})
webnotes.bean(event_doclist).insert()
def validate_with_previous_doc(self, source_dt, ref):
for key, val in ref.items():
ref_doc = {}
for d in self.doclist.get({"doctype": source_dt}):
if d.fields[val["ref_dn_field"]]:
ref_doc.setdefault(key, d.fields[val["ref_dn_field"]])
if val.get("is_child_table"):
self.compare_values(ref_doc, val["compare_fields"], d)
else:
self.compare_values(ref_doc, val["compare_fields"])
def compare_values(self, ref_doc, fields, doc=None):
for ref_doctype, ref_docname in ref_doc.items():
prevdoc_values = webnotes.conn.get_value(ref_doctype, ref_docname,
[d[0] for d in fields], as_dict=1)
for field, condition in fields:
self.validate_value(field, condition, prevdoc_values[field], doc)
def get_default_address_and_contact(party_field, party_name, fetch_shipping_address=False):
out = {}

View File

@ -15,6 +15,9 @@ class DocType(DocListController):
self.validate_tax_masters()
self.validate_exchange_rates_exist()
def on_update(self):
webnotes.conn.set_default("shopping_cart_enabled", self.doc.fields.get("enabled") or 0)
def validate_overlapping_territories(self, parentfield, fieldname):
# for displaying message
doctype = self.meta.get_field(parentfield).options

View File

@ -42,6 +42,9 @@ def update_cart(item_code, qty, with_doclist=0):
quotation_items[0].qty = qty
apply_cart_settings(quotation=quotation)
quotation.ignore_permissions = True
quotation.save()
if with_doclist:
return get_cart_quotation(quotation.doclist)
@ -67,10 +70,10 @@ def update_cart_address(address_fieldname, address_name):
quotation.doc.address_display = address_display
apply_cart_settings(quotation=quotation)
quotation.ignore_permissions = True
quotation.save()
apply_cart_settings(quotation=quotation)
return get_cart_quotation(quotation.doclist)
@ -136,9 +139,11 @@ def get_lead_or_customer():
"territory": guess_territory(),
"status": "Open" # TODO: set something better???
})
lead_bean.ignore_permissions = True
lead_bean.insert()
if webnotes.session.user != "Guest":
lead_bean.ignore_permissions = True
lead_bean.insert()
return lead_bean.doc
def guess_territory():
@ -202,7 +207,7 @@ def apply_cart_settings(party=None, quotation=None):
billing_territory = get_address_territory(quotation.doc.customer_address) or \
party.territory
set_price_list_and_rate(quotation, cart_settings, billing_territory)
quotation.run_method("calculate_taxes_and_totals")
@ -211,9 +216,6 @@ def apply_cart_settings(party=None, quotation=None):
_apply_shipping_rule(party, quotation, cart_settings)
quotation.ignore_permissions = True
quotation.save()
def set_price_list_and_rate(quotation, cart_settings, billing_territory):
"""set price list based on billing territory"""
quotation.doc.price_list_name = cart_settings.get_price_list(billing_territory)
@ -227,6 +229,9 @@ def set_price_list_and_rate(quotation, cart_settings, billing_territory):
# refetch values
quotation.run_method("set_price_list_and_item_details")
# set it in cookies for using in product page
webnotes.cookies[b"price_list_name"] = quotation.doc.price_list_name
def set_taxes(quotation, cart_settings, billing_territory):
"""set taxes based on billing territory"""
quotation.doc.charge = cart_settings.get_tax_master(billing_territory)
@ -247,6 +252,7 @@ def apply_shipping_rule(shipping_rule):
apply_cart_settings(quotation=quotation)
quotation.ignore_permissions = True
quotation.save()
return get_cart_quotation(quotation.doclist)

View File

@ -6,11 +6,18 @@ from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr, cint, fmt_money
from webnotes.webutils import build_html, delete_page_cache
from website.helpers.cart import _get_cart_quotation
@webnotes.whitelist(allow_guest=True)
def get_product_info(item_code):
"""get product price / stock info"""
price_list = webnotes.conn.get_value("Price List", {"use_for_website": 1})
if not webnotes.conn.get_default("shopping_cart_enabled"):
return {}
cart_quotation = _get_cart_quotation()
price_list = webnotes.cookies.get("price_list_name").value
warehouse = webnotes.conn.get_value("Item", item_code, "website_warehouse")
if warehouse:
in_stock = webnotes.conn.sql("""select actual_qty from tabBin where
@ -35,8 +42,7 @@ def get_product_info(item_code):
or ""
if webnotes.session.user != "Guest":
from website.helpers.cart import _get_cart_quotation
item = _get_cart_quotation().doclist.get({"item_code": item_code})
item = cart_quotation.doclist.get({"item_code": item_code})
if item:
qty = item[0].qty

View File

@ -43,7 +43,8 @@
<button class="btn btn-primary">
<i class="icon-shopping-cart"></i> Add to Cart</button>
</div>
<div id="item-update-cart" class="input-group col-lg-4" style="display: none;">
<div id="item-update-cart" class="input-group col-lg-4" style="display: none;
padding-left: 0px; padding-right: 0px;">
<input type="text">
<div class="input-group-btn">
<button class="btn btn-primary">

View File

@ -96,7 +96,7 @@ $.extend(wn.cart, {
var shipping_rule_added = false;
var taxes_exist = false;
var shipping_rule_labels = $.map(out.shipping_rules, function(rule) { return rule[1]; });
var shipping_rule_labels = $.map(out.shipping_rules || [], function(rule) { return rule[1]; });
$.each(doclist, function(i, doc) {
if(doc.doctype === "Quotation Item") {
wn.cart.render_item_row($cart_items, doc);