[IMP]purchase: add picking_type field and set it by default as picking in

bzr revid: csn@openerp.com-20130829073516-48qqx63o897ins11
This commit is contained in:
Cedric Snauwaert 2013-08-29 09:35:16 +02:00
parent 5ca2f661a6
commit b9e3123764
2 changed files with 8 additions and 1 deletions

View File

@ -150,6 +150,10 @@ class purchase_order(osv.osv):
limit=1)
return res and res[0] or False
def _get_picking_in(self, cr, uid, context=None):
obj_data = self.pool.get('ir.model.data')
return obj_data.get_object_reference(cr, uid, 'stock','picking_type_in')[1]
STATE_SELECTION = [
('draft', 'Draft PO'),
('sent', 'RFQ Sent'),
@ -230,6 +234,7 @@ class purchase_order(osv.osv):
'journal_id': fields.many2one('account.journal', 'Journal'),
'bid_date': fields.date('Bid Received On', readonly=True, help="Date on which the bid was received"),
'bid_validity': fields.date('Bid Valid Until', help="Date on which the bid expired"),
'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', help="This will determine picking type of incoming shipment"),
}
_defaults = {
'date_order': fields.date.context_today,
@ -241,7 +246,8 @@ class purchase_order(osv.osv):
'pricelist_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').browse(cr, uid, context['partner_id']).property_product_pricelist_purchase.id,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.order', context=c),
'journal_id': _get_journal,
'currency_id': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id
'currency_id': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id,
'picking_type_id': _get_picking_in,
}
_sql_constraints = [
('name_uniq', 'unique(name, company_id)', 'Order Reference must be unique per Company!'),

View File

@ -198,6 +198,7 @@
<field name="origin" attr="{'invisible': [('origin','=',False)]}"/>
<field name="warehouse_id" on_change="onchange_warehouse_id(warehouse_id)" widget="selection" groups="stock.group_locations"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="picking_type_id"/>
</group>
</group>
<notebook>