fixed conflict

This commit is contained in:
Nabin Hait 2012-05-31 11:49:37 +05:30
commit 0908b2709b
37 changed files with 490 additions and 223 deletions

View File

@ -421,8 +421,8 @@ class DocType(TransactionBase):
raise Exception raise Exception
def validate_pos(self): def validate_pos(self):
if not self.doc.cash_bank_account: if not self.doc.cash_bank_account and flt(self.doc.paid_amount):
msgprint("Cash/Bank Account is mandatory for POS entry") msgprint("Cash/Bank Account is mandatory for POS, for making payment entry")
raise Exception raise Exception
if (flt(self.doc.paid_amount) + flt(self.doc.write_off_amount) - round(flt(self.doc.grand_total), 2))>0.001: if (flt(self.doc.paid_amount) + flt(self.doc.write_off_amount) - round(flt(self.doc.grand_total), 2))>0.001:
msgprint("(Paid amount + Write Off Amount) can not be greater than Grand Total") msgprint("(Paid amount + Write Off Amount) can not be greater than Grand Total")
@ -676,8 +676,14 @@ class DocType(TransactionBase):
if not d.warehouse: if not d.warehouse:
d.warehouse = cstr(w) d.warehouse = cstr(w)
if flt(self.doc.paid_amount) == 0: if flt(self.doc.paid_amount) == 0:
webnotes.conn.set(self.doc,'paid_amount',(flt(self.doc.grand_total) - flt(self.doc.write_off_amount))) if self.doc.cash_bank_account:
webnotes.conn.set(self.doc, 'paid_amount',
(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
else:
# show message that the amount is not paid
webnotes.conn.set(self.doc,'paid_amount',0)
webnotes.msgprint("Note: Payment Entry not created since 'Cash/Bank Account' was not specified.")
else: else:
webnotes.conn.set(self.doc,'paid_amount',0) webnotes.conn.set(self.doc,'paid_amount',0)

View File

@ -407,9 +407,21 @@ class DocType(TransactionBase):
if not default_currency: if not default_currency:
msgprint('Message: Please enter default currency in Company Master') msgprint('Message: Please enter default currency in Company Master')
raise Exception raise Exception
if (obj.doc.currency == default_currency and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != default_currency and flt(obj.doc.conversion_rate) == 1.00):
msgprint("Message: Please Enter Appropriate Conversion Rate.") if obj.doc.conversion_rate == 0:
raise Exception msgprint('Conversion Rate cannot be 0', raise_exception=1)
elif not obj.doc.conversion_rate:
msgprint('Please specify Conversion Rate', raise_exception=1)
elif obj.doc.currency == default_currency and \
flt(obj.doc.conversion_rate) != 1.00:
msgprint("""Conversion Rate should be equal to 1.00, \
since the specified Currency and the company's currency \
are same""", raise_exception=1)
elif obj.doc.currency != default_currency and \
flt(obj.doc.conversion_rate) == 1.00:
msgprint("""Conversion Rate should not be equal to 1.00, \
since the specified Currency and the company's currency \
are different""", raise_exception=1)
def validate_doc(self, obj, prevdoc_doctype, prevdoc_docname): def validate_doc(self, obj, prevdoc_doctype, prevdoc_docname):
if prevdoc_docname : if prevdoc_docname :

View File

@ -105,47 +105,48 @@ cur_frm.cscript.make_contact = function() {
cur_frm.contact_list.run(); cur_frm.contact_list.run();
} }
// make purchase order list
cur_frm.cscript.make_po_list = function(parent, doc){
wn.require('js/listing.js');
var lst = new Listing();
lst.colwidths = ['5%','25%','20%','25%','25%'];
lst.colnames = ['Sr.','Id','Status','PO Date','Grand Total'];
lst.coltypes = ['Data','Link','Data','Data','Currency'];
lst.coloptions = ['','Purchase Order','','','',''];
var q = repl("select name,status,transaction_date, grand_total from `tabPurchase Order` where supplier='%(sup)s' order by transaction_date desc", {'sup':doc.name}); // Transaction History
var q_max = repl("select count(name) from `tabPurchase Order` where supplier='%(sup)s'", {'sup':doc.name});
cur_frm.cscript.make_po_list = function(parent, doc) {
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Order','Purchase Order'); cur_frm.cscript.render_transaction_history(parent, doc, 'Purchase Order',
[
{fieldname: 'name', width: '28%', label: 'Id', type: 'Link'},
{fieldname: 'status', width: '25%', label: 'Status', type: 'Data'},
{fieldname: 'modified', width: '12%', label: 'Last Modified On',
type: 'Date', style: 'text-align: right; color: #777'},
{fieldname: 'currency', width: '0%', label: 'Currency',
style: 'display: hidden'},
{fieldname: 'grand_total', width: '35%', label: 'Grand Total',
type: 'Currency', style: 'text-align: right'},
]);
} }
// make purchase receipt list cur_frm.cscript.make_pr_list = function(parent, doc) {
cur_frm.cscript.make_pr_list = function(parent,doc){ cur_frm.cscript.render_transaction_history(parent, doc, 'Purchase Receipt',
wn.require('js/listing.js'); [
var lst = new Listing(); {fieldname: 'name', width: '28%', label: 'Id', type: 'Link'},
lst.colwidths = ['5%','20%','20%','20%','15%','20%']; {fieldname: 'status', width: '15%', label: 'Status', type: 'Data'},
lst.colnames = ['Sr.','Id','Status','Receipt Date','% Billed','Grand Total']; {fieldname: 'per_billed', width: '10%', label: '% Billed',
lst.coltypes = ['Data','Link','Data','Data','Currency','Currency']; type: 'Percentage', style: 'text-align: right'},
lst.coloptions = ['','Purchase Receipt','','','','']; {fieldname: 'modified', width: '12%', label: 'Last Modified On',
type: 'Date', style: 'text-align: right; color: #777'},
var q = repl("select name,status,transaction_date,per_billed,grand_total from `tabPurchase Receipt` where supplier='%(sup)s' order by transaction_date desc", {'sup':doc.name}); {fieldname: 'currency', width: '0%', label: 'Currency',
var q_max = repl("select count(name) from `tabPurchase Receipt` where supplier='%(sup)s'", {'sup':doc.name}); style: 'display: hidden'},
{fieldname: 'grand_total', width: '35%', label: 'Grand Total',
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Receipt','Purchase Receipt'); type: 'Currency', style: 'text-align: right'},
]);
} }
// make purchase invoice list cur_frm.cscript.make_pi_list = function(parent, doc) {
cur_frm.cscript.make_pi_list = function(parent,doc){ cur_frm.cscript.render_transaction_history(parent, doc, 'Purchase Invoice',
wn.require('js/listing.js'); [
var lst = new Listing(); {fieldname: 'name', width: '30%', label: 'Id', type: 'Link'},
lst.colwidths = ['5%','20%','20%','20%','15%','20%']; {fieldname: 'modified', width: '35%', label: 'Last Modified On',
lst.colnames = ['Sr.','Id','Posting Date','Credit To','Bill Date','Grand Total']; type: 'Date', style: 'text-align: right; color: #777'},
lst.coltypes = ['Data','Link','Data','Data','Currency','Currency']; {fieldname: 'currency', width: '0%', label: 'Currency',
lst.coloptions = ['','Purchase Invoice','','','','']; style: 'display: hidden'},
{fieldname: 'grand_total', width: '35%', label: 'Grand Total',
var q = repl("select name, posting_date, credit_to, bill_date, grand_total from `tabPurchase Invoice` where supplier='%(sup)s' order by posting_date desc", {'sup':doc.name}); type: 'Currency', style: 'text-align: right'},
var q_max = repl("select count(name) from `tabPurchase Invoice` where supplier='%(sup)s'", {'sup':doc.name}); ]);
}
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Invoice','Purchase Invoice');
}

