diff --git a/buying/doctype/purchase_common/purchase_common.py b/buying/doctype/purchase_common/purchase_common.py index 78264c2511..79e4fe0de6 100644 --- a/buying/doctype/purchase_common/purchase_common.py +++ b/buying/doctype/purchase_common/purchase_common.py @@ -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)) diff --git a/buying/doctype/purchase_order/purchase_order.py b/buying/doctype/purchase_order/purchase_order.py index be2833c789..f08a319b45 100644 --- a/buying/doctype/purchase_order/purchase_order.py +++ b/buying/doctype/purchase_order/purchase_order.py @@ -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) diff --git a/buying/doctype/supplier/supplier.py b/buying/doctype/supplier/supplier.py index 75031c93c9..2255cfd0b4 100644 --- a/buying/doctype/supplier/supplier.py +++ b/buying/doctype/supplier/supplier.py @@ -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) diff --git a/patches/january_2013/purchase_price_list.py b/patches/january_2013/purchase_price_list.py index 4a1369fbd2..02c260ed28 100644 --- a/patches/january_2013/purchase_price_list.py +++ b/patches/january_2013/purchase_price_list.py @@ -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""") diff --git a/stock/doctype/purchase_receipt/purchase_receipt.py b/stock/doctype/purchase_receipt/purchase_receipt.py index 0015048435..5c4aebdecb 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/stock/doctype/purchase_receipt/purchase_receipt.py @@ -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',