Skip to Content
Menu
This question has been flagged
3 Replies
8187 Views

Hello,

In Odoo v11 (both Community and Enterprise), when the user edits/creates a new
customer invoice, the invoice lines are entered in the form of an editable tree.
Clicking "Add and item" inserts a new line in the tree. In non-editable mode of the
Customer Invoice form view, when clicking on the invoice line Odoo opens a form
view for displaying the details of the invoice line.

Desired behaviour: When adding an invoice line in the Customer Invoice form view,
I would like to open directly the same detailed form view, not let the user edit it in the tree.

Steps done:
I've removed the attribute editable="bottom" from the tree view of invoice_line_ids (by extending
the view account.invoice_form):

<xpath expr="//field[@name='invoice_line_ids']//tree" position="attributes">
<attribute name="editable"/>
</xpath>

The effect was:

-When editing an existing invoice line, Odoo opens the form view of the invoice line - OK

-When adding a new invoice line, Odoo raises the following error (assets):

TypeError: fieldInfo is undefined

Does anyone have an idea how to solve this properly? Please note, applying the same procedure for
enabling the editing of Purchase Order Lines in a form view works like a charm.
Thanks!
Ioan.

Avatar
Discard
Best Answer

Hi,

You are getting this error because of no form view defined for the one2many field. For the invoice lines, there is only tree and kanban. 

It will work for the purchase as well as sales because both have the form view defined in the one2many field.


You can try something like this,

<xpath expr="//field[@name='invoice_line_ids']" position="inside">
<form string="Invoice Lines">
<field name="sequence" widget="handle"/>
<field name="product_id" domain="[('sale_ok','=',True)]"/> # add all the fields to the form view
</form>
</xpath>
<xpath expr="//field[@name='invoice_line_ids']/tree" position="attributes">
<attribute name="editable"/>
</xpath>


Thanks

Avatar
Discard
Author

That's the reason and the way to the solution!

Thanks for the reply!

Best Answer

Hi,

You've added extra "/", try like this:

<xpath expr="//field[@name='invoice_line_ids']/tree" position="attributes">

    <attribute name="editable"/>

</xpath>

Avatar
Discard
Author

Thanks for the reply. Your suggestion does not change anything at the result. Using // I'm selecting all the tree elements (although there is only one). The error is the same. Please note, the error is not triggered at the upgrade of the module, but at runtime, when I click on "Add an item" in the invoice line list.

Please try with this:

<xpath expr="//tree" position="attributes">

<attribute name="editable" />

</xpath>

Author

Sorry, but this is not the case. See the reply from Cybrosys.

Related Posts Replies Views Activity
0
Nov 24
138
5
Aug 24
42980
2
Apr 24
949
3
Jun 23
3142
2
Jun 23
2381