[IMP] sale: show complete SO view by default

Instead of showing the columns delivered/invoiced qties on SOs
by setting a special key in the view's context, let's do the opposite
and hide them for a sepcial key instead.

The rationale behind this decision is that when a user wants to see
a SO from another place in the system, it is often a SO and not a quote
(i.e. accessing from an invoice's chatter message, from a subscription,
etc.). The default should then be to show these fields unless otherwise
specified in the context (and not the opposite).
This commit is contained in:
Damien Bouvy
2016-09-05 16:42:15 +02:00
parent e37d0909a2
commit 7b489ed42c
2 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
<field name="res_model">sale.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field>
<field name="context">{'search_default_partner_id': active_id, 'show_sale': True}</field>
<field name="context">{'search_default_partner_id': active_id}</field>
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
+14 -14
View File
@@ -153,8 +153,8 @@
attrs="{'invisible': ['|',('invoice_status', '!=', 'no'), ('state', '!=', 'sale')]}"/>
<button name="action_quotation_send" string="Send by Email" type="object" states="draft" class="btn-primary"/>
<button name="print_quotation" string="Print" type="object" states="draft" class="btn-primary"/>
<button name="action_confirm" states="sent" string="Confirm Sale" class="btn-primary o_sale_confirm" type="object" context="{'show_sale': True}"/>
<button name="action_confirm" states="draft" string="Confirm Sale" class="o_sale_confirm" type="object" context="{'show_sale': True}"/>
<button name="action_confirm" states="sent" string="Confirm Sale" class="btn-primary o_sale_confirm" type="object" />
<button name="action_confirm" states="draft" string="Confirm Sale" class="o_sale_confirm" type="object" />
<button name="print_quotation" string="Print" type="object" states="sent,sale"/>
<button name="action_quotation_send" string="Send by Email" type="object" states="sent,sale"/>
<button name="action_cancel" states="draft,sent,sale" type="object" string="Cancel"/>
@@ -218,13 +218,13 @@
<field name="product_uom" groups="product.group_uom" class="oe_inline oe_no_button"
attrs="{'readonly': [('state', 'in', ('sale','done', 'cancel'))]}"/>
</div>
<label for="qty_delivered" string="Delivered Quantity" invisible="not context.get('show_sale')"/>
<div invisible="not context.get('show_sale')">
<label for="qty_delivered" string="Delivered Quantity" invisible="context.get('hide_sale')"/>
<div invisible="context.get('hide_sale')">
<field name="qty_delivered" attrs="{'readonly': [('qty_delivered_updateable', '=', False)]}"/>
</div>
<label for="qty_invoiced" string="Invoiced Quantity" invisible="not context.get('show_sale')"/>
<div invisible="not context.get('show_sale')">
<field name="qty_invoiced" invisible="not context.get('show_sale')"/>
<label for="qty_invoiced" string="Invoiced Quantity" invisible="context.get('hide_sale')"/>
<div invisible="context.get('hide_sale')">
<field name="qty_invoiced" invisible="context.get('hide_sale')"/>
</div>
<field name="price_unit"/>
<label for="discount" groups="sale.group_discount_per_so_line"/>
@@ -265,10 +265,10 @@
string="Ordered Qty"
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id}"
/>
<field name="qty_delivered" invisible="not context.get('show_sale')"
<field name="qty_delivered" invisible="context.get('hide_sale')"
attrs="{'readonly': [('qty_delivered_updateable', '=', False)]}"/>
<field name="qty_invoiced"
invisible="not context.get('show_sale')"/>
invisible="context.get('hide_sale')"/>
<field name="qty_to_invoice" invisible="1"/>
<field name="product_uom"
attrs="{'readonly': [('state', 'in', ('sale','done', 'cancel'))]}"
@@ -435,7 +435,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>
<field name="search_view_id" ref="sale_order_view_search_inherit_sale"/>
<field name="context">{'show_sale': True}</field>
<field name="context">{}</field>
<field name="domain">[('state', 'not in', ('draft', 'sent', 'cancel'))]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
@@ -459,7 +459,7 @@
<field name="res_model">sale.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph,pivot</field>
<field name="context">{'show_sale': True}</field>
<field name="context">{}</field>
<field name="domain">[('invoice_status','=','to invoice')]</field>
<field name="search_view_id" ref="view_sales_order_filter"/>
<field name="help" type="html">
@@ -485,7 +485,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph,pivot</field>
<field name="domain">[('invoice_status','=','upselling')]</field>
<field name="context">{'show_sale': True}</field>
<field name="context">{}</field>
<field name="search_view_id" ref="view_sales_order_filter"/>
<field name="help" type="html">
<p>
@@ -512,6 +512,7 @@
<field name="view_id" ref="view_quotation_tree"/>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>
<field name="search_view_id" ref="sale_order_view_search_inherit_quotation"/>
<field name="context">{'hide_sale': True}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create a Quotation, the first step of a new sale.
@@ -688,7 +689,6 @@
<field name="search_view_id" ref="sale.sale_order_view_search_inherit_sale"/>
<field name="domain">[('state','not in',('draft','sent','cancel'))]</field>
<field name="context">{
'show_sale': True,
'search_default_team_id': [active_id],
'default_team_id': active_id,
}
@@ -712,7 +712,6 @@
<field name="search_view_id" ref="sale.sale_order_view_search_inherit_sale"/>
<field name="domain">[('state', '=', 'sale'),('invoice_status','=','to invoice')]</field>
<field name="context">{
'show_sale': True,
'search_default_team_id': [active_id],
'default_team_id': active_id,
}
@@ -727,6 +726,7 @@
<field name="view_id" ref="sale.view_quotation_tree"/>
<field name="view_mode">tree,form,calendar,graph</field>
<field name="context">{
'hide_sale': True,
'search_default_team_id': [active_id],
'default_team_id': active_id,
'show_address': 1,