Odoo Help

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>


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

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

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


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

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


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

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


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

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

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




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)


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