~humanitarian-core-editors/openerp-humanitarian-ngo/purchase-wkfl

« back to all changes in this revision

Viewing changes to purchase_extended/model/purchase_order.py

  • Committer: Yannick Vaucher
  • Author(s): nicolas.bessi at camptocamp
  • Date: 2014-02-06 13:56:33 UTC
  • mfrom: (70.2.9 add-bid_selected_state_on_po-nbi)
  • Revision ID: yannick.vaucher@camptocamp.com-20140206135633-huf9lxugi0pdjl1x
[MRG] [ADD] a bid selected state on PO
      [FIX] confirmation of cost estimate. PO in state bid will be cancel too

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
        ('sent', 'RFQ Sent'),
15
15
        ('draftbid', 'Draft Bid'),  # added
16
16
        ('bid', 'Bid Encoded'),  # Bid Received renamed into Bid Encoded
 
17
        ('bid_selected', 'Bid selected'), # added
17
18
        ('draftpo', 'Draft PO'),  # added
18
19
        ('confirmed', 'Waiting Approval'),
19
20
        ('approved', 'Purchase Confirmed'),
236
237
        value['value']['dest_address_id'] = dest_id
237
238
        return value
238
239
 
 
240
    def po_tender_requisition_selected(self, cr, uid, ids, context=None):
 
241
        """Workflow function that write state 'bid selected'"""
 
242
        return self.write(cr, uid, ids, {'state': 'bid_selected'},
 
243
                          context=context)
 
244
 
239
245
 
240
246
class purchase_order_line(orm.Model):
241
247
    _inherit = 'purchase.order.line'
242
248
 
243
249
    def onchange_product_id(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id,
244
250
            partner_id, date_order=False, fiscal_position_id=False, date_planned=False,
245
 
            name=False, price_unit=False, context=None, state='draft', type='rfq', **kwargs):
 
251
            name=False, price_unit=False, context=None, state='draftpo', type='purchase', **kwargs):
246
252
        res = super(purchase_order_line, self).onchange_product_id(cr, uid, ids,
247
253
                pricelist_id, product_id, qty, uom_id, partner_id, date_order,
248
254
                fiscal_position_id, date_planned, name, price_unit, context)
249
 
        if state == 'draft' and type == 'bid':
 
255
        if state == 'draft' and type == 'rfq':
250
256
            res['value'].update({'price_unit': 0})
251
257
        elif state in ('sent', 'draftbid', 'bid'):
252
258
            if 'price_unit' in res['value']: