Odoo Help


Change an existent statusBar

on 2/17/14, 11:38 AM 2,951 views

I try to add a state x_approve_quotation in sale.order statusBar but it doesn't work.

class complement_sale_order(osv.osv):
_inherit = 'sale.order'

_defaults = {
    'x_num_devis' : lambda obj, cr, uid, context: '/',
    'x_num_commande' : lambda obj, cr, uid, context: '/',

_columns = {
    'x_num_devis' : fields.char('Numéro Devis', size=15),
    'x_num_commande' : fields.char('Numéro de commande', size=15),
    'state': fields.selection([
        ('draft', 'Draft Quotation'),
        ('sent', 'Quotation Sent'),
        ('x_approve_quotation', 'Demander approbation'),
        ('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',
        help="Gives the status of the quotation or sales order. \nThe exception status is automatically set when a cancel operation occurs in the processing of a document linked to the sales order. \nThe 'Waiting Schedule' status is set when the invoice is confirmed but waiting for the scheduler to run on the order date.", select=True),


    <!-- Inherit the sale order model's form view and customize -->
    <record id="x_sale_form_view" model="ir.ui.view">

        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form"/>
        <field name="arch" type="xml">
            <!-- Statusbar widget should also contain the new status -->
            <field name="state" position="replace">
                <field name="state" widget="statusbar" statusbar_visible="draft,sent,x_approve_quotation,invoiced,done" statusbar_colors='{"invoice_except":"red","waiting_date":"blue"}'/>

            <!-- Add button and condition -->
            <button name="print_quotation" position="after">
                <button name="test_mdel" type="object" string="Demande d'approbation" states="draft,sent"  />
            <button name="action_button_confirm" position="attributes">
                <attribute name="states">x_approve_quotation</attribute> <!-- Précise quand le bouton cofirm pourra apparaitre -->
            <button name="cancel" position="attributes">
                <attribute name="states">draft,sent,x_approve_quotation</attribute>

            <!-- Add field sequence -->
            <field name="client_order_ref" position="after">
                <field name="x_num_devis" readonly="1"/>
                <field name="x_num_commande" readonly="1"/>

help please




| 5 5 7
Bikaner, India

OpenERP Developer at SunARC Technology

On 2/18/14, 1:26 AM

using the below link you can add new state in sale order


Thanks a lot, I add module crm to the list of dependancie and it's work !

on 2/18/14, 5:12 AM

My pleasure. . .

on 2/18/14, 5:22 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.


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)


Asked: 2/17/14, 11:38 AM
Seen: 2951 times
Last updated: 3/16/15, 8:10 AM