View File

@ -1,6 +1,6 @@
import webnotes import webnotes
import conf import conf
from webnotes.model import rename, delete_doc import webnotes.model
from webnotes.model.code import get_obj from webnotes.model.code import get_obj
from wnf import replace_code from wnf import replace_code
from termcolor import colored from termcolor import colored
@ -150,10 +150,13 @@ def rename_in_db(ren_data, data_type, is_doctype):
print colored('Renaming... ' + d + ' --> '+ ren_data[d], 'yellow') print colored('Renaming... ' + d + ' --> '+ ren_data[d], 'yellow')
#rename #rename
try: try:
rename(data_type, d, ren_data[d], is_doctype) webnotes.model.rename(data_type, d, ren_data[d], is_doctype)
except Exception, e: except Exception, e:
print e if e.args[0]!=1050:
pass raise e
else:
print e
pass
def update_dt_in_records(rendt): def update_dt_in_records(rendt):

View File

@ -0,0 +1,22 @@
def execute():
"""Make profile readonly for role All"""
import webnotes.model.doc
webnotes.conn.sql("delete from `tabDocPerm` where parent='Profile' and role='All'")
new_perms = [
{
'parent': 'Profile',
'parentfield': 'permissions',
'parenttype': 'DocType',
'role': 'All',
'permlevel': 0,
'read': 1,
},
]
for perms in new_perms:
doc = webnotes.model.doc.Document('DocPerm')
doc.fields.update(perms)
doc.save()
webnotes.conn.commit()
webnotes.conn.begin()
import webnotes.model.sync
webnotes.model.sync.sync('core', 'profile')

View File

@ -0,0 +1,4 @@
def execute():
import webnotes
import webnotes.modules
webnotes.modules.reload_doc('selling', 'search_criteria', 'customer_address_contact')

View File

@ -0,0 +1,17 @@
def execute():
"""
* Replace EURO with EUR
* Delete EURO from tabCurrency
"""
import webnotes
tables = webnotes.conn.sql("show tables")
for (tab,) in tables:
desc = webnotes.conn.sql("desc `%s`" % tab, as_dict=1)
for d in desc:
if "currency" in d.get('Field'):
field = d.get('Field')
webnotes.conn.sql("""\
update `%s` set `%s`='EUR'
where `%s`='EURO'""" % (tab, field, field))
webnotes.conn.sql("update `tabSingles` set value='EUR' where value='EURO'")
webnotes.conn.sql("delete from `tabCurrency` where name='EURO'")

View File

@ -227,16 +227,16 @@ patch_list = [
'patch_file': 'so_rv_mapper_fix', 'patch_file': 'so_rv_mapper_fix',
'description': 'SO-RV duplicate mapper entry removal' 'description': 'SO-RV duplicate mapper entry removal'
}, },
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'sync_ref_db',
'description': 'Deletes non required doctypes'
},
{ {
'patch_module': 'patches.mar_2012', 'patch_module': 'patches.mar_2012',
'patch_file': 'clean_property_setter', 'patch_file': 'clean_property_setter',
'description': 'Patch related to property setter cleanup' 'description': 'Patch related to property setter cleanup'
}, },
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'sync_ref_db',
'description': 'Deletes non required doctypes'
},
{ {
'patch_module': 'patches.april_2012', 'patch_module': 'patches.april_2012',
'patch_file': 'naming_series_patch', 'patch_file': 'naming_series_patch',
@ -392,5 +392,19 @@ patch_list = [
'patch_file': 'create_report_manager_role', 'patch_file': 'create_report_manager_role',
'description': 'Create report manager role if not exists' 'description': 'Create report manager role if not exists'
}, },
{
'patch_module': 'patches.may_2012',
'patch_file': 'reload_customer_address_contact',
'description': 'Reload report customer address contact'
},
{
'patch_module': 'patches.may_2012',
'patch_file': 'profile_perm_patch',
'description': 'Make profile readonly for role All'
},
{
'patch_module': 'patches.may_2012',
'patch_file': 'remove_euro_currency',
'description': 'Remove EURO currency and replace with EUR'
},
] ]

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-03-27 14:36:05', 'creation': '2012-05-15 12:14:48',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-03-27 14:45:50', 'modified': '2012-05-28 19:03:56',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
@ -23,7 +23,7 @@
'section_style': u'Tabbed', 'section_style': u'Tabbed',
'server_code_error': u' ', 'server_code_error': u' ',
'show_in_menu': 0, 'show_in_menu': 0,
'version': 190 'version': 1
}, },
# These values are common for all DocField # These values are common for all DocField
@ -323,6 +323,7 @@
'fieldname': u'produced_qty', 'fieldname': u'produced_qty',
'fieldtype': u'Currency', 'fieldtype': u'Currency',
'label': u'Produced Qty', 'label': u'Produced Qty',
'no_copy': 1,
'oldfieldname': u'produced_qty', 'oldfieldname': u'produced_qty',
'oldfieldtype': u'Currency', 'oldfieldtype': u'Currency',
'permlevel': 1 'permlevel': 1

