[IMP] purchase,purchase_requisition:Improvements in purchase and purchase_requisition as per testing

bzr revid: mtr@mtr-20100701052708-8d23mnzjyt0taslw
This commit is contained in:
mtr 2010-07-01 10:57:08 +05:30
parent 6d1a56b5f6
commit 4b50f1407e
3 changed files with 8 additions and 13 deletions

View File

@ -155,7 +155,7 @@ class purchase_order(osv.osv):
'date_approve':fields.date('Date Approved', readonly=1, help="Date on which purchase order has been approved"),
'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, change_default=True),
'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True,
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}),
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},domain="[('partner_id', '=', partner_id)]"),
'dest_address_id':fields.many2one('res.partner.address', 'Destination Address',
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},
help="Put an address if you want to deliver directly from the supplier to the customer." \

View File

@ -13,10 +13,10 @@
Please note that: 
 
Orders will only be merged if: 
* Purchase Orders are in draft 
* Purchase Orders belong to the same partner 
* Purchase Orders belong to the same supplier 
* Purchase Orders are have same stock location, same pricelist 
 
Lines will only be merged if: 
* Order lines are exactly the same except for the quantity and unit 
* Order lines are exactly the same except for the product,quantity and unit 
" colspan="4"/>
<newline/>
<separator string="" colspan="4" />

View File

@ -47,7 +47,7 @@ class purchase_requisition(osv.osv):
'date_start': time.strftime('%Y-%m-%d %H:%M:%S'),
'state': 'draft',
'exclusive': 'multiple',
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.requisition', context=c),
'user_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).id ,
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'purchase.order.requisition'),
}
@ -85,7 +85,7 @@ class purchase_requisition(osv.osv):
message = _('Tender') + " '" + name + "' "+ _("is done")
self.log(cr, uid, id, message)
return True
purchase_requisition()
class purchase_requisition_line(osv.osv):
@ -102,7 +102,6 @@ class purchase_requisition_line(osv.osv):
}
def onchange_product_id(self, cr, uid, ids, product_id,product_uom_id, context=None):
""" Changes UoM and name if product_id changes.
@param name: Name of the field
@param product_id: Changed product_id
@ -113,10 +112,10 @@ class purchase_requisition_line(osv.osv):
prod = self.pool.get('product.product').browse(cr, uid, [product_id])[0]
value = {'product_uom_id': prod.uom_id.id,'product_qty':1.0}
return {'value': value}
_defaults = {
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.requisition.line', context=c),
}
purchase_requisition_line()
class purchase_order(osv.osv):
@ -133,13 +132,10 @@ class purchase_order(osv.osv):
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'purchase.order', order.id, 'purchase_cancel', cr)
self.pool.get('purchase.requisition').write(cr, uid, [po.requisition_id.id], {'state':'done','date_end':time.strftime('%Y-%m-%d %H:%M:%S')})
return res
purchase_order()
class product_product(osv.osv):
_inherit = 'product.product'
_columns = {
@ -150,7 +146,6 @@ class product_product(osv.osv):
}
product_product()
class procurement_order(osv.osv):
_inherit = 'procurement.order'
def make_po(self, cr, uid, ids, context={}):