Hello,
In the new version , odoo v9, I've seen several relations like:
product.product with product.template
res.user with res.partner
account.payment with account.abstract.payment
I still don't understand this , I thought that if I added a field in account.abstract.payment , that new field would be present in the account.payment , but it doesn't...
In core code we have this:
class account_abstract_payment(models.AbstractModel):
_name = "account.abstract.payment"
_description = "Contains the logic shared between models which allows to register payments"
...class account_register_payments(models.TransientModel):
_name = "account.register.payments"
_inherit = 'account.abstract.payment'
_description = "Register payments on multiple invoices"
....
class account_payment(models.Model):
_name = "account.payment"
_inherit = 'account.abstract.payment'
_description = "Payments"
_order = "payment_date desc, name desc"
....
So, I thought that if I do this :
class account_abstract_payment(models.AbstractModel):
_inherit = "account.abstract.payment"
payment_line_ids = fields.One2many('account.payment.lines', 'payment_id', string='Payment Lines',)
I thougth that I was adding the field to account_register_payments and account_payment.
But when I implement the view for account_payment:
<record id="view_account_payment_form_saft" model="ir.ui.view">
<field name="name">account.payment.form.saft</field>
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_form"/>
<field name="arch" type="xml">
<sheet position="inside">
<group name="payment_lines" string="Payment Lines">
<field name="payment_line_ids" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
</group>
</sheet>
</field>
</record>
I get this error :
Error details:
Field `payment_line_ids` does not exist
Is there a documentation or something for me to understand how this work?
Thanks
this will get into detail description: https://learnopenerp.blogspot.com/2018/01/inheritance-in-models-and-views.html
See: https://www.youtube.com/watch?v=CkUulwB6k3o