Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
2379 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
4
may 24
7372
1
jul 23
2424
3
jun 23
3346
4
jun 22
5084
3
abr 22
5677