Merge branch 'stable' into latest
Conflicts: erpnext/accounts/doctype/journal_voucher/journal_voucher.js erpnext/accounts/doctype/payable_voucher/payable_voucher.js index.html version.num
This commit is contained in:
commit
e00e70841c
@ -5,145 +5,145 @@
|
||||
{
|
||||
'creation': '2010-08-08 17:09:35',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-10-12 12:10:15',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
'modified': '2012-02-06 15:25:06',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'doctype': u'Table Mapper Detail',
|
||||
'name': '__common__',
|
||||
'parent': 'Purchase Order-Payable Voucher',
|
||||
'parentfield': 'table_mapper_details',
|
||||
'parenttype': 'DocType Mapper'
|
||||
'parent': u'Purchase Order-Payable Voucher',
|
||||
'parentfield': u'table_mapper_details',
|
||||
'parenttype': u'DocType Mapper'
|
||||
},
|
||||
|
||||
# These values are common for all Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'name': '__common__',
|
||||
'parent': 'Purchase Order-Payable Voucher',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper'
|
||||
'parent': u'Purchase Order-Payable Voucher',
|
||||
'parentfield': u'field_mapper_details',
|
||||
'parenttype': u'DocType Mapper'
|
||||
},
|
||||
|
||||
# These values are common for all DocType Mapper
|
||||
{
|
||||
'doctype': u'DocType Mapper',
|
||||
'from_doctype': 'Purchase Order',
|
||||
'module': 'Accounts',
|
||||
'from_doctype': u'Purchase Order',
|
||||
'module': u'Accounts',
|
||||
'name': '__common__',
|
||||
'ref_doc_submitted': 1,
|
||||
'to_doctype': 'Payable Voucher'
|
||||
'to_doctype': u'Payable Voucher'
|
||||
},
|
||||
|
||||
# DocType Mapper, Purchase Order-Payable Voucher
|
||||
{
|
||||
'doctype': u'DocType Mapper',
|
||||
'name': 'Purchase Order-Payable Voucher'
|
||||
'name': u'Purchase Order-Payable Voucher'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'eval: flt(obj.qty) - flt(obj.billed_qty)',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'eval: flt(obj.qty) - flt(obj.billed_qty)',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'qty'
|
||||
'to_field': u'qty'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'purchase_rate',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'purchase_rate',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'rate'
|
||||
'to_field': u'rate'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'amount'
|
||||
'to_field': u'amount'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'import_amount'
|
||||
'to_field': u'import_amount'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'parent',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'parent',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'purchase_order'
|
||||
'to_field': u'purchase_order'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'name',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'name',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'po_detail'
|
||||
'to_field': u'po_detail'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'naming_series',
|
||||
'map': 'No',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'naming_series',
|
||||
'map': u'No',
|
||||
'match_id': 0,
|
||||
'to_field': 'naming_series'
|
||||
'to_field': u'naming_series'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'total_tax',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'total_tax',
|
||||
'map': u'Yes',
|
||||
'match_id': 0,
|
||||
'to_field': 'total_tax'
|
||||
'to_field': u'total_tax'
|
||||
},
|
||||
|
||||
# Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_table': 'Purchase Order',
|
||||
'doctype': u'Table Mapper Detail',
|
||||
'from_table': u'Purchase Order',
|
||||
'match_id': 0,
|
||||
'to_table': 'Payable Voucher',
|
||||
'validation_logic': 'docstatus =1'
|
||||
'to_table': u'Payable Voucher',
|
||||
'validation_logic': u'docstatus =1'
|
||||
},
|
||||
|
||||
# Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': 'po_details',
|
||||
'from_table': 'PO Detail',
|
||||
'doctype': u'Table Mapper Detail',
|
||||
'from_field': u'po_details',
|
||||
'from_table': u'PO Detail',
|
||||
'match_id': 1,
|
||||
'to_field': 'entries',
|
||||
'to_table': 'PV Detail',
|
||||
'validation_logic': 'ifnull(billed_qty,0) < qty and docstatus = 1'
|
||||
'to_field': u'entries',
|
||||
'to_table': u'PV Detail',
|
||||
'validation_logic': u'ifnull(billed_qty,0) < qty and docstatus = 1'
|
||||
},
|
||||
|
||||
# Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': 'purchase_tax_details',
|
||||
'from_table': 'Purchase Tax Detail',
|
||||
'doctype': u'Table Mapper Detail',
|
||||
'from_field': u'purchase_tax_details',
|
||||
'from_table': u'Purchase Tax Detail',
|
||||
'match_id': 2,
|
||||
'to_field': 'purchase_tax_details',
|
||||
'to_table': 'Purchase Tax Detail',
|
||||
'validation_logic': 'docstatus =1'
|
||||
'to_field': u'purchase_tax_details',
|
||||
'to_table': u'Purchase Tax Detail',
|
||||
'validation_logic': u'docstatus =1'
|
||||
}
|
||||
]
|
@ -5,181 +5,181 @@
|
||||
{
|
||||
'creation': '2010-08-08 17:09:35',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-10-12 10:49:26',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
'modified': '2012-02-06 15:26:25',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'doctype': u'Table Mapper Detail',
|
||||
'name': '__common__',
|
||||
'parent': 'Purchase Receipt-Payable Voucher',
|
||||
'parentfield': 'table_mapper_details',
|
||||
'parenttype': 'DocType Mapper'
|
||||
'parent': u'Purchase Receipt-Payable Voucher',
|
||||
'parentfield': u'table_mapper_details',
|
||||
'parenttype': u'DocType Mapper'
|
||||
},
|
||||
|
||||
# These values are common for all Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'name': '__common__',
|
||||
'parent': 'Purchase Receipt-Payable Voucher',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper'
|
||||
'parent': u'Purchase Receipt-Payable Voucher',
|
||||
'parentfield': u'field_mapper_details',
|
||||
'parenttype': u'DocType Mapper'
|
||||
},
|
||||
|
||||
# These values are common for all DocType Mapper
|
||||
{
|
||||
'doctype': u'DocType Mapper',
|
||||
'from_doctype': 'Purchase Receipt',
|
||||
'module': 'Accounts',
|
||||
'from_doctype': u'Purchase Receipt',
|
||||
'module': u'Accounts',
|
||||
'name': '__common__',
|
||||
'ref_doc_submitted': 1,
|
||||
'to_doctype': 'Payable Voucher'
|
||||
'to_doctype': u'Payable Voucher'
|
||||
},
|
||||
|
||||
# DocType Mapper, Purchase Receipt-Payable Voucher
|
||||
{
|
||||
'doctype': u'DocType Mapper',
|
||||
'name': 'Purchase Receipt-Payable Voucher'
|
||||
'name': u'Purchase Receipt-Payable Voucher'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'eval: flt(obj.qty) - flt(obj.billed_qty)',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'eval: flt(obj.qty) - flt(obj.billed_qty)',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'qty'
|
||||
'to_field': u'qty'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'purchase_rate',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'purchase_rate',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'rate'
|
||||
'to_field': u'rate'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'amount'
|
||||
'to_field': u'amount'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'import_amount'
|
||||
'to_field': u'import_amount'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'parent',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'parent',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'purchase_receipt'
|
||||
'to_field': u'purchase_receipt'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'prevdoc_docname',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'prevdoc_docname',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'purchase_order'
|
||||
'to_field': u'purchase_order'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'name',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'name',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'pr_detail'
|
||||
'to_field': u'pr_detail'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'prevdoc_detail_docname',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'prevdoc_detail_docname',
|
||||
'map': u'Yes',
|
||||
'match_id': 1,
|
||||
'to_field': 'po_detail'
|
||||
'to_field': u'po_detail'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'naming_series',
|
||||
'map': 'No',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'naming_series',
|
||||
'map': u'No',
|
||||
'match_id': 0,
|
||||
'to_field': 'naming_series'
|
||||
'to_field': u'naming_series'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'net_total',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'net_total',
|
||||
'map': u'Yes',
|
||||
'match_id': 0,
|
||||
'to_field': 'net_total'
|
||||
'to_field': u'net_total'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'grand_total',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'grand_total',
|
||||
'map': u'Yes',
|
||||
'match_id': 0,
|
||||
'to_field': 'grand_total'
|
||||
'to_field': u'grand_total'
|
||||
},
|
||||
|
||||
# Field Mapper Detail
|
||||
{
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'total_tax',
|
||||
'map': 'Yes',
|
||||
'doctype': u'Field Mapper Detail',
|
||||
'from_field': u'total_tax',
|
||||
'map': u'Yes',
|
||||
'match_id': 0,
|
||||
'to_field': 'total_tax'
|
||||
'to_field': u'total_tax'
|
||||
},
|
||||
|
||||
# Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': 'purchase_receipt_details',
|
||||
'from_table': 'Purchase Receipt Detail',
|
||||
'doctype': u'Table Mapper Detail',
|
||||
'from_field': u'purchase_receipt_details',
|
||||
'from_table': u'Purchase Receipt Detail',
|
||||
'match_id': 1,
|
||||
'to_field': 'entries',
|
||||
'to_table': 'PV Detail',
|
||||
'validation_logic': 'ifnull(billed_qty,0) < qty'
|
||||
'to_field': u'entries',
|
||||
'to_table': u'PV Detail',
|
||||
'validation_logic': u'ifnull(billed_qty,0) < qty'
|
||||
},
|
||||
|
||||
# Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_table': 'Purchase Receipt',
|
||||
'doctype': u'Table Mapper Detail',
|
||||
'from_table': u'Purchase Receipt',
|
||||
'match_id': 0,
|
||||
'to_table': 'Payable Voucher',
|
||||
'validation_logic': 'docstatus=1'
|
||||
'to_table': u'Payable Voucher',
|
||||
'validation_logic': u'docstatus=1'
|
||||
},
|
||||
|
||||
# Table Mapper Detail
|
||||
{
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': 'purchase_tax_details',
|
||||
'from_table': 'Purchase Tax Detail',
|
||||
'doctype': u'Table Mapper Detail',
|
||||
'from_field': u'purchase_tax_details',
|
||||
'from_table': u'Purchase Tax Detail',
|
||||
'match_id': 2,
|
||||
'to_field': 'purchase_tax_details',
|
||||
'to_table': 'Purchase Tax Detail',
|
||||
'validation_logic': 'docstatus=1'
|
||||
'to_field': u'purchase_tax_details',
|
||||
'to_table': u'Purchase Tax Detail',
|
||||
'validation_logic': u'docstatus=1'
|
||||
}
|
||||
]
|
@ -9,8 +9,28 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
else {
|
||||
hide_field(['tds_applicable','tds_category','Get TDS','tax_code','rate','ded_amount','supplier_account']);
|
||||
}
|
||||
|
||||
cur_frm.cscript.load_defaults(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.load_defaults = function(doc, cdt, cdn) {
|
||||
if(!cur_frm.doc.__islocal || !cur_frm.doc.company) { return; }
|
||||
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
var fields_to_refresh = LocalDB.set_default_values(doc);
|
||||
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
|
||||
|
||||
fields_to_refresh = null;
|
||||
var children = getchildren('Journal Voucher Detail', doc.name, 'entries');
|
||||
if(!children) { return; }
|
||||
for(var i=0; i<children.length; i++) {
|
||||
LocalDB.set_default_values(children[i]);
|
||||
}
|
||||
refresh_field('entries');
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.is_opening = function(doc, cdt, cdn) {
|
||||
hide_field('aging_date');
|
||||
if (doc.is_opening == 'Yes') unhide_field('aging_date');
|
||||
|
@ -22,6 +22,9 @@ cur_frm.cscript.onload = function(doc,dt,dn) {
|
||||
if(doc.__islocal){
|
||||
hide_field(['supplier_address', 'contact_person', 'supplier_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email']);
|
||||
}
|
||||
|
||||
// defined in purchase_common.js
|
||||
cur_frm.cscript.update_item_details(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,7 +92,19 @@ class DocType(TransactionBase):
|
||||
|
||||
# Get Item Details
|
||||
# -----------------
|
||||
def get_item_details(self,arg):
|
||||
def get_item_details(self, arg=None):
|
||||
if arg:
|
||||
return self.get_pv_details(arg)
|
||||
else:
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
ret = self.get_pv_details(doc.item_code)
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
|
||||
def get_pv_details(self, arg):
|
||||
item_det = sql("select item_name, brand, description, item_group,purchase_account,cost_center from tabItem where name=%s",arg,as_dict=1)
|
||||
tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg)
|
||||
t = {}
|
||||
@ -111,6 +123,8 @@ class DocType(TransactionBase):
|
||||
}
|
||||
return ret
|
||||
|
||||
|
||||
|
||||
# Advance Allocation
|
||||
# -------------------
|
||||
def get_advances(self):
|
||||
|
@ -25,6 +25,9 @@ cur_frm.cscript.onload = function(doc,dt,dn) {
|
||||
if(doc.is_pos ==1) cur_frm.cscript.is_pos(doc, dt, dn);
|
||||
|
||||
hide_field(['customer_address', 'contact_person', 'customer_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
|
||||
|
||||
// defined in sales_common.js
|
||||
cur_frm.cscript.update_item_details(doc, cdt, cdn);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,8 +148,22 @@ class DocType(TransactionBase):
|
||||
|
||||
# Item Details
|
||||
# -------------
|
||||
def get_item_details(self, item_code):
|
||||
def get_item_details(self, item_code=None):
|
||||
if item_code:
|
||||
ret = get_obj('Sales Common').get_item_details(item_code, self)
|
||||
return self.get_pos_details(item_code, ret)
|
||||
else:
|
||||
obj = get_obj('Sales Common')
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
ret = obj.get_item_details(doc.item_code, self)
|
||||
ret = self.get_pos_details(item_code, ret)
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
|
||||
def get_pos_details(self, item_code, ret):
|
||||
if item_code and cint(self.doc.is_pos) == 1:
|
||||
dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where user = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
|
||||
if not dtl:
|
||||
@ -162,6 +176,7 @@ class DocType(TransactionBase):
|
||||
ret['actual_qty']= actual_qty and flt(actual_qty[0][0]) or 0
|
||||
return ret
|
||||
|
||||
|
||||
# Fetch ref rate from item master as per selected price list
|
||||
def get_adj_percent(self, arg=''):
|
||||
get_obj('Sales Common').get_adj_percent(self)
|
||||
|
@ -10,6 +10,8 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date())
|
||||
if (!doc.status) doc.status = 'Draft';
|
||||
|
||||
// defined in purchase_common.js
|
||||
//cur_frm.cscript.update_item_details(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||
|
@ -90,7 +90,21 @@ class DocType:
|
||||
# get item details
|
||||
# ---------------------------------
|
||||
def get_item_details(self, arg =''):
|
||||
if arg:
|
||||
return get_obj(dt='Purchase Common').get_item_details(self,arg)
|
||||
else:
|
||||
obj = get_obj('Purchase Common')
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
temp = {
|
||||
'item_code': doc.fields.get('item_code'),
|
||||
'warehouse': doc.fields.get('warehouse')
|
||||
}
|
||||
ret = obj.get_item_details(self, json.dumps(temp))
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
|
||||
# Get UOM Details
|
||||
# ---------------------------------
|
||||
|
@ -14,6 +14,41 @@ cur_frm.cscript.get_default_schedule_date = function(doc) {
|
||||
}
|
||||
|
||||
|
||||
// Gets called after existing item details are update to fill in
|
||||
// remaining default values
|
||||
cur_frm.cscript.load_defaults = function(doc, dt, dn) {
|
||||
if(!cur_frm.doc.__islocal) { return; }
|
||||
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
var fields_to_refresh = LocalDB.set_default_values(doc);
|
||||
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
|
||||
|
||||
fields_to_refresh = null;
|
||||
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
|
||||
if(!children) { return; }
|
||||
for(var i=0; i<children.length; i++) {
|
||||
LocalDB.set_default_values(children[i]);
|
||||
}
|
||||
refresh_field(cur_frm.cscript.fname);
|
||||
}
|
||||
|
||||
// Update existing item details
|
||||
cur_frm.cscript.update_item_details = function(doc, dt, dn) {
|
||||
if(!cur_frm.doc.__islocal) return;
|
||||
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
|
||||
if(children) {
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'get_item_details', '',
|
||||
function(r, rt) {
|
||||
if(!r.exc) {
|
||||
refresh_field(cur_frm.cscript.fname);
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
cur_frm.cscript.load_defaults(doc, dt, dn);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ======================== Conversion Rate ==========================================
|
||||
cur_frm.cscript.conversion_rate = function(doc,cdt,cdn) {
|
||||
cur_frm.cscript.calc_amount( doc, 1);
|
||||
@ -29,8 +64,11 @@ cur_frm.fields_dict[fname].grid.get_field("item_code").get_query = function(doc,
|
||||
cur_frm.cscript.item_code = function(doc,cdt,cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code) {
|
||||
temp = "{'item_code':'"+(d.item_code?d.item_code:'')+"', 'warehouse':'"+(d.warehouse?d.warehouse:'')+"'}"
|
||||
get_server_fields('get_item_details', temp, fname, doc, cdt, cdn, 1);
|
||||
temp = {
|
||||
item_code: d.item_code || '',
|
||||
warehouse: d.warehouse || ''
|
||||
}
|
||||
get_server_fields('get_item_details', JSON.stringify(temp), fname, doc, cdt, cdn, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -304,8 +342,13 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname)
|
||||
else if(doc.doctype == 'Payable Voucher') net_total += flt(flt(cl[i].qty) * flt(cl[i].rate));
|
||||
|
||||
var prev_total = flt(cl[i].amount);
|
||||
if(cl[i].item_tax_rate)
|
||||
if(cl[i].item_tax_rate) {
|
||||
try {
|
||||
var check_tax = JSON.parse(cl[i].item_tax_rate); //to get in dictionary
|
||||
} catch(exception) {
|
||||
var check_tax = eval('var a='+cl[i].item_tax_rate+';a'); //to get in dictionary
|
||||
}
|
||||
}
|
||||
|
||||
// Add Item Code in new Row
|
||||
//--------------------------
|
||||
@ -321,6 +364,7 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname)
|
||||
if(cl[i].item_tax_rate && check_tax[account]!=null) {rate = flt(check_tax[account]);}
|
||||
else // if particular item doesn't have particular rate it will take other charges rate
|
||||
rate = flt(tax[t].rate);
|
||||
|
||||
//Check For Rate and get tax amount
|
||||
var tax_amount = cur_frm.cscript.check_charge_type_and_get_tax_amount(doc,tax,t, cl[i], rate);
|
||||
|
||||
|
@ -96,9 +96,9 @@ class DocType(TransactionBase):
|
||||
if r: obj.doc.terms = r[0][0]
|
||||
|
||||
# Get Item Details
|
||||
def get_item_details( self, obj, arg =''):
|
||||
|
||||
arg = eval(arg)
|
||||
def get_item_details(self, obj, arg =''):
|
||||
import json
|
||||
arg = json.loads(arg)
|
||||
item = sql("select item_name,item_group, brand, description, min_order_qty, stock_uom, default_warehouse,lead_time_days, last_purchase_rate from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())", (arg['item_code']), as_dict = 1)
|
||||
tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg['item_code'])
|
||||
t = {}
|
||||
@ -119,7 +119,7 @@ class DocType(TransactionBase):
|
||||
'stock_uom' : item and item[0]['stock_uom'] or '',
|
||||
'conversion_factor' : '1',
|
||||
'warehouse' : wh,
|
||||
'item_tax_rate' : str(t),
|
||||
'item_tax_rate' : json.dumps(t),
|
||||
'batch_no' : '',
|
||||
'discount_rate' : 0
|
||||
}
|
||||
|
@ -19,6 +19,9 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(doc.__islocal){
|
||||
hide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
|
||||
}
|
||||
|
||||
// defined in purchase_common.js
|
||||
//cur_frm.cscript.update_item_details(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||
|
@ -40,7 +40,22 @@ class DocType(TransactionBase):
|
||||
|
||||
# Get Item Details
|
||||
def get_item_details(self, arg =''):
|
||||
if arg:
|
||||
return get_obj(dt='Purchase Common').get_item_details(self,arg)
|
||||
else:
|
||||
obj = get_obj('Purchase Common')
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
temp = {
|
||||
'item_code': doc.fields.get('item_code'),
|
||||
'warehouse': doc.fields.get('warehouse')
|
||||
}
|
||||
ret = obj.get_item_details(self, json.dumps(temp))
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
|
||||
|
||||
# Get UOM Details
|
||||
def get_uom_details(self, arg = ''):
|
||||
|
@ -95,7 +95,8 @@ class DocType:
|
||||
from webnotes.utils import file_manager
|
||||
fn, content = file_manager.get_file(filename[1])
|
||||
|
||||
if not type(content) == str:
|
||||
# NOTE: Don't know why this condition exists
|
||||
if not isinstance(content, basestring) and hasattr(content, 'tostring'):
|
||||
content = content.tostring()
|
||||
|
||||
import webnotes.model.import_docs
|
||||
|
@ -31,6 +31,10 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
hide_field(['customer','customer_address','contact_person', 'customer_name','contact_display', 'customer_group']);
|
||||
}
|
||||
}
|
||||
|
||||
// defined in sales_common.js
|
||||
cur_frm.cscript.update_item_details(doc, cdt, cdn);
|
||||
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
||||
@ -268,6 +272,7 @@ cur_frm.cscript.quot_to_validate = function(doc,cdt,cdn){
|
||||
//===================validation function =================================
|
||||
|
||||
cur_frm.cscript.validate = function(doc,cdt,cdn){
|
||||
cur_frm.cscript['Re-Calculate Values'](doc, cdt, cdn);
|
||||
cur_frm.cscript.quot_to_validate(doc,cdt,cdn);
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,18 @@ class DocType(TransactionBase):
|
||||
|
||||
# Get Item Details
|
||||
# -----------------
|
||||
def get_item_details(self, item_code):
|
||||
def get_item_details(self, item_code=None):
|
||||
if item_code:
|
||||
return get_obj('Sales Common').get_item_details(item_code, self)
|
||||
else:
|
||||
obj = get_obj('Sales Common')
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
ret = obj.get_item_details(doc.item_code, self)
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
|
||||
# Re-calculates Basic Rate & amount based on Price List Selected
|
||||
# --------------------------------------------------------------
|
||||
|
@ -15,6 +15,42 @@ cur_frm.cscript.load_taxes = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
|
||||
// Gets called after existing item details are update to fill in
|
||||
// remaining default values
|
||||
cur_frm.cscript.load_defaults = function(doc, dt, dn) {
|
||||
if(!cur_frm.doc.__islocal) { return; }
|
||||
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
var fields_to_refresh = LocalDB.set_default_values(doc);
|
||||
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
|
||||
|
||||
fields_to_refresh = null;
|
||||
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
|
||||
if(!children) { return; }
|
||||
for(var i=0; i<children.length; i++) {
|
||||
LocalDB.set_default_values(children[i]);
|
||||
}
|
||||
refresh_field(cur_frm.cscript.fname);
|
||||
}
|
||||
|
||||
|
||||
// Update existing item details
|
||||
cur_frm.cscript.update_item_details = function(doc, dt, dn) {
|
||||
if(!cur_frm.doc.__islocal) return;
|
||||
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
|
||||
if(children) {
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'get_item_details', '',
|
||||
function(r, rt) {
|
||||
if(!r.exc) {
|
||||
refresh_field(cur_frm.cscript.fname);
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
cur_frm.cscript.load_defaults(doc, dt, dn);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -----------------
|
||||
// Shipping Address
|
||||
// -----------------
|
||||
@ -171,7 +207,7 @@ cur_frm.cscript.export_rate = function(doc,cdt,cdn) {
|
||||
var cur_rec = locals[cdt][cdn];
|
||||
var fname = cur_frm.cscript.fname;
|
||||
var tname = cur_frm.cscript.tname;
|
||||
if(flt(cur_rec.ref_rate)>0 && flt(cur_rec.export_rate)>0 && !flt(cur_rec.adj_rate)) {
|
||||
if(flt(cur_rec.ref_rate)>0 && flt(cur_rec.export_rate)>0) {
|
||||
var adj_rate = 100 * (1 - (flt(cur_rec.export_rate) / flt(cur_rec.ref_rate)));
|
||||
set_multiple(tname, cur_rec.name, { 'adj_rate': adj_rate }, fname);
|
||||
}
|
||||
@ -293,8 +329,13 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname)
|
||||
for(var i=0;i<cl.length;i++) {
|
||||
net_total += flt(flt(cl[i].qty) * flt(cl[i].basic_rate));
|
||||
var prev_total = flt(cl[i].amount);
|
||||
if(cl[i].item_tax_rate)
|
||||
if(cl[i].item_tax_rate) {
|
||||
try {
|
||||
var check_tax = JSON.parse(cl[i].item_tax_rate); //to get in dictionary
|
||||
} catch(exception) {
|
||||
var check_tax = eval('var a='+cl[i].item_tax_rate+';a'); //to get in dictionary
|
||||
}
|
||||
}
|
||||
|
||||
// Add Item Code in new Row
|
||||
$td(otc,i+1,0).innerHTML = cl[i].item_code ? cl[i].item_code : cl[i].description;
|
||||
@ -409,8 +450,11 @@ cur_frm.cscript.consider_incl_rate = function(doc, other_fname) {
|
||||
cur_frm.cscript.back_calc_basic_rate = function(doc, tname, fname, child, other_fname) {
|
||||
var get_item_tax_rate = function(item, tax) {
|
||||
if(item.item_tax_rate) {
|
||||
// Should to replace eval with JSON.parse when item_tax_rate is converted to json string notation
|
||||
try {
|
||||
var item_tax = JSON.parse(item.item_tax_rate);
|
||||
} catch(exception) {
|
||||
var item_tax = eval('var a='+item.item_tax_rate+';a');
|
||||
}
|
||||
if(item_tax[tax.account_head]!=null) {
|
||||
return flt(item_tax[tax.account_head]);
|
||||
}
|
||||
|
@ -109,10 +109,11 @@ class DocType(TransactionBase):
|
||||
# Get Item Details
|
||||
# ===============================================================
|
||||
def get_item_details(self, item_code, obj):
|
||||
import json
|
||||
if not obj.doc.price_list_name:
|
||||
msgprint("Please Select Price List before selecting Items")
|
||||
raise Exception
|
||||
item = webnotes.conn.sql("select description, item_name, brand, item_group, stock_uom, default_warehouse, default_income_account, default_sales_cost_center, description_html from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life > now() or end_of_life = '0000-00-00') and (is_sales_item = 'Yes' or is_service_item = 'Yes')" %(item_code), as_dict=1)
|
||||
item = webnotes.conn.sql("select description, item_name, brand, item_group, stock_uom, default_warehouse, default_income_account, default_sales_cost_center, description_html from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life > now() or end_of_life = '0000-00-00') and (is_sales_item = 'Yes' or is_service_item = 'Yes')" % (item_code), as_dict=1)
|
||||
tax = webnotes.conn.sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item_code)
|
||||
t = {}
|
||||
for x in tax: t[x[0]] = flt(x[1])
|
||||
@ -130,7 +131,7 @@ class DocType(TransactionBase):
|
||||
'adj_rate' : 0,
|
||||
'amount' : 0,
|
||||
'export_amount' : 0,
|
||||
'item_tax_rate' : str(t),
|
||||
'item_tax_rate' : json.dumps(t),
|
||||
'batch_no' : ''
|
||||
}
|
||||
if(obj.doc.price_list_name and item): #this is done to fetch the changed BASIC RATE and REF RATE based on PRICE LIST
|
||||
|
@ -22,6 +22,9 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(doc.__islocal){
|
||||
hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
|
||||
}
|
||||
|
||||
// defined in sales_common.js
|
||||
cur_frm.cscript.update_item_details(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||
|
@ -85,8 +85,18 @@ class DocType(TransactionBase):
|
||||
# ================================================================================
|
||||
# Get Item Details
|
||||
# ----------------
|
||||
def get_item_details(self, item_code):
|
||||
def get_item_details(self, item_code=None):
|
||||
if item_code:
|
||||
return get_obj('Sales Common').get_item_details(item_code, self)
|
||||
else:
|
||||
obj = get_obj('Sales Common')
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
ret = obj.get_item_details(doc.item_code, self)
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
|
||||
# Re-calculates Basic Rate & amount based on Price List Selected
|
||||
# --------------------------------------------------------------
|
||||
|
@ -520,7 +520,8 @@ class DocType:
|
||||
currency = company.default_currency
|
||||
|
||||
def table(args):
|
||||
if type(args['body']) == type(''):
|
||||
table_body = ""
|
||||
if isinstance(args['body'], basestring):
|
||||
table_body = """\
|
||||
<tbody><tr>
|
||||
<td style='padding: 5px; font-size: 24px; \
|
||||
@ -530,7 +531,7 @@ class DocType:
|
||||
</td>
|
||||
</tr></tbody>"""
|
||||
|
||||
elif type(args['body'] == type([])):
|
||||
elif isinstance(args['body'], list):
|
||||
body_rows = []
|
||||
for rows in args['body']:
|
||||
for r in rows:
|
||||
@ -762,7 +763,7 @@ def send():
|
||||
"""
|
||||
edigest_list = webnotes.conn.sql("""
|
||||
SELECT name FROM `tabEmail Digest`
|
||||
WHERE enabled=1
|
||||
WHERE enabled=1 and docstatus<2
|
||||
""", as_list=1)
|
||||
|
||||
from webnotes.model.code import get_obj
|
||||
|
@ -86,7 +86,8 @@ class DocType:
|
||||
from webnotes.utils import file_manager
|
||||
fn, content = file_manager.get_file(fid)
|
||||
|
||||
if not type(content) == str:
|
||||
# NOTE: Don't know why this condition exists
|
||||
if not isinstance(content, basestring) and hasattr(content, 'tostring'):
|
||||
content = content.tostring()
|
||||
|
||||
return content
|
@ -46,11 +46,7 @@ class DocType:
|
||||
|
||||
#=======================================================================================================
|
||||
def get_page_lst(self,nm):
|
||||
|
||||
r1 = cstr(webnotes.user.get_roles()).replace('[','').replace(']','')
|
||||
|
||||
ret = sql("select parent from `tabPage Role` where role in (%s) and parent = '%s'"%(r1,nm))
|
||||
|
||||
ret = sql("select parent from `tabPage Role` where role in ('%s') and parent = '%s'" % ("','".join(webnotes.user.get_roles()),nm))
|
||||
return ret and True or False
|
||||
|
||||
#=======================================================================================================
|
||||
|
@ -97,7 +97,8 @@ class DocType:
|
||||
from webnotes.utils import file_manager
|
||||
fn, content = file_manager.get_file(fid)
|
||||
|
||||
if not type(content) == str:
|
||||
# NOTE: Don't know why this condition exists
|
||||
if not isinstance(content, basestring) and hasattr(content, 'tostring'):
|
||||
content = content.tostring()
|
||||
|
||||
return content
|
||||
|
@ -17,12 +17,16 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||
if(doc.__islocal && doc.customer) cur_frm.cscript.pull_item_details_onload(doc,dt,dn);
|
||||
if(!doc.price_list_currency) {
|
||||
set_multiple(dt, dn, {price_list_currency: doc.currency, plc_conversion_rate:1});
|
||||
}
|
||||
}
|
||||
if(!doc.posting_time) doc.posting_time = wn.datetime.get_cur_time()
|
||||
|
||||
if(doc.__islocal){
|
||||
hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
|
||||
}
|
||||
|
||||
// defined in sales_common.js
|
||||
//cur_frm.cscript.update_item_details(doc, cdt, cdn);
|
||||
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
||||
|
@ -100,8 +100,18 @@ class DocType(TransactionBase):
|
||||
# ================================================================================
|
||||
|
||||
# ***************** Get Item Details ******************************
|
||||
def get_item_details(self, item_code):
|
||||
def get_item_details(self, item_code=None):
|
||||
if item_code:
|
||||
return get_obj('Sales Common').get_item_details(item_code, self)
|
||||
else:
|
||||
obj = get_obj('Sales Common')
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
ret = obj.get_item_details(doc.item_code, self)
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
|
||||
# *** Re-calculates Basic Rate & amount based on Price List Selected ***
|
||||
def get_adj_percent(self, arg=''):
|
||||
|
@ -20,6 +20,8 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
|
||||
if(doc.supplier) unhide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
|
||||
|
||||
// defined in purchase_common.js
|
||||
cur_frm.cscript.update_item_details(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
||||
@ -237,7 +239,7 @@ cur_frm.cscript['Make Purchase Invoice'] = function() {
|
||||
'from_doctype': cur_frm.doc.doctype,
|
||||
'to_doctype':'Payable Voucher',
|
||||
'from_docname': cur_frm.doc.name,
|
||||
'from_to_list':"[['Purchase Receipt','Payable Voucher'],['Purchase Receipt Detail','PV Detail']]"
|
||||
'from_to_list':"[['Purchase Receipt','Payable Voucher'],['Purchase Receipt Detail','PV Detail'],['Purchase Tax Detail','Purchase Tax Detail']]"
|
||||
}, function(r,rt) {
|
||||
loaddoc('Payable Voucher', n);
|
||||
}
|
||||
|
@ -46,7 +46,22 @@ class DocType(TransactionBase):
|
||||
|
||||
# Get Item Details
|
||||
def get_item_details(self, arg = ''):
|
||||
if arg:
|
||||
return get_obj(dt='Purchase Common').get_item_details(self,arg)
|
||||
else:
|
||||
import json
|
||||
obj = get_obj('Purchase Common')
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
temp = {
|
||||
'item_code': doc.fields.get('item_code'),
|
||||
'warehouse': doc.fields.get('warehouse')
|
||||
}
|
||||
ret = obj.get_item_details(self, json.dumps(temp))
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
|
||||
# Get UOM Details
|
||||
def get_uom_details(self, arg = ''):
|
||||
|
@ -25,7 +25,8 @@ class DocType:
|
||||
from webnotes.utils import file_manager
|
||||
fn, content = file_manager.get_file(filename[1])
|
||||
|
||||
if not type(content) == str:
|
||||
# NOTE: Don't know why this condition exists
|
||||
if not isinstance(content, basestring) and hasattr(content, 'tostring'):
|
||||
content = content.tostring()
|
||||
|
||||
return content
|
||||
|
@ -107,7 +107,7 @@ class DocType:
|
||||
prev_sle = bin_obj.get_prev_sle(posting_date, posting_time)
|
||||
if not prev_sle:
|
||||
return 0.0
|
||||
fcfs_stack = eval(prev_sle.get('fcfs_stack', '[]'))
|
||||
fcfs_stack = eval(str(prev_sle.get('fcfs_stack', '[]')))
|
||||
in_rate = fcfs_stack and self.get_fifo_rate(fcfs_stack) or 0
|
||||
elif val_method == 'Moving Average':
|
||||
prev_sle = bin_obj.get_prev_sle(posting_date, posting_time)
|
||||
|
@ -1,4 +1,5 @@
|
||||
import webnotes
|
||||
from webnotes.utils import cstr
|
||||
|
||||
from webnotes.utils.email_lib.receive import POP3Mailbox
|
||||
|
||||
@ -111,7 +112,7 @@ class SupportMailbox(POP3Mailbox):
|
||||
status = add_file_list('Support Ticket', doc.name, attachment['filename'], fid)
|
||||
if not status:
|
||||
doc.description = doc.description \
|
||||
+ "\nCould not attach: " + str(attachment['filename'])
|
||||
+ "\nCould not attach: " + cstr(attachment['filename'])
|
||||
doc.save()
|
||||
webnotes.conn.commit()
|
||||
|
||||
@ -137,7 +138,7 @@ We will get back to you as soon as possible
|
||||
sendmail(\
|
||||
recipients = [d.raised_by], \
|
||||
sender = self.email_settings.support_email, \
|
||||
subject = '['+d.name+'] ' + str(d.subject or ''), \
|
||||
subject = '['+d.name+'] ' + cstr(d.subject), \
|
||||
msg = response)
|
||||
|
||||
def auto_close_tickets(self):
|
||||
|
@ -24,7 +24,7 @@ class DocType(TransactionBase):
|
||||
response = self.doc.new_response + '\n\n[Please do not change the subject while responding.]'
|
||||
|
||||
# add last response to new response
|
||||
response += unicode(self.last_response(), 'utf-8')
|
||||
response += self.last_response()
|
||||
|
||||
signature = webnotes.conn.get_value('Email Settings',None,'support_signature')
|
||||
if signature:
|
||||
@ -36,7 +36,7 @@ class DocType(TransactionBase):
|
||||
recipients = [self.doc.raised_by], \
|
||||
sender=webnotes.conn.get_value('Email Settings',None,'support_email'), \
|
||||
subject=subject, \
|
||||
msg=response.encode('utf-8'))
|
||||
msg=response)
|
||||
|
||||
self.doc.new_response = None
|
||||
webnotes.conn.set(self.doc,'status','Waiting for Customer')
|
||||
|
@ -76,7 +76,8 @@ class DocType:
|
||||
from webnotes.utils import file_manager
|
||||
fn, content = file_manager.get_file(fid)
|
||||
|
||||
if not type(content) == str:
|
||||
# NOTE: Don't know why this condition exists
|
||||
if not isinstance(content, basestring) and hasattr(content, 'tostring'):
|
||||
content = content.tostring()
|
||||
|
||||
return content
|
||||
|
79
index.html
Normal file
79
index.html
Normal file
@ -0,0 +1,79 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>ERPNext</title>
|
||||
<meta name="author" content="">
|
||||
<script type="text/javascript">window._version_number="146"
|
||||
|
||||
wn={}
|
||||
wn.provide=function(namespace){var nsl=namespace.split('.');var l=nsl.length;var parent=window;for(var i=0;i<l;i++){var n=nsl[i];if(!parent[n]){parent[n]={}}
|
||||
parent=parent[n];}}
|
||||
wn.provide('wn.settings');wn.provide('wn.ui');wn.xmlhttp={request:function(){if(window.XMLHttpRequest)
|
||||
return new XMLHttpRequest();else if(window.ActiveXObject)
|
||||
return new ActiveXObject("MsXml2.XmlHttp");},complete:function(req,callback,url){if(req.status==200||req.status==304){callback(req.responseText);}else{alert(url+' request error: '+req.statusText+' ('+req.status+')');}},get:function(url,callback,args,async){if(async===null)async=true;var req=wn.xmlhttp.request();req.onreadystatechange=function(){if(req.readyState==4){wn.xmlhttp.complete(req,callback,url)}}
|
||||
var sep=((args&&args.indexOf('?'))==-1)?'?':'&';var u=args?(url+sep+args):url;req.open('GET',u,async);req.send(null);if(!async){wn.xmlhttp.complete(req,callback,url)}}}
|
||||
wn.versions={check:function(){if(localStorage){if(window._version_number==-1||parseInt(localStorage._version_number)!=parseInt(window._version_number)){localStorage.clear();}
|
||||
localStorage.setItem('_version_number',window._version_number);}}}
|
||||
wn.assets={executed_:{},exists:function(src){if('localStorage'in window&&localStorage.getItem(src))
|
||||
return true},add:function(src,txt){if('localStorage'in window){localStorage.setItem(src,txt);}},get:function(src){return localStorage.getItem(src);},extn:function(src){if(src.indexOf('?')!=-1){src=src.split('?').slice(-1)[0];}
|
||||
return src.split('.').slice(-1)[0];},html_src:function(src){if(src.indexOf('/')!=-1){var t=src.split('/').slice(0,-1);t.push('src');t=t.join('/')+'/'+a.split('/').slice(-1)[0];}else{var t='src/'+src;}
|
||||
return t;},load:function(src){var t=wn.assets.extn(src)=='html'?wn.assets.html_src(src):src;wn.xmlhttp.get(t,function(txt){wn.assets.add(src,txt);},'q='&Math.floor(Math.random()*1000),false)},execute:function(src){if(!wn.assets.exists(src)){wn.assets.load(src);}
|
||||
var type=wn.assets.extn(src);if(wn.assets.handler[type]){wn.assets.handler[type](wn.assets.get(src),src);wn.assets.executed_[src]=1;}},handler:{js:function(txt,src){wn.dom.eval(txt);},css:function(txt,src){var se=document.createElement('style');se.type="text/css";if(se.styleSheet){se.styleSheet.cssText=txt;}else{se.appendChild(document.createTextNode(txt));}
|
||||
document.getElementsByTagName('head')[0].appendChild(se);},html:function(txt,src){var page=wn.dom.add($('.outer .inner').get(0),'div','content',null,txt);page.setAttribute("_src",src);},cgi:function(txt,src){wn.dom.eval(txt)}}}
|
||||
wn.require=function(items){if(typeof items==="string"){items=[items];}
|
||||
var l=items.length;for(var i=0;i<l;i++){var src=items[i];if(!(src in wn.assets.executed_)){wn.assets.execute(src);}}}
|
||||
wn.provide('wn.dom');wn.dom.by_id=function(id){return document.getElementById(id);}
|
||||
wn.dom.eval=function(txt){var el=document.createElement('script');el.appendChild(document.createTextNode(txt));document.getElementsByTagName('head')[0].appendChild(el);}
|
||||
wn.dom.add=function(parent,newtag,className,cs,innerHTML,onclick){if(parent&&parent.substr)parent=wn.dom.by_id(parent);var c=document.createElement(newtag);if(parent)
|
||||
parent.appendChild(c);if(className){if(newtag.toLowerCase()=='img')
|
||||
c.src=className
|
||||
else
|
||||
c.className=className;}
|
||||
if(cs)wn.dom.css(c,cs);if(innerHTML)c.innerHTML=innerHTML;if(onclick)c.onclick=onclick;return c;}
|
||||
wn.dom.css=function(ele,s){if(ele&&s){for(var i in s)ele.style[i]=s[i];};return ele;}
|
||||
wn.dom.hide=function(ele){ele.style.display='none';}
|
||||
wn.dom.show=function(ele,value){if(!value)value='block';ele.style.display=value;}
|
||||
wn.page={set:function(src){var new_selection=$('.inner div.content[_src="'+src+'"]');if(!new_selection.length){wn.assets.execute(src);new_selection=$('.inner div.content[_src="'+src+'"]');}
|
||||
$('.inner .current_page').removeClass('current_page');new_selection.addClass('current_page');var title=$('nav ul li a[href*="'+src+'"]').attr('title')||'No Title'
|
||||
state=window.location.hash;if(state!=src){window.location.hash=state;}
|
||||
else{document.title=title;}}}
|
||||
var JSON;if(!JSON){JSON={};}
|
||||
(function(){"use strict";function f(n){return n<10?'0'+n:n;}
|
||||
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
|
||||
f(this.getUTCMonth()+1)+'-'+
|
||||
f(this.getUTCDate())+'T'+
|
||||
f(this.getUTCHours())+':'+
|
||||
f(this.getUTCMinutes())+':'+
|
||||
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
|
||||
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
|
||||
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
|
||||
if(typeof rep==='function'){value=rep.call(holder,key,value);}
|
||||
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
|
||||
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
|
||||
v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}
|
||||
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==='string'){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
|
||||
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
|
||||
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
|
||||
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
|
||||
return str('',{'':value});};}
|
||||
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
|
||||
return reviver.call(holder,key,value);}
|
||||
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
|
||||
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
|
||||
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
|
||||
throw new SyntaxError('JSON.parse');};}}());wn.versions.check();wn.require("lib/js/lib/jquery.min.js");wn.require("lib/js/lib/history/history.min.js");$(document).bind('ready',function(){var base=window.location.href.split('#')[0];$.each($('a[softlink!="false"]'),function(i,v){if(v.href.substr(0,base.length)==base){var path=(v.href.substr(base.length));if(path.substr(0,1)!='#'){v.href=base+'#'+path;}}});if(!wn.settings.no_history&&window.location.hash){wn.page.set(window.location.hash.substr(1));}});</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="startup_div" style="padding: 8px; font-size: 14px;"></div>
|
||||
|
||||
<!-- Main Starts -->
|
||||
<div id="body_div">
|
||||
|
||||
<!--static (no script) content-->
|
||||
<div class="no_script" style='font-family: verdana, sans'>
|
||||
Loading...
|
||||
</div>
|
||||
</div>
|
||||
<script>wn.require('js/app.js');</script>
|
||||
<div id="dialog_back"></div>
|
||||
</body>
|
Loading…
x
Reference in New Issue
Block a user