purchase_order.py 739 B

12345678910111213141516171819202122232425262728
  1. # -*- coding: utf-8 -*-
  2. from openerp import api, models
  3. class PurchaseOrder(models.Model):
  4. _inherit = 'purchase.order'
  5. '''
  6. '''
  7. def action_purchase_confirm(self, cr, uid, ids, context=None):
  8. if not context:
  9. context = {}
  10. assert len(ids) == 1, 'This option should only be used for a single id at a time'
  11. self.signal_workflow(cr, uid, ids, 'purchase_confirm')
  12. return True
  13. '''
  14. '''
  15. @api.multi
  16. def purchase_process_now(self):
  17. for purchase in self:
  18. # Process order
  19. purchase.action_purchase_confirm()
  20. for picking in purchase.picking_ids:
  21. picking.force_assign()
  22. picking.action_done()