Skip to Content
Menu
This question has been flagged
2485 Views

Hi 
I get this error

Error: Field 'encais_autrui_ids' specified in view could not be found.

when i use fields_view_get to create a new field in the view.

This is the code:


@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=FalseFalse, submenu=):
res = super(MultiplePayment, self).fields_view_get(
view_idview_typetoolbarsubmenu=view_id, =view_type, =toolbar, =submenu)
if self._context.get('type'):
doc = etree.fromstring(res['arch'])
invoice_id = self._context.get('active_id', False)
encais_doc = self.env['account.invoice.encais_doc''invoice_patient_id''='].search([(, , invoice_id)])
for in record encais_doc:
_moves_arch_lst = """
<page string='"""
+ record.doc_id.name + \
' (' + strround((record.balance, 3)) + ' TND)' """'>
<field name="encais_autrui_ids" context="{'default_doc_id':"""
+ + \
str(record.doc_id.id) + """ ,'default_invoice_id':invoice_id}">
<tree editable="bottom">
<field name="journal_id"/>
<field name="doc_id" invisible="1"/>
<field name="bank_id"/>
<field name="invoice_id" invisible="1"/>
<field name="is_onchange" invisible="1"/>
<field name="cheque"/>
<field name="amount"/>
</tree>
</field>
</page>
"""
"//page[@string='paiements']"
encais_node = doc.xpath()
feature_page = etree.fromstring(_moves_arch_lst)
if len(encais_node):
encais_node = encais_node[0]
encais_node.addnext(feature_page)
res['arch'] = etree.tostring(doc)
return res

Thanks a lot
 

Avatar
Discard

oussama,
Is 'encais_autrui_ids' field is defined at the time of object creation?
If not then, you can not create/append any new field i this way, as fields already defined in the object can only be rendered by the odoo in tag
hope it helps!