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

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 
Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
4
maj 24
7411
1
lip 23
2438
3
cze 23
3356
4
cze 22
5093
3
kwi 22
5688