This question has been flagged

I am trying to add a server action to confirm multiple sale orders, create thier invoices and deliver orders at once. For this purpose I am using sale_fast_confirm module from oerp. This module can cofirm one order only as its "Fast Confirm" button appears only in sale order form. 

To achive the task I am trying to create a Server action, and trying to copy the code from module to server action with no success. can some one please help me. the code is

from openerp import models, api

class sale(models.Model):

_inherit = 'sale.order'

@api.one

def order_process_now(self):

"""

Confirms order and creates and validates invoice, confirms pickings.

"""

# Process order

self.action_button_confirm()

inv_id = self.action_invoice_create()

if inv_id:

inv = self.env['account.invoice'].browse(inv_id)

inv.signal_workflow('invoice_open')

for picking in self.picking_ids:

picking.force_assign()

picking.action_done()

Avatar
Discard
Author

I had achieved the task. I simply call the button by "exceute" in server action.