mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-17 18:45:20 +00:00
Merge branch 'shf_rename'
Conflicts: erpnext/patches/patch_list.py
This commit is contained in:
@@ -4,7 +4,8 @@ wn.doclistviews['Journal Voucher'] = wn.views.ListView.extend({
|
||||
this.fields = this.fields.concat([
|
||||
'`tabJournal Voucher`.voucher_type',
|
||||
'`tabJournal Voucher`.remark',
|
||||
'`tabJournal Voucher`.total_debit'
|
||||
'`tabJournal Voucher`.total_debit',
|
||||
'`tabJournal Voucher`.company',
|
||||
]);
|
||||
this.stats = this.stats.concat(['voucher_type']);
|
||||
},
|
||||
@@ -25,7 +26,7 @@ wn.doclistviews['Journal Voucher'] = wn.views.ListView.extend({
|
||||
{
|
||||
width: '18%',
|
||||
content: function(parent, data) {
|
||||
$(parent).html(sys_defaults.currency + ' ' + fmt_money(data.total_debit))
|
||||
$(parent).html(wn.boot.company[data.company].default_currency + ' ' + fmt_money(data.total_debit))
|
||||
},
|
||||
css: {'text-align':'right'}
|
||||
},
|
||||
|
||||
@@ -97,10 +97,18 @@ class DocType(TransactionBase):
|
||||
self.validate_duplicate_docname('purchase_order')
|
||||
self.doclist = get_obj('DocType Mapper', 'Purchase Order-Purchase Invoice').dt_map('Purchase Order', 'Purchase Invoice', self.doc.purchase_order_main, self.doc, self.doclist, "[['Purchase Order', 'Purchase Invoice'],['Purchase Order Item', 'Purchase Invoice Item'], ['Purchase Taxes and Charges','Purchase Taxes and Charges']]")
|
||||
|
||||
ret = self.get_credit_to()
|
||||
self.get_expense_account('entries')
|
||||
|
||||
ret = self.get_credit_to()
|
||||
if ret.has_key('credit_to'):
|
||||
self.doc.credit_to = ret['credit_to']
|
||||
|
||||
def get_expense_account(self, doctype):
|
||||
for d in getlist(self.doclist, doctype):
|
||||
if d.item_code:
|
||||
item = webnotes.conn.sql("select purchase_account, cost_center from tabItem where name = '%s'" %(d.item_code), as_dict=1)
|
||||
d.expense_head = item and item[0]['purchase_account'] or ''
|
||||
d.cost_center = item and item[0]['cost_center'] or ''
|
||||
|
||||
|
||||
# Get Item Details
|
||||
|
||||
@@ -177,14 +177,13 @@ class DocType(TransactionBase):
|
||||
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
|
||||
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
|
||||
|
||||
ret = obj.get_item_details(arg, self)
|
||||
ret = self.get_pos_details(arg, ret)
|
||||
ret = self.get_pos_details(arg)
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
|
||||
def get_pos_details(self, args, ret):
|
||||
def get_pos_details(self, args, ret = {}):
|
||||
if args['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:
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
@@ -188,6 +188,7 @@ class DocType(TransactionBase):
|
||||
# Send mail
|
||||
#=======================================================
|
||||
def send_mail_funct(self):
|
||||
from webnotes.utils.email_lib import sendmail
|
||||
emailid_ret=sql("select company_email from `tabEmployee` where name = '%s'"%self.doc.employee)
|
||||
if emailid_ret:
|
||||
receiver = cstr(emailid_ret[0][0])
|
||||
@@ -278,6 +279,6 @@ class DocType(TransactionBase):
|
||||
<td width='25%%'><b>Net Pay(in words) : </td><td colspan = '3' width = '50%%'>%s</b></td>
|
||||
</tr>
|
||||
</table></div>'''%(cstr(letter_head[0][0]),cstr(self.doc.employee), cstr(self.doc.employee_name), cstr(self.doc.month), cstr(self.doc.fiscal_year), cstr(self.doc.department), cstr(self.doc.branch), cstr(self.doc.designation), cstr(self.doc.grade), cstr(self.doc.bank_account_no), cstr(self.doc.bank_name), cstr(self.doc.arrear_amount), cstr(self.doc.payment_days), earn_table, ded_table, cstr(flt(self.doc.gross_pay)), cstr(flt(self.doc.total_deduction)), cstr(flt(self.doc.net_pay)), cstr(self.doc.total_in_words))
|
||||
sendmail([receiver], sender='automail@erpnext.com', subject=subj, parts=[['text/plain', msg]])
|
||||
sendmail([receiver], subject=subj, msg = msg)
|
||||
else:
|
||||
msgprint("Company Email ID not found.")
|
||||
|
||||
5
erpnext/patches/may_2012/page_role_series_fix.py
Normal file
5
erpnext/patches/may_2012/page_role_series_fix.py
Normal file
@@ -0,0 +1,5 @@
|
||||
def execute():
|
||||
import webnotes
|
||||
sr = webnotes.conn.sql("select max(name) from `tabPage Role`")
|
||||
if sr and sr[0][0].startswith('PR'):
|
||||
webnotes.conn.sql("update tabSeries set current = %s where name = 'PR'", int(sr[0][0][2:]))
|
||||
6
erpnext/patches/may_2012/reload_reports.py
Normal file
6
erpnext/patches/may_2012/reload_reports.py
Normal file
@@ -0,0 +1,6 @@
|
||||
def execute():
|
||||
import webnotes
|
||||
from webnotes.modules import reload_doc
|
||||
reload_doc('selling', 'search_criteria', 'itemwise_sales_details')
|
||||
reload_doc('selling', 'search_criteria', 'itemwise_delivery_details')
|
||||
|
||||
@@ -342,5 +342,14 @@ patch_list = [
|
||||
'patch_file': 'cms',
|
||||
'description': 'generate html pages'
|
||||
},
|
||||
|
||||
{
|
||||
'patch_module': 'patches.may_2012',
|
||||
'patch_file': 'reload_reports',
|
||||
'description': 'reload reports: itemwise sales/delivery details'
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.may_2012',
|
||||
'patch_file': 'page_role_series_fix',
|
||||
'description': 'reset series of page role at max'
|
||||
},
|
||||
]
|
||||
|
||||
@@ -83,7 +83,7 @@ class DocType(TransactionBase):
|
||||
if doc.fields.get('item_code'):
|
||||
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
|
||||
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
|
||||
ret = obj.get_item_details(arg, self)
|
||||
ret = obj.get_item_defaults(arg, self)
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
@@ -156,6 +156,22 @@ class DocType(TransactionBase):
|
||||
ret['base_ref_rate'] = flt(base_ref_rate)
|
||||
ret['basic_rate'] = flt(base_ref_rate)
|
||||
return ret
|
||||
|
||||
|
||||
def get_item_defaults(self, args):
|
||||
item = webnotes.conn.sql("""select default_warehouse, default_income_account, default_sales_cost_center 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') """ % (args['item_code']), as_dict=1)
|
||||
ret = {
|
||||
'reserved_warehouse' : item and item[0]['default_warehouse'] or '',
|
||||
'warehouse' : item and item[0]['default_warehouse'] or args.get('warehouse'),
|
||||
'income_account' : item and item[0]['default_income_account'] or args.get('income_account'),
|
||||
'cost_center' : item and item[0]['default_sales_cost_center'] or args.get('cost_center')
|
||||
}
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
|
||||
# ***************** Get Ref rate as entered in Item Master ********************
|
||||
def get_ref_rate(self, item_code, price_list_name, price_list_currency, plc_conv_rate):
|
||||
|
||||
@@ -100,7 +100,7 @@ class DocType(TransactionBase):
|
||||
if doc.fields.get('item_code'):
|
||||
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
|
||||
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
|
||||
ret = obj.get_item_details(arg, self)
|
||||
ret = obj.get_item_defaults(arg, self)
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
@@ -88,6 +88,13 @@ def boot_session(bootinfo):
|
||||
if hasattr(conf, 'max_users'): bootinfo['max_users'] = conf.max_users
|
||||
if hasattr(conf, 'expires_on'): bootinfo['expires_on'] = conf.expires_on
|
||||
|
||||
company = webnotes.conn.sql("select name, default_currency from `tabCompany`", as_dict=1)
|
||||
company_dict = {}
|
||||
for c in company:
|
||||
company_dict.setdefault(c['name'], {}).update(c)
|
||||
|
||||
bootinfo['company'] = company_dict
|
||||
|
||||
|
||||
|
||||
def get_letter_heads():
|
||||
|
||||
@@ -117,7 +117,7 @@ class DocType(TransactionBase):
|
||||
if doc.fields.get('item_code'):
|
||||
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
|
||||
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
|
||||
ret = obj.get_item_details(arg, self)
|
||||
ret = obj.get_item_defaults(arg, self)
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
doc.fields[r] = ret[r]
|
||||
|
||||
@@ -94,13 +94,13 @@ class DocType:
|
||||
|
||||
def validate_posting_time(self):
|
||||
""" Validate posting time format"""
|
||||
if self.doc.posting_time and len(cstr(self.doc.posting_time)) == 8 and cstr(self.doc.posting_time)[-2:] != '00':
|
||||
if self.doc.posting_time and len(self.doc.posting_time.split(':')) > 2:
|
||||
msgprint("Wrong format of posting time, can not complete the transaction. If you think \
|
||||
you entered posting time correctly, please contact ERPNext support team.")
|
||||
raise Exception
|
||||
|
||||
def scrub_posting_time(self):
|
||||
if not self.doc.posting_time or self.doc.posting_time == '12:0':
|
||||
if not self.doc.posting_time or self.doc.posting_time == '00:0':
|
||||
self.doc.posting_time = '00:00'
|
||||
if len(self.doc.posting_time.split(':')) > 2:
|
||||
self.doc.posting_time = '00:00'
|
||||
|
||||
Reference in New Issue
Block a user