This question has been flagged
1 Reply
1984 Views

Hi,

I want to override the state of Repair Order in Odoo v14. I've tried this:

<--python-->

class Repair(models.Model):
    _inherit = 'repair.order'

    GLOBAL_VALUE = [('draft','Brouillon'),
                                ('recu', 'Reçu'),
                                ('in_progress', 'Diagnostic'),
                                ('under_repair', 'Under Repair'),
                                ('ready', 'Ready to Repair'),    
                                ('2binvoiced', 'To be Invoiced'),
                                ('invoice_except', 'Invoice Exception'),
                                ('commanderenv', 'Commande pièces'),
                                ('reparation', 'Réparation'),
                                ('supplier', 'Envoi fournisseur'),
                                ('test', 'Test'),
                                ('irreparable', 'Irréparable'),
                                ('reject', 'Rejeté'),
                                ('done', 'Terminé'),
                                ('cancel', 'Annulé'), ]

    state = fields.Selection(
        GLOBAL_VALUE,
        string=u'Etat',
        default='draft',
        track_visibility='onchange'
        )


<--xml-->

<odoo>

    <data>

      

        <record id="view_repair_order_form_inherit" model="ir.ui.view">

            <field name="name">repair.form</field>

            <field name="model">repair.order</field>

            <field name="inherit_id" ref="repair.view_repair_order_form" />

            <field name="arch" type="xml">

        <field name="state" position="replace">

            <field name="state" widget="statusbar"                                 statusbar_visible="draft,recu,in_progress,test,done"/>

        </field>

</field>

        </record>

    </data>

</odoo>


It works, the new states appear but the string in the 'draft' and 'done' state don't change. It stays as before 'Quotation' and 'Repaired' respectively. I need to change that.

Your help will be much appreciated. Thanks in advance!

 


Avatar
Discard
Best Answer

Hey Mario,

Please try overriding the same state field in the python file. 

Python

state = fields.Selection([

                ('draft','Brouillon'),

                ('recu', 'Reçu'),

                ('in_progress', 'Diagnostic'),

                ('under_repair', 'Under Repair'),

                ('ready', 'Ready to Repair'),    

                ('2binvoiced', 'To be Invoiced'),

                ('invoice_except', 'Invoice Exception'),

                ('commanderenv', 'Commande pièces'),

                ('reparation', 'Réparation'),

                ('supplier', 'Envoi fournisseur'),

                ('test', 'Test'),

                ('irreparable', 'Irréparable'),

                ('reject', 'Rejeté'),

                ('done', 'Terminé'),

                ('cancel', 'Annulé')], string='Status',

        copy=False, default='draft', readonly=True, tracking=True,

        help="* The \'Draft\' status is used when a user is encoding a new and unconfirmed repair order.\n"

             "* The \'Confirmed\' status is used when a user confirms the repair order.\n"

             "* The \'Ready to Repair\' status is used to start to repairing, user can start repairing only after repair order is confirmed.\n"

             "* The \'To be Invoiced\' status is used to generate the invoice before or after repairing done.\n"

             "* The \'Done\' status is set when repairing is completed.\n"

             "* The \'Cancelled\' status is used when user cancel repair order.")

Thank you!

Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   

Avatar
Discard
Author

It works, thanks Jainesh Shah