View File

@ -141,114 +141,64 @@ cur_frm.fields_dict['lead_name'].get_query = function(doc,dt,dn){
return 'SELECT `tabLead`.`name` FROM `tabLead` WHERE `tabLead`.`status`!="Converted" AND `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50'; return 'SELECT `tabLead`.`name` FROM `tabLead` WHERE `tabLead`.`status`!="Converted" AND `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50';
} }
/* ********************************* transaction history ************************************** */
cur_frm.render_transaction_history_row = function(data) { // Transaction History
data.grand_total = fmt_money(data.grand_total); // functions called by these functions are defined in contact_control.js
data.modified = wn.datetime.only_date(data.modified); cur_frm.cscript.make_qtn_list = function(parent, doc) {
return repl('\ cur_frm.cscript.render_transaction_history(parent, doc, 'Quotation',
<table><tr> \ [
<td width="30%" title="Id"> \ {fieldname: 'name', width: '28%', label: 'Id', type: 'Link'},
<a href="#!Form/%(doctype)s/%(name)s">%(name)s</a> \ {fieldname: 'status', width: '25%', label: 'Status', type: 'Data'},
</td> \ {fieldname: 'modified', width: '12%', label: 'Last Modified On',
<td width="20%" title="Status">%(status)s</td> \ type: 'Date', style: 'text-align: right; color: #777'},
<td width="30%" title="Grand Total" style="text-align: right;"> \ {fieldname: 'currency', width: '0%', label: 'Currency',
%(currency)s %(grand_total)s \ style: 'display: hidden'},
</td> \ {fieldname: 'grand_total', width: '35%', label: 'Grand Total',
<td width="20%" title="Modified Date" style="text-align: right;"> \ type: 'Currency', style: 'text-align: right'},
%(modified)s \ ]);
</td> \
</tr></table>', data);
} }
cur_frm.get_query_transaction_history = function(args) { cur_frm.cscript.make_so_list = function(parent, doc) {
return repl("\ cur_frm.cscript.render_transaction_history(parent, doc, 'Sales Order',
select name, status, modified, currency, \ [
grand_total \ {fieldname: 'name', width: '28%', label: 'Id', type: 'Link'},
from `tab%(doctype)s` \ {fieldname: 'status', width: '25%', label: 'Status', type: 'Data'},
where customer='%(customer)s' \ {fieldname: 'modified', width: '12%', label: 'Last Modified On',
order by modified desc", args); type: 'Date', style: 'text-align: right; color: #777'},
{fieldname: 'currency', width: '0%', label: 'Currency',
style: 'display: hidden'},
{fieldname: 'grand_total', width: '35%', label: 'Grand Total',
type: 'Currency', style: 'text-align: right'},
]);
} }
cur_frm.render_transaction_history = function(parent, doc, doctype, get_query, render_row) { cur_frm.cscript.make_dn_list = function(parent, doc) {
$(parent).css({ cur_frm.cscript.render_transaction_history(parent, doc, 'Delivery Note',
'padding-top': '10px', [
}); {fieldname: 'name', width: '28%', label: 'Id', type: 'Link'},
{fieldname: 'status', width: '25%', label: 'Status', type: 'Data'},
cur_frm.transaction_list = new wn.ui.Listing({ {fieldname: 'modified', width: '12%', label: 'Last Modified On',
parent: parent, type: 'Date', style: 'text-align: right; color: #777'},
page_length: 10, {fieldname: 'currency', width: '0%', label: 'Currency',
get_query: get_query || function() { style: 'display: hidden'},
return cur_frm.get_query_transaction_history({ {fieldname: 'grand_total', width: '35%', label: 'Grand Total',
customer: doc.name, type: 'Currency', style: 'text-align: right'},
doctype: doctype, ]);
});
},
as_dict: 1,
no_result_message: repl('No %(doctype)s created for this customer', { doctype: doctype }),
render_row: function(wrapper, data) {
data.doctype = doctype;
render_html = render_row
? render_row(data)
: cur_frm.render_transaction_history_row(data);
$(wrapper).html(render_html);
},
});
cur_frm.transaction_list.run();
}
// --------------------
// make quotation list
// --------------------
cur_frm.cscript.make_qtn_list = function(parent,doc){
cur_frm.render_transaction_history(parent, doc, 'Quotation');
}
// -------------
// make so list
// -------------
cur_frm.cscript.make_so_list = function(parent,doc){
cur_frm.render_transaction_history(parent, doc, 'Sales Order');
} }
// ------------- cur_frm.cscript.make_si_list = function(parent, doc) {
// make dn list cur_frm.cscript.render_transaction_history(parent, doc, 'Sales Invoice',
// ------------- [
cur_frm.cscript.make_dn_list = function(parent,doc){ {fieldname: 'name', width: '28%', label: 'Id', type: 'Link'},
cur_frm.render_transaction_history(parent, doc, 'Delivery Note'); {fieldname: 'outstanding_amount', width: '25%',
} label: 'Outstanding Amount',
type: 'Currency', style: 'text-align: right; color: #777'},
// ------------- {fieldname: 'modified', width: '12%', label: 'Last Modified On',
// make si list type: 'Date', style: 'text-align: right; color: #777'},
// ------------- {fieldname: 'currency', width: '0%', label: 'Currency',
cur_frm.cscript.make_si_list = function(parent,doc){ style: 'display: hidden'},
cur_frm.render_transaction_history(parent, doc, 'Sales Invoice', function() { {fieldname: 'grand_total', width: '35%', label: 'Grand Total',
return repl("\ type: 'Currency', style: 'text-align: right'},
select name, outstanding_amount, modified, currency, \ ]);
grand_total \ }
from `tab%(doctype)s` \
where customer='%(customer)s' \
order by modified desc", { doctype: 'Sales Invoice', customer: doc.name });
}, function(data) {
data.grand_total = fmt_money(data.grand_total);
data.modified = wn.datetime.only_date(data.modified);
data.outstanding_amount = fmt_money(data.outstanding_amount);
return repl('\
<table><tr> \
<td width="30%" title="Id"> \
<a href="#!Form/%(doctype)s/%(name)s">%(name)s</a> \
</td> \
<td width="20%" title="Outstanding Amount" \
style="text-align: right; color: #777"> \
%(currency)s %(outstanding_amount)s \
</td>\
<td width="30%" title="Grand Total" style="text-align: right;"> \
%(currency)s %(grand_total)s\
</td> \
<td width="20%" title="Modified Date" style="text-align: right;"> \
%(modified)s \
</td> \
</tr></table>', data);
});
}

