Skip to content

Commit

Permalink
[FIX] sale,stock,account,...: Use groups in views only if they exist
Browse files Browse the repository at this point in the history
Purpose
=======

They are a lot of places where we set an attribute 'groups' on a view element and:
- The group doesn't exist anymore
- The group xmlid is not correct
- The group xmlid exists but the modularity is not respected (example: group_stock_user
  used in a view in the 'product' module).

Where it happends, nothing warns the user of the developer. The element is just never
rendered.

Specification
=============

Fix the occurences of bad groups definition
  • Loading branch information
tivisse committed Oct 2, 2018
1 parent 497e134 commit eaba05b
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 13 deletions.
6 changes: 3 additions & 3 deletions addons/account/views/partner_view.xml
Expand Up @@ -225,15 +225,15 @@
</page>
</page>
<xpath expr="//page[@name='sales_purchases']/group" position="inside">
<group string="Fiscal Information" name="fiscal_information" priority="5" groups="account.group_account_invoice, sales_team.group_sale_salesman">
<group string="Fiscal Information" name="fiscal_information" priority="5" groups="account.group_account_invoice">
<field name="property_account_position_id" options="{'no_create': True, 'no_open': True}"/>
</group>
</xpath>
<group name="sale" position="inside">
<field string="Payment Terms" name="property_payment_term_id" widget="selection" groups="account.group_account_invoice, sales_team.group_sale_salesman"/>
<field string="Payment Terms" name="property_payment_term_id" widget="selection" groups="account.group_account_invoice"/>
</group>
<group name="purchase" position="inside">
<field string="Payment Terms" name="property_supplier_payment_term_id" widget="selection" groups="account.group_account_invoice, sales_team.group_sale_salesman"/>
<field string="Payment Terms" name="property_supplier_payment_term_id" widget="selection" groups="account.group_account_invoice"/>
</group>
</field>
</record>
Expand Down
2 changes: 1 addition & 1 deletion addons/account/views/res_company_view.xml
Expand Up @@ -7,7 +7,7 @@
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='company_registry']" position="after">
<field name="incoterm_id" groups="account.incoterms"/>
<field name="incoterm_id"/>
</xpath>
</field>
</record>
Expand Down
2 changes: 1 addition & 1 deletion addons/mrp/report/mrp_production_templates.xml
Expand Up @@ -35,7 +35,7 @@
<div class="col-3">
<strong>Quantity to Produce:</strong><br/>
<span t-field="o.product_qty"/>
<span t-field="o.product_uom_id.name" groups="product.group_uom"/>
<span t-field="o.product_uom_id.name" groups="uom.group_uom"/>
</div>
<div class="col-3">
<strong>Printing date:</strong><br/>
Expand Down
1 change: 0 additions & 1 deletion addons/payment/views/res_partner_views.xml
Expand Up @@ -13,7 +13,6 @@
<button type="action" class="oe_stat_button"
icon="fa-credit-card"
name="%(payment.payment_token_action)d"
groups="sales_team.group_sale_salesman"
context="{'search_default_partner_id': active_id}">
<div class="o_form_field o_stat_info">
<span class="o_stat_value">
Expand Down
2 changes: 1 addition & 1 deletion addons/product/views/product_pricelist_views.xml
Expand Up @@ -136,7 +136,7 @@
<sheet>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object"
class="oe_stat_button" icon="fa-archive" groups="sales_team.group_sale_manager">
class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button"
options='{"terminology": "archive"}'/>
</button>
Expand Down
2 changes: 1 addition & 1 deletion addons/product/views/product_views.xml
Expand Up @@ -94,7 +94,7 @@
<group string="Vendor Bills" name="bill"/>
</group>
</page>
<page string="Inventory" name="inventory" groups="stock.group_stock_user,product.group_stock_packaging" attrs="{'invisible':[('type', '=', 'service')]}">
<page string="Inventory" name="inventory" groups="product.group_stock_packaging" attrs="{'invisible':[('type', '=', 'service')]}">
<group name="inventory">
<group name="group_lots_and_weight" string="Logistics" attrs="{'invisible': [('type', 'not in', ['product', 'consu'])]}">
<label for="weight"/>
Expand Down
27 changes: 27 additions & 0 deletions addons/sale/views/res_partner_views.xml
Expand Up @@ -59,4 +59,31 @@
</field>
</record>

