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

This commit is contained in:
Anand Doshi
2013-07-15 18:30:02 +05:30
21 changed files with 175 additions and 182 deletions

View File

@@ -114,16 +114,6 @@ class DocType(BuyingController):
ret={'add_tax_rate' :rate and flt(rate[0][0]) or 0 }
return ret
def validate_duplicate_docname(self,doctype):
for d in getlist(self.doclist, 'entries'):
if doctype == 'purchase_receipt' and cstr(self.doc.purchase_receipt_main) == cstr(d.purchase_receipt):
msgprint(cstr(self.doc.purchase_receipt_main) + " purchase receipt details have already been pulled.")
raise Exception , " Validation Error. "
if doctype == 'purchase_order' and cstr(self.doc.purchase_order_main) == cstr(d.purchase_order) and not d.purchase_receipt:
msgprint(cstr(self.doc.purchase_order_main) + " purchase order details have already been pulled.")
raise Exception , " Validation Error. "
def check_active_purchase_items(self):
for d in getlist(self.doclist, 'entries'):
if d.item_code: # extra condn coz item_code is not mandatory in PV
@@ -145,13 +135,19 @@ class DocType(BuyingController):
raise Exception
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))
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))
if b_no and cstr(b_no[0][2]) == cstr(self.doc.is_opening):
msgprint("Please check you have already booked expense against Bill No. %s in Purchase Invoice %s" % (cstr(b_no[0][0]), cstr(b_no[0][1])))
raise Exception , "Validation Error"
if not self.doc.remarks:
self.doc.remarks = (self.doc.remarks or '') + "\n" + ("Against Bill %s dated %s" % (self.doc.bill_no, formatdate(self.doc.bill_date)))
msgprint("Please check you have already booked expense against Bill No. %s \
in Purchase Invoice %s" % (cstr(b_no[0][0]), cstr(b_no[0][1])),
raise_exception=1)
if not self.doc.remarks and self.doc.bill_date:
self.doc.remarks = (self.doc.remarks or '') + "\n" + ("Against Bill %s dated %s"
% (self.doc.bill_no, formatdate(self.doc.bill_date)))
else:
if not self.doc.remarks:
self.doc.remarks = "No Remarks"

View File

@@ -127,7 +127,7 @@ cur_frm.cscript.row_id = function(doc, cdt, cdn) {
refresh_field('row_id',d.name,'purchase_tax_details');
}
cur_frm.set_query("account_head", "purchase_tax_details", function() {
cur_frm.set_query("account_head", "purchase_tax_details", function(doc) {
return {
filters: [
["Account", "group_or_ledger", "=", "Ledger"],

View File

@@ -276,25 +276,6 @@ class DocType(SellingController):
if self.doc.debit_to:
self.doc.customer = webnotes.conn.get_value('Account',self.doc.debit_to,'master_name')
def update_accounts(self):
if not self.doc.debit_to:
self.doc.debit_to = self.get_debit_to().get("debit_to")
self.get_income_expense_account('entries')
def get_income_expense_account(self,doctype):
auto_inventory_accounting = cint(webnotes.defaults.get_global_default("auto_inventory_accounting"))
default_cost_center = webnotes.conn.get_value("Company", self.doc.company, "cost_center")
for d in getlist(self.doclist, doctype):
if d.item_code:
item = webnotes.conn.get_value("Item", d.item_code, ["default_income_account",
"default_sales_cost_center", "purchase_account"], as_dict=True)
d.income_account = item['default_income_account'] or ""
d.cost_center = item['default_sales_cost_center'] or default_cost_center
if auto_inventory_accounting and cint(self.doc.update_stock):
d.expense_account = item['purchase_account'] or ""
def get_barcode_details(self, barcode):
return get_obj('Sales Common').get_barcode_details(barcode)