Skip to content

Security

修改 ~/odoo13/addons/purchase/views/product_views.xml

{{% callout note %}} 讓採購價格表只有採購能看 {{% /callout %}}

<?xml version="1.0" encoding="utf-8"?>
<odoo>

        <!-- Product Suppliers-->

        <record id="view_product_supplier_inherit" model="ir.ui.view">
            <field name="name">product.template.supplier.form.inherit</field>
            <field name="model">product.template</field>
            <field name="inherit_id" ref="product.product_template_form_view"/>
            <field name="arch" type="xml">
                <!-- 非採購人員隱藏價格 -->
                <xpath expr="//page[@name='purchase']" position="attributes">
                    <!-- <attribute name="invisible">0</attribute> 註解掉,改成下面-->
                    <attribute name="groups">purchase.group_purchase_user</attribute>
                </xpath>
                <group name="purchase" position="before">
                    <field name="seller_ids" context="{'default_product_tmpl_id':context.get('product_tmpl_id',active_id), 'product_template_invisible_variant': True}" nolabel="1" attrs="{'invisible': [('product_variant_count','&gt;',1)]}"/>
                    <field name="variant_seller_ids" context="{'default_product_tmpl_id': context.get('product_tmpl_id', active_id)}" nolabel="1" attrs="{'invisible': [('product_variant_count','&lt;=',1)]}"/>
                </group>
                <group name="bill" position="attributes">
                    <attribute name="groups">purchase.group_purchase_manager</attribute>
                </group>
                <group name="bill" position="inside">
                    <field name="purchase_method" widget="radio"/>
                </group>