<record id="res_partner_view_form_payment_defaultcreditcard" model="ir.ui.view">
<field name="name">res.partner.view.form.payment.defaultcreditcard</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="payment.view_partners_form_payment_defaultcreditcard"/>
<field name="arch" type="xml">
<button name="%(payment.payment_token_action)d" position="attributes">
<attribute name="groups">sales_team.group_sale_salesman</attribute>
</button>
</field>
</record>

<record id="res_partner_view_form_property_inherit" model="ir.ui.view">
<field name="name">res.partner.view.form.property.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="account.view_partner_property_form"/>
<field name="arch" type="xml">
<group name="fiscal_information" position="attributes">
<attribute name="groups">account.group_account_invoice, sales_team.group_sale_salesman</attribute>
</group>
<field name="property_payment_term_id" position="attributes">
<attribute name="groups">account.group_account_invoice, sales_team.group_sale_salesman</attribute>
</field>
<field name="property_supplier_payment_term_id" position="attributes">
<attribute name="groups">account.group_account_invoice, sales_team.group_sale_salesman</attribute>
</field>
</field>
</record>
</odoo>
3 changes: 3 additions & 0 deletions addons/sale/views/sale_views.xml
Expand Up @@ -1113,6 +1113,9 @@
<field name="currency_id" position="before">
<field name="discount_policy" groups="sale.group_discount_per_so_line" widget="radio"/>
</field>
<button name="toggle_active" position="attributes">
<attribute name="groups">sales_team.group_sale_manager</attribute>
</button>
</field>
</record>

Expand Down
3 changes: 3 additions & 0 deletions addons/stock/views/product_views.xml
Expand Up @@ -124,6 +124,9 @@
<field name="description_picking" placeholder="This note will show up on internal transfer orders (e.g. where to pick the product in the warehouse)." nolabel="1"/>
</group>
</page>
<page name="inventory" position="attributes">
<attribute name="groups">stock.group_stock_user,product.group_stock_packaging</attribute>
</page>
</field>
</record>

Expand Down
2 changes: 1 addition & 1 deletion addons/stock/views/stock_rule_views.xml
Expand Up @@ -33,7 +33,7 @@
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<group expand='0' string='Group by...'>
<filter string='Route' name="groupby_route" context="{'group_by': 'route_id'}"/>
<filter string='Warehouse' name="groupby_warehouse" context="{'group_by': 'warehouse_id'}" groups="base.group_stock_multi_warehouses"/>
<filter string='Warehouse' name="groupby_warehouse" context="{'group_by': 'warehouse_id'}" groups="stock.group_stock_multi_warehouses"/>
</group>
</search>
</field>
Expand Down
6 changes: 3 additions & 3 deletions addons/stock_account/views/stock_account_views.xml
Expand Up @@ -75,7 +75,7 @@
<tree>
<field name="display_name"/>
<field name="qty_at_date"/>
<field name="uom_id" groups="product.group_uom"/>
<field name="uom_id" groups="uom.group_uom"/>
<field name="currency_id" invisible="1"/>
<field name="stock_value" sum="Stock Valuation" widget="monetary"/>
<field name="cost_method" invisible="1"/>
Expand Down Expand Up @@ -117,7 +117,7 @@
<field name="ref" />
<field name="product_id" />
<field name="quantity" />
<field name="product_uom_id" groups="product.group_uom" />
<field name="product_uom_id" groups="uom.group_uom" />
<field name="balance" string="Value"/>
</tree>
</field>
Expand All @@ -134,7 +134,7 @@
<field name="state" invisible="1"/>
<field name="product_id"/>
<field name="product_uom_qty" string="Quantity"/>
<field name="product_uom" options="{'no_open': True, 'no_create': True}" string="Unit of Measure" groups="product.group_uom"/>
<field name="product_uom" options="{'no_open': True, 'no_create': True}" string="Unit of Measure" groups="uom.group_uom"/>
<field name="value" sum="Stock Valuation"/>
</tree>
</field>
Expand Down
2 changes: 1 addition & 1 deletion addons/website/views/ir_attachment_views.xml
Expand Up @@ -6,7 +6,7 @@
<field name="inherit_id" ref="base.view_attachment_form"/>
<field name="arch" type="xml">
<field name="mimetype" position="after">
<field name="website_id" options="{'no_create': True}" groups="base.group_multi_website"/>
<field name="website_id" options="{'no_create': True}" groups="website.group_multi_website"/>
</field>
</field>
</record>
Expand Down

0 comments on commit eaba05b

Please sign in to comment.