Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2512 Lượt xem

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 
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 5 24
7693
1
thg 7 23
2606
3
thg 6 23
3619
4
thg 6 22
5395
3
thg 4 22
5961