71
71
'requestor': fields.char(size=128, string='Requestor'),
72
72
'procurement_request': fields.boolean(string='Procurement Request', readonly=True),
73
'requested_date': fields.date(string='Requested date'),
74
73
'warehouse_id': fields.many2one('stock.warehouse', string='Warehouse'),
75
74
'origin': fields.char(size=64, string='Origin'),
76
75
'notes': fields.text(string='Notes'),
134
133
vals['partner_order_id'] = address_id
135
134
vals['partner_invoice_id'] = address_id
136
135
vals['partner_shipping_id'] = address_id
137
vals['delivery_requested_date'] = vals.get('requested_date')
138
136
pl = self.pool.get('product.pricelist').search(cr, uid, [], limit=1)[0]
139
137
vals['pricelist_id'] = pl
239
def create(self, cr, uid, vals, context={}):
241
Adds the date_planned value
246
if not 'date_planned' in vals and context.get('procurement_request'):
247
if 'date_planned' in context:
248
vals.update({'date_planned': context.get('date_planned')})
250
date_planned = self.pool.get('sale.order').browse(cr, uid, vals.get('order_id'), context=context).delivery_requested_date
251
vals.update({'date_planned': date_planned})
253
return super(procurement_request_line, self).create(cr, uid, vals, context=context)
256
238
'procurement_request': fields.boolean(string='Procurement Request', readonly=True),
257
239
'latest': fields.char(size=64, string='Latest documents', readonly=True),
258
240
'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits_compute= dp.get_precision('Sale Price')),
261
def _get_planned_date(self, cr, uid, c={}):
264
if 'procurement_request' in c:
265
return c.get('date_planned', False)
267
return super(procurement_request_line, self)._get_planned_date(cr, uid, c)
270
244
'procurement_request': lambda self, cr, uid, c: c.get('procurement_request', False),
271
'date_planned': _get_planned_date,
274
247
def requested_product_id_change(self, cr, uid, ids, product_id, type, context={}):