[MERGE] merge mtr branch for the purchase related modules changes for piratpad
bzr revid: mra@mra-laptop-20100701065957-o63pf52laa9yffu4
This commit is contained in:
commit
3baaf8f1cb
|
@ -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." \
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -47,12 +47,11 @@ 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,
|
||||
'user_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).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'),
|
||||
}
|
||||
|
||||
|
||||
def tender_cancel(self, cr, uid, ids, context=None):
|
||||
purchase_order_obj = self.pool.get('purchase.order')
|
||||
for purchase in self.browse(cr, uid, ids):
|
||||
|
@ -64,6 +63,7 @@ class purchase_requisition(osv.osv):
|
|||
message = _('Tender') + " '" + name + "' "+ _("is cancelled")
|
||||
self.log(cr, uid, id, message)
|
||||
return True
|
||||
|
||||
def tender_in_progress(self, cr, uid, ids, context=None):
|
||||
for quotations in self.browse(cr, uid, ids):
|
||||
if not quotations.purchase_ids:
|
||||
|
@ -73,12 +73,14 @@ class purchase_requisition(osv.osv):
|
|||
message = _('Tender') + " '" + name + "' "+ _(" is In Progress")
|
||||
self.log(cr, uid, id, message)
|
||||
return True
|
||||
|
||||
def tender_reset(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state': 'draft'})
|
||||
for (id,name) in self.name_get(cr, uid, ids):
|
||||
message = _('Tender') + " '" + name + "' "+ _("is in draft state")
|
||||
self.log(cr, uid, id, message)
|
||||
return True
|
||||
|
||||
def tender_done(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state':'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
|
||||
for (id,name) in self.name_get(cr, uid, ids):
|
||||
|
@ -89,9 +91,11 @@ class purchase_requisition(osv.osv):
|
|||
purchase_requisition()
|
||||
|
||||
class purchase_requisition_line(osv.osv):
|
||||
|
||||
_name = "purchase.requisition.line"
|
||||
_description="Purchase Requisition Line"
|
||||
_rec_name = 'product_id'
|
||||
|
||||
_columns = {
|
||||
'product_id': fields.many2one('product.product', 'Product' ),
|
||||
'product_uom_id': fields.many2one('product.uom', 'Product UoM'),
|
||||
|
@ -102,7 +106,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
|
||||
|
@ -115,8 +118,8 @@ class purchase_requisition_line(osv.osv):
|
|||
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,30 +136,30 @@ 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 = {
|
||||
'purchase_requisition': fields.boolean('Purchase Requisition', help="Check this box so that requisitions generates purchase requisitions instead of directly requests for quotations.")
|
||||
}
|
||||
_defaults = {
|
||||
'purchase_requisition': False
|
||||
}
|
||||
|
||||
product_product()
|
||||
|
||||
|
||||
class procurement_order(osv.osv):
|
||||
|
||||
_inherit = 'procurement.order'
|
||||
def make_po(self, cr, uid, ids, context={}):
|
||||
sequence_obj=self.pool.get('ir.sequence')
|
||||
res = super(procurement_order, self).make_po(cr, uid, ids, context)
|
||||
for proc_id,po_id in res.items():
|
||||
|
||||
def make_po(self, cr, uid, ids, context=None):
|
||||
sequence_obj = self.pool.get('ir.sequence')
|
||||
res = super(procurement_order, self).make_po(cr, uid, ids, context=context)
|
||||
for proc_id, po_id in res.items():
|
||||
procurement = self.browse(cr, uid, proc_id)
|
||||
if procurement.product_id.purchase_requisition:
|
||||
self.pool.get('purchase.requisition').create(cr, uid, {
|
||||
|
@ -172,6 +175,7 @@ class procurement_order(osv.osv):
|
|||
'purchase_ids': [(6,0,[po_id])]
|
||||
})
|
||||
return res
|
||||
|
||||
procurement_order()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -117,14 +117,12 @@
|
|||
<field name="arch" type="xml">
|
||||
<search string="Search Purchase Requisition">
|
||||
<group col='10' colspan='4'>
|
||||
<filter icon="terp-check" string="Current" domain="[('state','=','draft,in_progress')]" separator="1" help="Current Purchaes Requisition"/>
|
||||
<filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]" separator="1" help="Current Purchaes Requisition"/>
|
||||
<filter icon="terp-camera_test" string="Current" domain="[('state','=','draft,in_progress')]" separator="1" help="Current Purchaes Requisition"/>
|
||||
<filter icon="terp-check" string="Done" domain="[('state','=','done')]" separator="1" help="Current Purchaes Requisition"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" select="1" string="Requisition Reference"/>
|
||||
<field name="purchase_ids" select="1"/>
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="exclusive" select="1" />
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<field name="name" string="Requisition Reference"/>
|
||||
<field name="user_id" />
|
||||
<field name="exclusive" />
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10" groups="base.group_extended">
|
||||
|
|
Loading…
Reference in New Issue