Search code examples
odoo

Odoo 13 How to show some field only in Customers Accounting module


Customers are based on res.partner and not only Customers that based on res.partner vendor is based on res.partner too. Usually, when I add res.partner I will add a boolean field like IsMember to Identified the record is member, but I can't see any field to tell the difference between Customers and vendor. Because I want to Show some field only in Customer form.

<?xml version='1.0' encoding='utf-8'?>
<odoo>
    <record model="ir.ui.view" id="partner_customer_form_view">
        <field name="name">partner.customer</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form"/>
        <field name="arch" type="xml">

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


                <field name="customer_group_id" />

            </xpath>

            <xpath expr="//field[@name='mobile']/.." position="before">


                <field name="groupid"/>

                <field name="member_id"/>

            </xpath>





        </field>
    </record>
</odoo>

Solution

  • Odoo 13 uses Customer rank and Supplier rank this ranking base on the customer PO's and SO's, so if a customer has 1 PO then the vendor ranking will become 1 and the customer can be identified by supplier_rank > 0

    supplier_rank = fields.Integer(default=0)
    customer_rank = fields.Integer(default=0)
    


    Remember this is an integer field so if you want to set someone customer by default you will set an integer value, the higher the value the higher it will appear in the search list
    so I guess this should work

     <field name="customer_group_id" attrs="{'invisible': [('customer_rank' ,'>', 0)]}" />