fixes after merge

This commit is contained in:
Anand Doshi 2013-01-18 13:07:02 +05:30
parent 2865571cb9
commit 8b940ee451
5 changed files with 15 additions and 14 deletions

View File

@ -119,14 +119,15 @@ class DocType(BuyingController):
import webnotes.utils
this_purchase_date = webnotes.utils.getdate(obj.doc.fields.get('posting_date') or obj.doc.fields.get('transaction_date'))
for d in getlist(obj.doclist,obj.fname):
# get last purchase details
last_purchase_details = get_last_purchase_details(d.item_code, obj.doc.name)
# compare last purchase date and this transaction's date
last_purchase_rate = None
if last_purchase_details.last_purchase_date > this_purchase_date:
if last_purchase_details and \
(last_purchase_details.purchase_date > this_purchase_date):
last_purchase_rate = last_purchase_details['purchase_rate']
elif is_submit == 1:
# even if this transaction is the latest one, it should be submitted
@ -467,7 +468,6 @@ class DocType(BuyingController):
# get against document date
#-----------------------------
def get_prevdoc_date(self, obj):
import datetime
for d in getlist(obj.doclist, obj.fname):
if d.prevdoc_doctype and d.prevdoc_docname:
dt = sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))

View File

@ -208,10 +208,6 @@ class DocType(BuyingController):
# Step 3 :=> Check For Approval Authority
get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total)
# Step 4 :=> Update Current PO No. in Supplier as last_purchase_order.
update_supplier = webnotes.conn.set_value("Supplier", self.doc.supplier,
"last_purchase_order", self.doc.name)
# Step 5 :=> Update last purchase rate
purchase_controller.update_last_purchase_rate(self, is_submit = 1)

View File

@ -62,11 +62,6 @@ class DocType(TransactionBase):
if not self.doc.naming_series:
self.doc.naming_series = ''
# create address
addr_flds = [self.doc.address_line1, self.doc.address_line2, self.doc.city, self.doc.state, self.doc.country, self.doc.pincode]
address_line = "\n".join(filter(lambda x : (x!='' and x!=None),addr_flds))
webnotes.conn.set(self.doc,'address', address_line)
# create account head
self.create_account_head()
@ -124,7 +119,16 @@ class DocType(TransactionBase):
if not sql("select name from tabAccount where name=%s", (self.doc.name + " - " + abbr)):
parent_account = self.get_parent_account(abbr)
arg = {'account_name':self.doc.name,'parent_account': parent_account, 'group_or_ledger':'Ledger', 'company':self.doc.company,'account_type':'','tax_rate':'0','master_type':'Supplier','master_name':self.doc.name,'address':self.doc.address}
arg = {
'account_name': self.doc.name,
'parent_account': parent_account,
'group_or_ledger':'Ledger',
'company': self.doc.company,
'account_type': '',
'tax_rate': '0',
'master_type': 'Supplier',
'master_name': self.doc.name,
}
# create
ac = get_obj('GL Control').add_ac(cstr(arg))
msgprint("Created Account Head: "+ac)

View File

@ -1,6 +1,8 @@
import webnotes
def execute():
webnotes.reload_doc("stock", "doctype", "item_price")
# check for selling
webnotes.conn.sql("""update `tabItem Price` set selling=1
where ifnull(selling, 0)=0 and ifnull(buying, 0)=0""")

View File

@ -223,7 +223,6 @@ class DocType(BuyingController):
self.values.append({
'item_code' : d.fields.has_key('item_code') and d.item_code or d.rm_item_code,
'warehouse' : wh,
'transaction_date' : getdate(self.doc.modified).strftime('%Y-%m-%d'),
'posting_date' : self.doc.posting_date,
'posting_time' : self.doc.posting_time,
'voucher_type' : 'Purchase Receipt',