Odoo Help

0

Add a Server Action

By
Faheem Khan
on 5/5/15, 2:26 AM 629 views

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()

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

Faheem Khan
on 5/5/15, 3:55 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 5/5/15, 2:26 AM
Seen: 629 times
Last updated: 5/5/15, 3:55 AM