Odoo Hilfe


1 Answer

Akhil P Sivan

--Akhil P Sivan--

| 6 4 9
Kochi, Indien
--Akhil P Sivan--

Odoo Developer

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
05.02.17, 15:24


While passing domain as strings on xml files, on the left hand side of condition you are supposed to give a field name and on the right side you can provide variables or strings. Try like this:

class AccountInvoiceLine(models.Model):
    _inherit = "account.invoice.line"
    tracking = fields.Selection(related='product_id.product_tmpl_id.tracking', String="Tracking")

And in the xml file:

<record id="invoice_form" model="ir.ui.view">    
    <field name="name">account.invoice.form.inherit.vtm2</field>
    <field name="model">account.invoice</field>
    <field name="inherit_id" ref="account.invoice_form" />
    <field name="arch" type="xml">
        <xpath expr="//field[@name='invoice_line_ids']//field[@name='discount']" position="after">
            <field name="tracking" invisible="1" />
            <button name="split_lot" string="Lot Split" type="object" icon="fa-list" groups="stock.group_production_lot"
                 attrs="{'invisible': [('tracking', '=', 'none')]}"/>
Pascal Tremblay
05.02.17, 16:49

Your explanation is great! Your code is great. All your words are great! It is magic!

Pascal Tremblay
05.02.17, 16:51

How do you explain the fact that we have to put the field 'tracking' (invisible) on the view? I have tried without this field on the view and it doesn't work. The view have to absolutely have this field on it?

Akhil P Sivan
05.02.17, 22:48

Yes the field has to be present on the tree view, to use conditions based on that.

Fragen Sie
Keep Informed
1 Verfolger
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now