Odoo Help

Welcome!

This community 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.

0

Change an existent statusBar

By
hellequin
on 2/17/14, 11:38 AM 1,718 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),
}

complement_view.xml

<openerp>
<data>
    <!-- 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"}'/>
            </field>

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

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

help please

1

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 2/18/14, 1:26 AM

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

https://accounts.openerp.com/forum/Help-1/question/12293

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

hellequin
on 2/18/14, 5:12 AM

My pleasure. . .

Prakash
on 2/18/14, 5:22 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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