Odoo Help

0
1
Valentin
On 2/14/18, 11:05 AM

I have resolved my problème.

First I have overrided field "statement_ids" to make readonly at false

class PosOrder(models.Model):

_inherit = 'pos.order'

# Override the statement_ids field to make readonly at false

    statement_ids = fields.One2many('account.bank.statement.line', 'pos_statement_id', string='Payments', readonly=False)

And in my view :

  1. I have disable creation and deletion to the treeview,

  2. Enable readonly for all fields of the treeview,

  3. And add my new field with readonly at "False".

<record id="receipt_checks_date" model="ir.ui.view">

<field name="name">pos.order.form.view.inherit</field>

<field name="model">pos.order</field>

<field name="inherit_id" ref="point_of_sale.view_pos_pos_form"></field>

<field name="arch" type="xml">

<!--Disable creation and deletion to the treeview of the statement ordres-->

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

<attribute name="create">false</attribute>

<attribute name="delete">false</attribute>

</xpath>

<!--Make all fields readonly except receipt_date-->

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

<attribute name="readonly">1</attribute>

</xpath>

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

<attribute name="readonly">1</attribute>

</xpath>

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

<attribute name="readonly">1</attribute>

</xpath>

<!--Add column "Receipt date" in the treeview of payment lines-->

<xpath expr="//field[@name='amount']" position="after">

<field name="receipt_date" readonly="0" />

</xpath>

</field>

</record>


I don't no if it's the best solution, but it work.

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/13/18, 10:18 AM
Seen: 2614 times
Last updated: 2/14/18, 11:05 AM