View File

@ -207,21 +207,32 @@ class DocType(TransactionBase):
if default: add_cond = 'ifnull(t2.is_default,0) = 1' if default: add_cond = 'ifnull(t2.is_default,0) = 1'
else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"' else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"'
idx = 0 idx = 0
other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate, t1.cost_center_other_charges from `tabSales Taxes and Charges` t1, `tabSales Taxes and Charges Master` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1) other_charge = webnotes.conn.sql("""\
select t1.*
from
`tabSales Taxes and Charges` t1,
`tabSales Taxes and Charges Master` t2
where
t1.parent = t2.name and
t2.company = '%s' and
%s
order by t1.idx""" % (obj.doc.company, add_cond), as_dict=1)
from webnotes.model import default_fields
for other in other_charge: for other in other_charge:
d = addchild(obj.doc, 'other_charges', 'Sales Taxes and Charges', 1, obj.doclist) # remove default fields like parent, parenttype etc.
d.charge_type = other['charge_type'] # from query results
d.row_id = other['row_id'] for field in default_fields:
d.description = other['description'] if field in other: del other[field]
d.account_head = other['account_head']
d.cost_center_other_charges = other['cost_center_other_charges'] d = addchild(obj.doc, 'other_charges', 'Sales Taxes and Charges', 1,
d.rate = flt(other['rate']) obj.doclist)
d.tax_amount = flt(other['tax_amount']) d.fields.update(other)
d.included_in_print_rate = cint(other['included_in_print_rate']) d.rate = flt(d.rate)
d.tax_amount = flt(d.tax_rate)
d.included_in_print_rate = cint(d.included_in_print_rate)
d.idx = idx d.idx = idx
idx += 1 idx += 1
# Get TERMS AND CONDITIONS # Get TERMS AND CONDITIONS
# ======================================================================================= # =======================================================================================
def get_tc_details(self,obj): def get_tc_details(self,obj):
@ -352,8 +363,10 @@ class DocType(TransactionBase):
if self.has_sales_bom(d.item_code): if self.has_sales_bom(d.item_code):
for p in getlist(obj.doclist, 'packing_details'): for p in getlist(obj.doclist, 'packing_details'):
if p.parent_item == d.item_code: #if p.parent_item == d.item_code: -- this fails when item with same name appears more than once in delivery note item table
il.append([warehouse, p.item_code, flt(p.qty)*qty, flt(p.qty)* reserved_qty, p.uom, p.batch_no, p.serial_no]) if p.parent_detail_docname == d.name:
# the packing details table's qty is already multiplied with parent's qty
il.append([warehouse, p.item_code, flt(p.qty), (flt(p.qty)/qty)*(reserved_qty), p.uom, p.batch_no, p.serial_no])
else: else:
il.append([warehouse, d.item_code, qty, reserved_qty, d.stock_uom, d.batch_no, d.serial_no]) il.append([warehouse, d.item_code, qty, reserved_qty, d.stock_uom, d.batch_no, d.serial_no])
return il return il
@ -424,6 +437,10 @@ class DocType(TransactionBase):
pi.serial_no = cstr(line.serial_no) pi.serial_no = cstr(line.serial_no)
pi.batch_no = cstr(line.batch_no) pi.batch_no = cstr(line.batch_no)
pi.idx = self.packing_list_idx pi.idx = self.packing_list_idx
# has to be saved, since this function is called on_update of delivery note
pi.save()
self.packing_list_idx += 1 self.packing_list_idx += 1

View File

@ -0,0 +1,22 @@
col_defs = [
{'label': 'Id', 'type': 'Link', 'width': '', 'options': 'Customer'},
{'label': 'Customer Name'},
{'label': 'Address Line 1', 'width': '200px'},
{'label': 'Address Line 2', 'width': '200px'},
{'label': 'City'},
{'label': 'State'},
{'label': 'Pincode', 'width': '80px'},
{'label': 'Country', 'width': '100px'},
{'label': 'Contact First Name'},
{'label': 'Contact Last Name'},
{'label': 'Contact Phone', 'width': '100px'},
{'label': 'Contact Mobile', 'width': '100px'},
{'label': 'Contact Email'},
]
webnotes.msgprint(colnames)
for col in col_defs:
colnames.append(col['label'])
coltypes.append(col.get('type') or 'Data')
colwidths.append(col.get('width') or '150px')
coloptions.append(col.get('options') or '')
col_idx[col['label']] = len(colnames) - 1

View File

@ -0,0 +1,26 @@
select
`tabCustomer`.name,
`tabCustomer`.customer_name,
`tabAddress`.address_line1,
`tabAddress`.address_line2,
`tabAddress`.city,
`tabAddress`.state,
`tabAddress`.pincode,
`tabAddress`.country,
`tabContact`.first_name,
`tabContact`.last_name,
`tabContact`.phone,
`tabContact`.mobile_no,
`tabContact`.email_id
from
`tabCustomer`
left join `tabAddress` on (
`tabAddress`.customer=`tabCustomer`.name and
ifnull(`tabAddress`.is_primary_address, 0)=1
)
left join `tabContact` on (
`tabContact`.customer=`tabCustomer`.name and
ifnull(`tabContact`.is_primary_contact, 0)=1
)
order by
`tabCustomer`.customer_name asc

View File

