~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to procurement_request/procurement_request.py

UF-558 [ADD] Add account_id on analytic distribution wizard to add a constraint on Funding Pool

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
    _columns = {
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
140
138
 
236
234
        
237
235
        return res
238
236
    
239
 
    def create(self, cr, uid, vals, context={}):
240
 
        '''
241
 
        Adds the date_planned value
242
 
        '''
243
 
        if context is None:
244
 
            context = {}
245
 
 
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')})
249
 
            else:
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})
252
 
                
253
 
        return super(procurement_request_line, self).create(cr, uid, vals, context=context)
254
 
    
255
237
    _columns = {
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')),
259
241
    }
260
242
    
261
 
    def _get_planned_date(self, cr, uid, c={}):
262
 
        if c is None:
263
 
            c = {}
264
 
        if 'procurement_request' in c:
265
 
            return c.get('date_planned', False)
266
 
 
267
 
        return super(procurement_request_line, self)._get_planned_date(cr, uid, c)
268
 
 
269
243
    _defaults = {
270
244
        'procurement_request': lambda self, cr, uid, c: c.get('procurement_request', False),
271
 
        'date_planned': _get_planned_date,
272
245
    }
273
246
    
274
247
    def requested_product_id_change(self, cr, uid, ids, product_id, type, context={}):