1234567891011121314151617181920212223242526272829 |
- # -*- coding: utf-8 -*-
- from openerp import api, models
- class PurchaseOrder(models.Model):
- _inherit = 'purchase.order'
- '''
- '''
- def action_purchase_confirm(self, cr, uid, ids, context=None):
- if not context:
- context = {}
- assert len(ids) == 1, 'This option should only be used for a single id at a time'
-
- self.signal_workflow(cr, uid, ids, 'purchase_confirm')
- return True
- @api.multi
- def purchase_process_now(self):
- """
- Confirms order and creates and validates invoice, confirms pickings.
- """
- for purchase in self:
- # Process order
- purchase.action_purchase_confirm()
- for picking in purchase.picking_ids:
- picking.force_assign()
- picking.action_done()
|