@ -3,18 +3,15 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-04-03 12:49:51', 'creation': '2012-04-17 11:29:10',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-04-03 12:49:51', 'modified': '2012-05-23 18:17:40',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
# These values are common for all Search Criteria # These values are common for all Search Criteria
{ {
'add_col': u"`tabAddress`.address_line1 AS 'Address Line 1'\n`tabAddress`.address_line2 AS 'Address Line 2'\n`tabAddress`.city AS 'City'\n`tabAddress`.state AS 'State'\n`tabAddress`.pincode AS 'Pincode'\n`tabAddress`.country AS 'Country'\n`tabContact`.first_name AS 'Contact First Name'\n`tabContact`.last_name AS 'Contact Last Name'\n`tabContact`.phone AS 'Contact Phone'\n`tabContact`.mobile_no AS 'Contact Mobile'\n`tabContact`.email_id AS 'Contact Email'",
'add_cond': u'`tabAddress`.customer=`tabCustomer`.name\nifnull(`tabAddress`.is_primary_address, 0)=1\n`tabContact`.customer=`tabCustomer`.name\nifnull(`tabContact`.is_primary_contact, 0)=1',
'add_tab': u'`tabAddress`\n`tabContact`',
'columns': u'Customer\x01ID,Customer\x01Customer Name', 'columns': u'Customer\x01ID,Customer\x01Customer Name',
'criteria_name': u'Customer Address Contact', 'criteria_name': u'Customer Address Contact',
'doc_type': u'Customer', 'doc_type': u'Customer',
@ -23,8 +20,6 @@
'module': u'Selling', 'module': u'Selling',
'name': '__common__', 'name': '__common__',
'page_len': 50, 'page_len': 50,
'sort_by': u'`tabCustomer`.`customer_name`',
'sort_order': u'ASC',
'standard': u'Yes' 'standard': u'Yes'
}, },

View File

@ -111,3 +111,80 @@ if(cur_frm.fields_dict['territory']){
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
} }
} }
// Transaction History related functions
cur_frm.cscript.render_transaction_history = function(parent, doc, doctype, args) {
$(parent).css({ 'padding-top': '10px' });
cur_frm.transaction_list = new wn.ui.Listing({
parent: parent,
page_length: 10,
get_query: function() {
return cur_frm.cscript.get_query_transaction_history({
parent: doc.doctype.toLowerCase(),
parent_name: doc.name,
doctype: doctype,
fields: (function() {
var fields = [];
for(var i in args) {
fields.push(args[i].fieldname);
}
return fields.join(", ");
})(),
});
},
as_dict: 1,
no_result_message: repl('No %(doctype)s created for this %(parent)s',
{ doctype: doctype, parent: doc.doctype }),
render_row: function(wrapper, data) {
render_html = cur_frm.cscript.render_transaction_history_row(data, args, doctype);
$(wrapper).html(render_html);
},
});
cur_frm.transaction_list.run();
}
cur_frm.cscript.render_transaction_history_row = function(data, args, doctype) {
var content = [];
var currency = data.currency;
for (var a in args) {
for (var d in data) {
if (args[a].fieldname === d && args[a].fieldname !== 'currency') {
if (args[a].type === 'Link') {
data[d] = repl('<a href="#!Form/%(doctype)s/%(name)s">\
%(name)s</a>', { doctype: doctype, name: data[d]});
} else if (args[a].type === 'Currency') {
data[d] = currency + " " + fmt_money(data[d]);
} else if (args[a].type === 'Percentage') {
data[d] = flt(data[d]) + '%';
} else if (args[a].type === 'Date') {
data[d] = wn.datetime.only_date(data[d]);
}
if (args[a].style == undefined) {
args[a].style = '';
}
data[d] = repl('\
<td width="%(width)s" title="%(title)s" style="%(style)s">\
%(content)s</td>',
{
content: data[d],
width: args[a].width,
title: args[a].label,
style: args[a].style,
});
content.push(data[d]);
break;
}
}
}
content = content.join("\n");
return '<table><tr>' + content + '</tr></table>';
}
cur_frm.cscript.get_query_transaction_history = function(args) {
var query = repl("\
select %(fields)s from `tab%(doctype)s` \
where %(parent)s = '%(parent_name)s' \
order by modified desc", args);
return query;
}

View File

@ -61,22 +61,40 @@ erpnext.module_page.hide_links = function(wrapper) {
erpnext.module_page.make_list = function(module, wrapper) { erpnext.module_page.make_list = function(module, wrapper) {
// make project listing // make project listing
wrapper.list = new wn.ui.Listing({ var $w = $(wrapper).find('.reports-list');
parent: $(wrapper).find('.reports-list').get(0), var $parent1 = $('<div style="width: 45%; float: left; margin-right: 4.5%"></div>').appendTo($w);
method: 'utilities.get_report_list', var $parent2 = $('<div style="width: 45%; float: left;"></div>').appendTo($w);
wrapper.list1 = new wn.ui.Listing({
parent: $parent1,
method: 'utilities.get_sc_list',
render_row: function(row, data) { render_row: function(row, data) {
if(!data.parent_doc_type) data.parent_doc_type = data.doc_type; if(!data.parent_doc_type) data.parent_doc_type = data.doc_type;
$(row).html(repl('<a href="#!Report/%(doc_type)s/%(criteria_name)s" \ $(row).html(repl('<a href="#!Report/%(doc_type)s/%(criteria_name)s" \
data-doctype="%(parent_doc_type)s">\ data-doctype="%(parent_doc_type)s">\
%(criteria_name)s</a>', data)) %(criteria_name)s</a>', data))
}, },
args: { args: { module: module },
module: module
},
no_refresh: true, no_refresh: true,
callback: function(r) { callback: function(r) {
erpnext.module_page.hide_links(wrapper) erpnext.module_page.hide_links($parent1)
} }
}); });
wrapper.list.run(); wrapper.list1.run();
wrapper.list2 = new wn.ui.Listing({
parent: $parent2,
method: 'utilities.get_report_list',
render_row: function(row, data) {
$(row).html(repl('<a href="#!Report2/%(ref_doctype)s/%(name)s" \
data-doctype="%(ref_doctype)s">\
%(name)s</a>', data))
},
args: { module: module },
no_refresh: true,
callback: function(r) {
erpnext.module_page.hide_links($parent2)
}
});
wrapper.list2.run();
} }

View File

@ -182,7 +182,6 @@ class DocType(TransactionBase):
#self.validate_prevdoc_details() #self.validate_prevdoc_details()
self.validate_reference_value() self.validate_reference_value()
self.validate_for_items() self.validate_for_items()
sales_com_obj.make_packing_list(self,'delivery_note_details')
sales_com_obj.validate_max_discount(self, 'delivery_note_details') #verify whether rate is not greater than max discount sales_com_obj.validate_max_discount(self, 'delivery_note_details') #verify whether rate is not greater than max discount
sales_com_obj.get_allocated_sum(self) # this is to verify that the allocated % of sales persons is 100% sales_com_obj.get_allocated_sum(self) # this is to verify that the allocated % of sales persons is 100%
sales_com_obj.check_conversion_rate(self) sales_com_obj.check_conversion_rate(self)
@ -474,6 +473,7 @@ class DocType(TransactionBase):
# on update # on update
def on_update(self): def on_update(self):
get_obj('Sales Common').make_packing_list(self,'delivery_note_details')
self.set_actual_qty() self.set_actual_qty()
get_obj('Stock Ledger').scrub_serial_nos(self) get_obj('Stock Ledger').scrub_serial_nos(self)

View File

@ -102,7 +102,7 @@ class DocType(TransactionBase):
scheduled_date =sql("select scheduled_date from `tabMaintenance Schedule Detail` \ scheduled_date =sql("select scheduled_date from `tabMaintenance Schedule Detail` \
where incharge_name='%s' and item_code='%s' and parent='%s' " %(d.incharge_name, \ where incharge_name='%s' and item_code='%s' and parent='%s' " %(d.incharge_name, \
d.item_code, self.doc.name), as_dict=1, debug=1) d.item_code, self.doc.name), as_dict=1)
for key in scheduled_date: for key in scheduled_date:
if email_map[d.incharge_name]: if email_map[d.incharge_name]:

View File

@ -79,7 +79,12 @@ class SupportMailbox(POP3Mailbox):
st = get_obj('Support Ticket', thread_id) st = get_obj('Support Ticket', thread_id)
st.make_response_record(content, mail.mail['From'], content_type) st.make_response_record(content, mail.mail['From'], content_type)
webnotes.conn.set(st.doc, 'status', 'Open')
# to update modified date
#webnotes.conn.set(st.doc, 'status', 'Open')
st.doc.status = 'Open'
st.doc.save()
update_feed(st.doc, 'on_update') update_feed(st.doc, 'on_update')
webnotes.conn.commit() webnotes.conn.commit()
# extract attachments # extract attachments

View File

@ -17,7 +17,7 @@
import webnotes import webnotes
@webnotes.whitelist() @webnotes.whitelist()
def get_report_list(arg=None): def get_sc_list(arg=None):
"""return list of reports for the given module module""" """return list of reports for the given module module"""
webnotes.response['values'] = webnotes.conn.sql("""select webnotes.response['values'] = webnotes.conn.sql("""select
distinct criteria_name, doc_type, parent_doc_type distinct criteria_name, doc_type, parent_doc_type
@ -26,4 +26,16 @@ def get_report_list(arg=None):
and docstatus in (0, NULL) and docstatus in (0, NULL)
and ifnull(disabled, 0) = 0 and ifnull(disabled, 0) = 0
order by criteria_name order by criteria_name
limit %(limit_start)s, %(limit_page_length)s""" % webnotes.form_dict, as_dict=True)
@webnotes.whitelist()
def get_report_list():
"""return list on new style reports for modules"""
webnotes.response['values'] = webnotes.conn.sql("""select
distinct tabReport.name, tabReport.ref_doctype
from `tabReport`, `tabDocType`
where tabDocType.module='%(module)s'
and tabDocType.name = tabReport.ref_doctype
and tabReport.docstatus in (0, NULL)
order by tabReport.name
limit %(limit_start)s, %(limit_page_length)s""" % webnotes.form_dict, as_dict=True) limit %(limit_start)s, %(limit_page_length)s""" % webnotes.form_dict, as_dict=True)

View File

@ -20,17 +20,17 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
var route = wn.get_route(); var route = wn.get_route();
if(route[1]=='Supplier') { if(route[1]=='Supplier') {
var supplier = locals.Supplier[route[2]] var supplier = wn.container.page.frm.doc;
doc.supplier = supplier.name; doc.supplier = supplier.name;
doc.supplier_name = supplier.supplier_name; doc.supplier_name = supplier.supplier_name;
doc.address_type = 'Office'; doc.address_type = 'Office';
} else if(route[1]=='Customer') { } else if(route[1]=='Customer') {
var customer = locals.Customer[route[2]] var customer = wn.container.page.frm.doc;
doc.customer = customer.name; doc.customer = customer.name;
doc.customer_name = customer.customer_name; doc.customer_name = customer.customer_name;
doc.address_type = 'Office'; doc.address_type = 'Office';
} else if(route[1]=='Sales Partner') { } else if(route[1]=='Sales Partner') {
var sp = locals['Sales Partner'][route[2]]; var sp = wn.container.page.frm.doc;
doc.sales_partner = sp.name; doc.sales_partner = sp.name;
doc.address_type = 'Office'; doc.address_type = 'Office';
} }

View File

@ -21,18 +21,18 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
var route = wn.get_route(); var route = wn.get_route();
if(route[1]=='Supplier') { if(route[1]=='Supplier') {
var supplier = locals.Supplier[route[2]] var supplier = wn.container.page.frm.doc;
doc.supplier = supplier.name; doc.supplier = supplier.name;
doc.supplier_name = supplier.supplier_name; doc.supplier_name = supplier.supplier_name;
} else if(route[1]=='Customer') { } else if(route[1]=='Customer') {
var customer = locals.Customer[route[2]]; var customer = wn.container.page.frm.doc;
doc.customer = customer.name; doc.customer = customer.name;
doc.customer_name = customer.customer_name; doc.customer_name = customer.customer_name;
if(customer.customer_type == 'Individual') { if(customer.customer_type == 'Individual') {
doc.first_name = customer.customer_name; doc.first_name = customer.customer_name;
} }
} else if(route[1]=='Sales Partner') { } else if(route[1]=='Sales Partner') {
var sp = locals['Sales Partner'][route[2]]; var sp = wn.container.page.frm.doc;
doc.sales_partner = sp.name; doc.sales_partner = sp.name;
} }
} }

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-03-27 14:36:47', 'creation': '2012-05-03 18:43:31',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-03-27 14:36:47', 'modified': '2012-05-25 11:58:44',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
@ -24,7 +24,7 @@
'name': '__common__', 'name': '__common__',
'section_style': u'Simple', 'section_style': u'Simple',
'show_in_menu': 0, 'show_in_menu': 0,
'version': 7 'version': 1
}, },
# These values are common for all DocField # These values are common for all DocField
@ -68,7 +68,7 @@
'fieldname': u'select_doctype', 'fieldname': u'select_doctype',
'fieldtype': u'Select', 'fieldtype': u'Select',
'label': u'Select DocType', 'label': u'Select DocType',
'options': u'\nAccount\nCompany\nCustomer\nSupplier\nEmployee\nWarehouse\nItem' 'options': u'\nAccount\nCompany\nCustomer\nSupplier\nEmployee\nWarehouse\nItem\nProfile'
}, },
# DocField # DocField

