Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
2385 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
4
Mei 24
7376
1
Jul 23
2432
3
Jun 23
3351
4
Jun 22
5089
3
Apr 22
5682