Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
2648 Visualizações

Models

class GLAccount(models.Model):
_name = 'glaccount'
    ......

class SaleOrderLine(models.Model):
name = 'sale.order.line'
_inherit = 'sale.order.line'
_description = 'Sales Order Line'

x_glaccount_id = fields.Many2one(
'glaccount',
string='GL Account',
required=False
)
###################
XML View





sale.order.inherited.view.form.glaccount
sale.order



placeholder="GL Account or Reference"
/>





############################
Exception:


....

Element '' cannot be located in parent view

View name: sale.order.inherited.view.form.glaccount
Error context:
 view: ir.ui.view(1032,)
 xmlid: view_sale_inherit_glaccount
 view.model: sale.order
 view.parent: ir.ui.view(835,)

......


Avatar
Cancelar
Melhor resposta

Hello Aleksandar Rajic,

Hope you are doing well.

If you inherit any model then no need to write '_name' in model just write '_inherit' and here is the ref for the xpath

Model :

class SaleOrderLineInherit(models.Model):
_inherit = 'sale.order.line'
_description = 'Sales Order Line Inherit'

x_glaccount_id = fields.Many2one(
'glaccount',
string='GL Account',
required=False
)
Xml View : code is below in comment



Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Cancelar

Code is here :

<record model="ir.ui.view" id="sale_order_form_view_update">
<field name="name">sale.order.form.view.update</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"></field>
<field name="arch" type="xml">
<xpath expr="//tree//field[@name='product_template_id']" position="after" >
<field name="x_glaccount_id"/>
</xpath>
</field>
</record>

Publicações relacionadas Respostas Visualizações Atividade
4
fev. 25
2895
3
fev. 25
2121
1
dez. 24
2178
1
ago. 24
2291
2
nov. 24
3489