Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
7078 Widoki

Hello guys, 

please i have an attributeError that i don't understan. In fact, i have declared the fields i need in my .py but when executing it says to me AttributeError: Field `motif` does not exist "
My .py looks like this : 

class wizard(models.TransientModel):

    _inherit = "al.validfr.wizard", "al.novalidfr.wizard", "al.agency", "al.ouv.fr"

    _name = "bi.wizard.caisse"

    montant = fields.Integer(string="Mont", help="montant de C")

    motif = fields.Selection([

             ('Ch.Eau', 'water'),

             ('Ch.Electricité', 'Electricity'),

             ('Ch.dép', 'Déplacement'),

             ], help="les charges")

    state = fields.Selection([

             ('active', "Ouverte"),

            ('closed', "Fermée")

            ], default='active')

My View file looks like this : 

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

     <field name="name">charges.tree</field>

    <field name="model">bi.wizard.caisse</field>

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

         <tree string="Les charges par agence">

             <field name="name"/>

             <field name="motif"/>

             <field name="montant"/>

             <field name="state"/>

         </tree>

    </field>

</record>


Thanks in advance.



Awatar
Odrzuć
Najlepsza odpowiedź

  class SomeModel(models.Model):

_inherits = 'some.model'

type = fields.Selection(selection_add=[('b', 'B'), ('c', 'C')])   

Awatar
Odrzuć
Najlepsza odpowiedź

first, check the database to see if "motif" is created.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
gru 23
53591
2
sty 24
14386
0
mar 25
1287
0
sty 25
3388
1
lut 24
1150