Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
d58da50f50
@ -313,15 +313,13 @@ class DocType(TransactionBase):
|
||||
# Validates Debit To Account and Customer Matches
|
||||
# ------------------------------------------------
|
||||
def validate_debit_to_acc(self):
|
||||
if self.doc.customer and not cint(self.doc.is_pos):
|
||||
acc_head = webnotes.conn.sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
|
||||
if acc_head and acc_head[0][0]:
|
||||
if not cstr(acc_head[0][0]) == cstr(self.doc.debit_to):
|
||||
msgprint("Debit To %s do not match with Customer %s for Company %s i.e. %s" %(self.doc.debit_to,self.doc.customer,self.doc.company,cstr(acc_head[0][0])))
|
||||
raise Exception, "Validation Error "
|
||||
if not acc_head:
|
||||
msgprint("%s does not have an Account Head in %s. You must first create it from the Customer Master" % (self.doc.customer, self.doc.company))
|
||||
raise Exception, "Validation Error "
|
||||
if self.doc.customer and self.doc.debit_to and not cint(self.doc.is_pos):
|
||||
acc_head = webnotes.conn.sql("select master_name from `tabAccount` where name = %s and docstatus != 2", self.doc.debit_to)
|
||||
|
||||
if (acc_head and cstr(acc_head[0][0]) != cstr(self.doc.customer)) or \
|
||||
(not acc_head and (self.doc.debit_to != cstr(self.doc.customer) + " - " + self.get_company_abbr())):
|
||||
msgprint("Debit To: %s do not match with Customer: %s for Company: %s.\n If both correctly entered, please select Master Type \
|
||||
and Master Name in account master." %(self.doc.debit_to, self.doc.customer,self.doc.company), raise_exception=1)
|
||||
|
||||
|
||||
# Validate Debit To Account
|
||||
|
@ -248,7 +248,8 @@ $import(Notification Control)
|
||||
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||
var args = {
|
||||
type: 'Expense Voucher',
|
||||
doctype: 'Expense Voucher'
|
||||
doctype: 'Expense Voucher',
|
||||
send_to: doc.exp_approver
|
||||
}
|
||||
cur_frm.cscript.notify(doc, args);
|
||||
}
|
||||
|
@ -98,8 +98,6 @@ class DocType:
|
||||
set(self.doc, 'remark', self.doc.remark)
|
||||
set(self.doc, 'approval_status', 'Rejected')
|
||||
|
||||
# on approval notification
|
||||
#get_obj('Notification Control').notify_contact('Expense Voucher Rejected', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
|
||||
|
||||
return cstr('Rejected')
|
||||
|
||||
@ -157,3 +155,8 @@ class DocType:
|
||||
|
||||
def on_cancel(self):
|
||||
set(self.doc, 'approval_status', 'Cancelled')
|
||||
|
||||
|
||||
def get_formatted_message(self, args):
|
||||
""" get formatted message for auto notification"""
|
||||
return get_obj('Notification Control').get_formatted_message(args)
|
||||
|
@ -0,0 +1,9 @@
|
||||
def execute():
|
||||
import webnotes
|
||||
from webnotes.model.code import get_obj
|
||||
|
||||
bins = webnotes.conn.sql("select distinct t2.name from `tabStock Ledger Entry` t1, tabBin t2 where t1.posting_time > '00:00:00' and t1.posting_time < '00:01:00' and t1.item_code = t2.item_code and t1.warehouse = t2.warehouse")
|
||||
webnotes.conn.sql("update `tabStock Ledger Entry` set posting_time = '00:00:00' where posting_time > '00:00:00' and posting_time < '00:01:00'")
|
||||
|
||||
for d in bins:
|
||||
get_obj('Bin', d[0]).update_entries_after(posting_date = '2000-01-01', posting_time = '12:01')
|
@ -252,5 +252,10 @@ patch_list = [
|
||||
'patch_file': 'serial_no_fixes',
|
||||
'description': 'fixes for sle creation while import'
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.april_2012',
|
||||
'patch_file': 'repost_stock_for_posting_time',
|
||||
'description': 'repost stock for posting time 00:00:seconds'
|
||||
},
|
||||
|
||||
]
|
||||
|
@ -90,7 +90,8 @@ class DocType(TransactionBase):
|
||||
# -------------------------------------
|
||||
def get_comm_rate(self, sales_partner):
|
||||
return get_obj('Sales Common').get_comm_rate(sales_partner, self)
|
||||
|
||||
|
||||
|
||||
# Clear Sales Order Details Table
|
||||
# --------------------------------
|
||||
def clear_sales_order_details(self):
|
||||
|
@ -23,7 +23,7 @@ from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
# Notification control
|
||||
class DocType:
|
||||
|
@ -270,7 +270,7 @@ class DocType:
|
||||
|
||||
# if no prev sle, start from the first one (for repost)
|
||||
if not prev_sle:
|
||||
cqty, cval, val_rate, self.fcfs_bal = 0, 0, 0, []
|
||||
cqty, cval, val_rate, stock_val, self.fcfs_bal = 0, 0, 0, 0, []
|
||||
|
||||
# normal
|
||||
else:
|
||||
@ -325,8 +325,8 @@ class DocType:
|
||||
where name=%s""", (cqty, flt(val_rate), cstr(self.fcfs_bal), stock_val, sle['name']))
|
||||
|
||||
# update the bin
|
||||
if sll:
|
||||
sql("update `tabBin` set valuation_rate=%s, actual_qty=%s, stock_value = %s where name=%s", \
|
||||
if sll or not prev_sle:
|
||||
sql("update `tabBin` set valuation_rate=%s, actual_qty=%s, stock_value = %s, projected_qty = (actual_qty + indented_qty + ordered_qty + planned_qty - reserved_qty) where name=%s", \
|
||||
(flt(val_rate), cqty, flt(stock_val), self.doc.name))
|
||||
|
||||
|
||||
|
@ -99,6 +99,12 @@ class DocType:
|
||||
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':
|
||||
self.doc.posting_time = '00:00'
|
||||
if len(self.doc.posting_time.split(':')) > 2:
|
||||
self.doc.posting_time = '00:00'
|
||||
|
||||
|
||||
def validate(self):
|
||||
self.validate_mandatory()
|
||||
@ -106,3 +112,4 @@ class DocType:
|
||||
self.validate_item()
|
||||
self.actual_amt_check()
|
||||
self.check_stock_frozen_date()
|
||||
self.scrub_posting_time()
|
||||
|
@ -18,6 +18,7 @@ import webnotes
|
||||
from webnotes.utils import load_json, cint, cstr, flt, get_defaults
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint
|
||||
|
||||
class TransactionBase:
|
||||
@ -225,3 +226,8 @@ class TransactionBase:
|
||||
ret = webnotes.conn.sql("select default_currency from tabCompany where name = '%s'" %(name))
|
||||
dcc = ret and ret[0][0] or get_defaults()['currency']
|
||||
return dcc
|
||||
|
||||
|
||||
def get_formatted_message(self, args):
|
||||
""" get formatted message for auto notification"""
|
||||
return get_obj('Notification Control').get_formatted_message(args)
|
||||
|
Loading…
Reference in New Issue
Block a user