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

I'm trying to learn inheritance but I get the following error when installing the module.

The "test" field does not exist in the "sale.order" model

View error context:
{'file': '/var/lib/odoo/.local/share/Odoo/addons/15.0/oa_basic_inherit/views/basic_inherit_view.xml',
 'line': 3,
 'name': 'sale.order.form',
 'view': ir.ui.view(4106,),
 'view.model': 'sale.order',
 'view.parent': ir.ui.view(1091,),
 'xmlid': 'view_order_form'}



And that my code, I cant figure out my mistake.

from odoo import api, fields, models

class SaleOrder(models.Model):
_inherit = "sale.order"

test= fields.Selection([('a','A'),('b','B'),('c','C')], string='Choose')


xml version="1.0" encoding="utf-8"?>

id="view_order_form" model="ir.ui.view">
name="name">sale.order.form
name="model">sale.order
name="inherit_id" ref="sale.view_order_form">
name="arch" type="xml">
expr="//field[@name='payment_term_id']" position="after">
name="test"/>






Avatar
Buang
Jawaban Terbai

Hi,
May be you have missed to restart the odoo service or missed to import the files in the init.

Points to check:
* Ensure the odoo service has been restarted
* make sure the python files are imported in the init file

You can check this video explaining the same: https://www.youtube.com/watch?v=46yecsKX2tw

Thanks

Avatar
Buang
Penulis

Thanks for your answer. I'm sure that the python files are imported in the init file, and I restarted but still getting same error.

the error is saying that the added field doesnt get added to the db table,
are you sure restart works correctly ?

do one thing, stop the odoo service and see if it get really stopped

Penulis

Thank you. It worked !