Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
2374 Visualizzazioni

i have my code in this way is there any problem in this code and how to solve it

<odoo>

  <data>


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

      <field name="name">custom.sale.order.view</field>

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

      <field name="inherit_id" ref="sale.view_order_form"/>

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

              <xpath expr ="//field[@name='payment_term_id']" position="after">

          <field name="new_field"/>

        </xpath>

      </field>

   </record>

  </data>

</odoo>

~

I have set all the models imported all required fields and set the models.py as it requires but eventhough error occure,

i have also added new_field in the model.py but there is error saying that new_field doesnot exist 
Avatar
Abbandona
Risposta migliore

Hi Riyan,

We can't see your Python code, the issue is most likely there. Are you sure you inherited the sale.order model there and added the field your custom Python code? Your code shoud look something like this:

class SaleOrder(models.Model):
_inherit = 'sale.order'
new_field = fields.Char(string='Your new field')

Some other things to check (that we cannot see in your question):

- Did you import the folder "models"?
- Did you import all files in the folder "models" so that they're loaded into the module?
- Did you define the dependency "sale" in your manifest.py file?

Regards,
Yenthe

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
4
mag 24
7372
1
lug 23
2424
3
giu 23
3345
4
giu 22
5081
3
apr 22
5676