View File

@ -3276,51 +3276,71 @@ div.appframe-toolbar {
font-family: 'Pontano Sans'; font-family: 'Pontano Sans';
font-style: normal; font-style: normal;
font-weight: 800; font-weight: 800;
src: url('../lib/css/fonts/pontanosans.woff') format('woff'); src: url('fonts/pontanosans.woff') format('woff');
} }
@font-face { @font-face {
font-family: 'Droid Sans'; font-family: 'Droid Sans';
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
src: local('Droid Sans'), local('DroidSans'), url('../lib/css/fonts/droidsans.woff') format('woff'); src: local('Droid Sans'), local('DroidSans'), url('fonts/droidsans.woff') format('woff');
} }
@font-face { @font-face {
font-family: 'PT Sans'; font-family: 'PT Sans';
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
src: local('PT Sans'), local('PTSans-Regular'), url('../lib/css/fonts/ptsans.woff') format('woff'); src: local('PT Sans'), local('PTSans-Regular'), url('fonts/ptsans.woff') format('woff');
} }
@font-face { @font-face {
font-family: 'Open Sans'; font-family: 'Open Sans';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url('../lib/css/fonts/opensans.woff') format('woff'); src: local('Open Sans'), local('OpenSans'), url('fonts/opensans.woff') format('woff');
} }
@font-face { @font-face {
font-family: 'Lato'; font-family: 'Lato';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Lato Regular'), local('Lato-Regular'), url('../lib/css/fonts/lato.woff') format('woff'); src: local('Lato Regular'), local('Lato-Regular'), url('fonts/lato.woff') format('woff');
} }
@font-face { @font-face {
font-family: 'Cabin'; font-family: 'Cabin';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Cabin Regular'), local('Cabin-Regular'), url('../lib/css/fonts/cabin.woff') format('woff'); src: local('Cabin Regular'), local('Cabin-Regular'), url('fonts/cabin.woff') format('woff');
} }
@font-face { @font-face {
font-family: 'Pacifico'; font-family: 'Pacifico';
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
src: local('Pacifico Regular'), local('Pacifico-Regular'), url('../lib/css/fonts/pacifico.woff') format('woff'); src: local('Pacifico Regular'), local('Pacifico-Regular'), url('fonts/pacifico.woff') format('woff');
} }
@font-face {
font-family: 'Oleo Script';
font-style: normal;
font-weight: 400;
src: local('Oleo Script'), local('OleoScript-Regular'), url('fonts/oleoscript.woff') format('woff');
}
@font-face {
font-family: 'Cookie';
font-style: normal;
font-weight: 400;
src: local('Cookie-Regular'), url('fonts/cookie.woff') format('woff');
}
@font-face {
font-family: 'Marck Script';
font-style: normal;
font-weight: 400;
src: local('Marck Script'), local('MarckScript-Regular'), url('fonts/marckscript.woff') format('woff');
}
/* /*

View File

@ -2271,51 +2271,71 @@ div.dialog_row table td textarea {
font-family: 'Pontano Sans'; font-family: 'Pontano Sans';
font-style: normal; font-style: normal;
font-weight: 800; font-weight: 800;
src: url('../lib/css/fonts/pontanosans.woff') format('woff'); src: url('fonts/pontanosans.woff') format('woff');
} }
@font-face { @font-face {
font-family: 'Droid Sans'; font-family: 'Droid Sans';
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
src: local('Droid Sans'), local('DroidSans'), url('../lib/css/fonts/droidsans.woff') format('woff'); src: local('Droid Sans'), local('DroidSans'), url('fonts/droidsans.woff') format('woff');
} }
@font-face { @font-face {
font-family: 'PT Sans'; font-family: 'PT Sans';
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
src: local('PT Sans'), local('PTSans-Regular'), url('../lib/css/fonts/ptsans.woff') format('woff'); src: local('PT Sans'), local('PTSans-Regular'), url('fonts/ptsans.woff') format('woff');
} }
@font-face { @font-face {
font-family: 'Open Sans'; font-family: 'Open Sans';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url('../lib/css/fonts/opensans.woff') format('woff'); src: local('Open Sans'), local('OpenSans'), url('fonts/opensans.woff') format('woff');
} }
@font-face { @font-face {
font-family: 'Lato'; font-family: 'Lato';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Lato Regular'), local('Lato-Regular'), url('../lib/css/fonts/lato.woff') format('woff'); src: local('Lato Regular'), local('Lato-Regular'), url('fonts/lato.woff') format('woff');
} }
@font-face { @font-face {
font-family: 'Cabin'; font-family: 'Cabin';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Cabin Regular'), local('Cabin-Regular'), url('../lib/css/fonts/cabin.woff') format('woff'); src: local('Cabin Regular'), local('Cabin-Regular'), url('fonts/cabin.woff') format('woff');
} }
@font-face { @font-face {
font-family: 'Pacifico'; font-family: 'Pacifico';
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
src: local('Pacifico Regular'), local('Pacifico-Regular'), url('../lib/css/fonts/pacifico.woff') format('woff'); src: local('Pacifico Regular'), local('Pacifico-Regular'), url('fonts/pacifico.woff') format('woff');
} }
@font-face {
font-family: 'Oleo Script';
font-style: normal;
font-weight: 400;
src: local('Oleo Script'), local('OleoScript-Regular'), url('fonts/oleoscript.woff') format('woff');
}
@font-face {
font-family: 'Cookie';
font-style: normal;
font-weight: 400;
src: local('Cookie-Regular'), url('fonts/cookie.woff') format('woff');
}
@font-face {
font-family: 'Marck Script';
font-style: normal;
font-weight: 400;
src: local('Marck Script'), local('MarckScript-Regular'), url('fonts/marckscript.woff') format('woff');
}
/* /*

BIN
public/css/fonts/cabin.woff Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
public/css/fonts/lato.woff Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -959,7 +959,7 @@ wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype){this.doctype=d
<div class="wnlist-area"><div class="help">Loading...</div></div>\ <div class="wnlist-area"><div class="help">Loading...</div></div>\
</div>\ </div>\
<div class="layout-side-section">\ <div class="layout-side-section">\
<div class="stat-wrapper show-docstatus hide">\ <div class="show-docstatus hide" style="margin-bottom: 19px">\
<h4>Show</h4>\ <h4>Show</h4>\
<div><input data-docstatus="0" type="checkbox" checked="checked" /> Drafts</div>\ <div><input data-docstatus="0" type="checkbox" checked="checked" /> Drafts</div>\
<div><input data-docstatus="1" type="checkbox" checked="checked" /> Submitted</div>\ <div><input data-docstatus="1" type="checkbox" checked="checked" /> Submitted</div>\
@ -978,7 +978,7 @@ this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.wid
</p></div>',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length) </p></div>',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length)
return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;} return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;}
me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this
wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('<div class="stat-wrapper"><h4>Tags</h4>\ wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});if(me.listview.stats.length){$('<button class="btn btn-small"><i class="refresh"></i> Refresh</button>').click(function(){me.reload_stats();}).appendTo($('<div class="stat-wrapper">').appendTo(me.$page.find('.layout-side-section')))}}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('<div class="stat-wrapper"><h4>Tags</h4>\
<div class="help small"><i>No records tagged.</i><br><br> \ <div class="help small"><i>No records tagged.</i><br><br> \
To add a tag, open the document and click on \ To add a tag, open the document and click on \
"Add Tag" on the sidebar</div></div>');} "Add Tag" on the sidebar</div></div>');}
@ -995,7 +995,7 @@ args.label=v[0];args.width=flt(v[1])/max*100;args.count=v[1];args.field=field;$i
<a href="#" data-label="%(label)s" data-field="%(field)s">\ <a href="#" data-label="%(label)s" data-field="%(field)s">\
%(label)s</a> \ %(label)s</a> \
(%(count)s)</div>\ (%(count)s)</div>\
</div>',args));this.setup_stat_item_click($item);return $item;},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}} </div>',args));this.setup_stat_item_click($item);return $item;},reload_stats:function(){this.$page.find('.layout-side-section .stat-wrapper').remove();this.init_stats();},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}}
this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];this.show_hide_check_column();},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#222'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});} this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];this.show_hide_check_column();},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#222'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});}
if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;} if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;}
if(typeof opts.content=='function'){opts.content(parent,data);} if(typeof opts.content=='function'){opts.content(parent,data);}
@ -2284,9 +2284,11 @@ erpnext.hide_naming_series=function(){if(cur_frm.fields_dict.naming_series){hide
*/ */
wn.provide('erpnext.module_page');erpnext.module_page.setup_page=function(module,wrapper){erpnext.module_page.hide_links(wrapper);erpnext.module_page.make_list(module,wrapper);$(wrapper).find("a[title]").tooltip({delay:{show:500,hide:100}});} wn.provide('erpnext.module_page');erpnext.module_page.setup_page=function(module,wrapper){erpnext.module_page.hide_links(wrapper);erpnext.module_page.make_list(module,wrapper);$(wrapper).find("a[title]").tooltip({delay:{show:500,hide:100}});}
erpnext.module_page.hide_links=function(wrapper){$(wrapper).find('[href*="List/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[data-doctype]').each(function(){var dt=$(this).attr('data-doctype');if(wn.boot.profile.all_read.indexOf(dt)==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[href*="Form/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});} erpnext.module_page.hide_links=function(wrapper){$(wrapper).find('[href*="List/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[data-doctype]').each(function(){var dt=$(this).attr('data-doctype');if(wn.boot.profile.all_read.indexOf(dt)==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[href*="Form/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});}
erpnext.module_page.make_list=function(module,wrapper){wrapper.list=new wn.ui.Listing({parent:$(wrapper).find('.reports-list').get(0),method:'utilities.get_report_list',render_row:function(row,data){if(!data.parent_doc_type)data.parent_doc_type=data.doc_type;$(row).html(repl('<a href="#!Report/%(doc_type)s/%(criteria_name)s" \ erpnext.module_page.make_list=function(module,wrapper){var $w=$(wrapper).find('.reports-list');var $parent1=$('<div style="width: 45%; float: left; margin-right: 4.5%"></div>').appendTo($w);var $parent2=$('<div style="width: 45%; float: left;"></div>').appendTo($w);wrapper.list1=new wn.ui.Listing({parent:$parent1,method:'utilities.get_sc_list',render_row:function(row,data){if(!data.parent_doc_type)data.parent_doc_type=data.doc_type;$(row).html(repl('<a href="#!Report/%(doc_type)s/%(criteria_name)s" \
data-doctype="%(parent_doc_type)s">\ data-doctype="%(parent_doc_type)s">\
%(criteria_name)s</a>',data))},args:{module:module},no_refresh:true,callback:function(r){erpnext.module_page.hide_links(wrapper)}});wrapper.list.run();} %(criteria_name)s</a>',data))},args:{module:module},no_refresh:true,callback:function(r){erpnext.module_page.hide_links($parent1)}});wrapper.list1.run();wrapper.list2=new wn.ui.Listing({parent:$parent2,method:'utilities.get_report_list',render_row:function(row,data){$(row).html(repl('<a href="#!Report2/%(ref_doctype)s/%(name)s" \
data-doctype="%(ref_doctype)s">\
%(name)s</a>',data))},args:{module:module},no_refresh:true,callback:function(r){erpnext.module_page.hide_links($parent2)}});wrapper.list2.run();}
/* /*
* erpnext/startup/js/toolbar.js * erpnext/startup/js/toolbar.js
*/ */

23
update_erpnext.py Normal file
View File

@ -0,0 +1,23 @@
#!/usr/bin/python
import commands
cmd_list = [
'lib/wnf.py --pull origin master',
'lib/wnf.py -l',
'lib/wnf.py --sync_all'
]
err = 0
for cmd in cmd_list:
stat, op = commands.getstatusoutput(cmd)
if stat != 0:
print "something went wrong"
print "cannot proceed with update"
print "status: %s" % stat
print "output: %s" % op
err = 1
break
if not err:
print "update_erpnext.py --> run success."
else:
print "update_erpnext.py --> run failed."