Odoo Help

0

How to add a new status in sale.order in odoo 9?

By
Michael Marroquin
on 11/4/16, 8:43 PM 844 views

How to add a new status in sale.order in odoo 9?


What status do you want to add? What is the business reason to add this status? Can you clarify with a business case?

Fabrice Henrion (fhe)
on 11/4/16, 9:37 PM

I want to add status is "pending" .

This status is required for the sales manager can validate the sale and before the user can "confirm the order".

Michael Marroquin
on 11/4/16, 10:17 PM
3
Nilmar Shereef
On 11/4/16, 11:36 PM

You have to redefine "state" in sale order as follows:

_columns = {'state': fields.selection([('draft', 'Draft Quotation'),
                                        ('to_check', 'Pending'),
                                        ('checked', 'Checked'),
                                        ('sent', 'Quotation sent'),
                                        ('cancel', 'Cancelled'),
                                        ('waiting_date', 'Waiting Schedule'),
                                        ('progress', 'Sales Order'),
                                        ('manual', 'Sale to Invoice'),
                                        ('invoice_except', 'Invoice Exception'),
                                        ('done', 'Done'),],
             'status', readonly=True, track_visibility='onchange', select=True)}

Then add button action in sale order as follows:

def menu_to_check(self, cr, uid, ids, context=None):
res = self.write(cr, uid, ids, {'state': 'to_check'}, context=context)

        return res
def menu_checked(self, cr, uid, ids, context=None):
res = self.write(cr, uid, ids, {'state': 'checked'}, context=context)

        return res

Also you have to add corresponding two "workflow.activity" xml:

and three "workflow.transition" records  xml:

Two buttons in sale order inherited xml:


Hope this may help you.

Don't forget to give groups for your "checked" button for sale_managers in above xml
3
Ameera PP
On 11/4/16, 11:21 PM

Hi,

1) Redefine Existing state field:

state = fields.Selection([   

     ('draft', 'Quotation'),      

    ('sent', 'Quotation Sent'),    

    ('sale', 'Sale Order'),     

  ('pending', 'Pending'),

    ('done', 'Done'),  

    ('cancel', 'Cancelled'),  

      ], string='Status', readonly=True, copy=False, index=True, track_visibility='onchange', default='draft')


2) Redifine the field state in xml..and create new button and its action for proper working as per your requirements

0
Michael Marroquin
On 11/6/16, 11:12 PM

thanks to all and add the status,just that when I click on the button to change the status pending

from quotation to sales order change meand buttons disappear confirming order.

And my status must be before the sale is confirmed.

How could resolve this?

0
Ahmed M.Elmubarak
On 11/5/16, 5:30 AM

Hello,

In the new API you can use selection_add parameter to append some new options to the selection field.

So you can do:

class SaleOrder(models.Model):
     _inherit = 'sale.order'
     state = fields.Selection(selection_add([('pending', 'Pending')])


You can check this documentation for more details ...


Hope this could hleps ...

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: 11/4/16, 8:43 PM
Seen: 844 times
Last updated: 11/6/16, 11:12 PM