[IMP] stock: product form Forecast statbutton with incoming/outgoing qty and product template and product product should be the same and consistent

The button Inventory Adjustement is also changed to Update Qty On Hand
as an inventory adjustment would expect a total inventory.
These buttons do not need a variant security group.

The incoming and outgoing quantity give more information on the forecast
button immediately.

The stock move view (Traceability statbutton) should not allow for creating or editing immediately.
This commit is contained in:
Josse Colpaert
2015-09-11 11:09:00 +02:00
parent a4f041ed45
commit f7dd7d8992
3 changed files with 51 additions and 34 deletions
+30 -18
View File
@@ -182,8 +182,8 @@
<field name="arch" type="xml">
<sheet position="before">
<header>
<button name="%(action_view_change_product_quantity)d" string="Inventory Adjustement" type="action" groups="product.group_product_variant"/>
<button string="Procurement Request" name="%(stock.act_make_procurement)d" type="action" groups="product.group_product_variant"/>
<button name="%(action_view_change_product_quantity)d" string="Update Qty On Hand" type="action"/>
<button string="Procurement Request" name="%(stock.act_make_procurement)d" type="action"/>
</header>
</sheet>
</field>
@@ -196,24 +196,32 @@
<field name="arch" type="xml">
<data>
<header position="inside">
<button string="Inventory Adjustement"
<button string="Update Qty On Hand"
type="action"
name="%(action_view_change_product_quantity)d"
groups="product.group_product_variant"/>
name="%(action_view_change_product_quantity)d"/>
<button string="Procurement Request"
type="action"
name="%(stock.act_make_procurement)d"
groups="product.group_product_variant"/>
name="%(stock.act_make_procurement)d"/>
</header>
<div name="button_box" position="inside">
<button class="oe_stat_button"
name="%(product_open_quants)d"
icon="fa-building-o"
type="action" attrs="{'invisible':[('type', '!=', 'service')]}"
groups="stock.group_locations">
<field name="qty_available" widget="statinfo"/>
type="action" attrs="{'invisible':[('type', '!=', 'product')]}">
<field name="qty_available" widget="statinfo" string="On Hand"/>
</button>
<button string="Moves"
<button type="action"
name="%(stock.action_stock_level_forecast_report_product)d"
attrs="{'invisible':[('type', '!=', 'product')]}"
class="oe_stat_button" icon="fa-building-o">
<div class="o_form_field o_stat_info">
<span class="o_stat_value"><field name="virtual_available" widget="statinfo" nolabel="1"/>
(-<field name="outgoing_qty" widget="statinfo" nolabel="1"/>
+<field name="incoming_qty" widget="statinfo" nolabel="1"/>)</span>
<span class="o_stat_text">Forecasted</span>
</div>
</button>
<button string="Traceability"
type="action"
name= "%(act_product_stock_move_open)d"
attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"
@@ -239,7 +247,7 @@
</button>
<button string="Routes" type="object"
name="action_view_routes"
attrs="{'invisible':[('type', '=', 'service')]}"
attrs="{'invisible':[('type', '!=', 'product')]}"
class="oe_stat_button" icon="fa-cogs" groups="stock.group_adv_location"/>
</div>
</data>
@@ -253,7 +261,7 @@
<field name="arch" type="xml">
<data>
<header position="inside" >
<button name="%(action_view_change_product_quantity)d" string="Inventory Adjustement" type="action"/>
<button name="%(action_view_change_product_quantity)d" string="Update Qty On Hand" type="action"/>
<button string="Procurement Request" name="%(stock.act_make_procurement)d" type="action"/>
</header>
<div name="button_box" position="inside">
@@ -263,12 +271,16 @@
class="oe_stat_button" icon="fa-building-o">
<field name="qty_available" widget="statinfo" string="On Hand"/>
</button>
<button type="action"
name="%(stock.action_stock_level_forecast_report)d"
name="%(stock.action_stock_level_forecast_report_template)d"
attrs="{'invisible':[('type', '!=', 'product')]}"
class="oe_stat_button" icon="fa-building-o">
<field name="virtual_available" widget="statinfo" string="Forecasted Qty"/>
<div class="o_form_field o_stat_info">
<span class="o_stat_value"><field name="virtual_available" widget="statinfo" nolabel="1"/>
(-<field name="outgoing_qty" widget="statinfo" nolabel="1"/>
+<field name="incoming_qty" widget="statinfo" nolabel="1"/>)</span>
<span class="o_stat_text">Forecasted</span>
</div>
</button>
<button string="Traceability" type="object"
name= "action_view_stock_moves"
@@ -284,7 +296,7 @@
</button>
<button type="object"
name="action_view_orderpoints"
attrs="{'invisible':['|',('type', '=', 'product'),('nbr_reordering_rules', '!=', 1)]}"
attrs="{'invisible':['|',('type', '!=', 'product'),('nbr_reordering_rules', '!=', 1)]}"
class="oe_stat_button" icon="fa-refresh">
<div class="o_form_field o_stat_info mr4">
<span class="o_stat_text">Min:</span>
@@ -297,7 +309,7 @@
</button>
<button string="Routes" type="object"
name="action_view_routes"
attrs="{'invisible':[('type', '!=', ['product', 'consu'])]}"
attrs="{'invisible':[('type', '!=', 'product')]}"
class="oe_stat_button" icon="fa-cogs"
groups="stock.group_adv_location"/>
</div>
+10 -1
View File
@@ -39,7 +39,7 @@
</field>
</record>
<record id="action_stock_level_forecast_report" model="ir.actions.act_window">
<record id="action_stock_level_forecast_report_template" model="ir.actions.act_window">
<field name="name">Stock Level Forecast</field>
<field name="res_model">report.stock.forecast</field>
<field name="view_type">form</field>
@@ -49,4 +49,13 @@
<field name="view_id" ref="view_stock_level_forecast_pivot"/>
</record>
<record id="action_stock_level_forecast_report_product" model="ir.actions.act_window">
<field name="name">Stock Level Forecast</field>
<field name="res_model">report.stock.forecast</field>
<field name="view_type">form</field>
<field name="view_mode">pivot,graph</field>
<field name="search_view_id" ref="view_stock_level_forecast_filter"/>
<field name="context">{'search_default_pivot_by':1, 'search_default_graph_by':1, 'search_default_product_id': active_id}</field>
<field name="view_id" ref="view_stock_level_forecast_pivot"/>
</record>
</odoo>
+11 -15
View File
@@ -523,13 +523,6 @@
<menuitem action="action_location_form" id="menu_action_location_form" groups="stock.group_locations"
parent="menu_warehouse_config" sequence="2"/>
<record id="act_product_stock_move_open" model="ir.actions.act_window">
<field name="context">{'search_default_done': 1,'search_default_product_id': active_id, 'default_product_id': active_id}</field>
<field name="name">Moves</field>
<field name="res_model">stock.move</field>
</record>
<record id="view_warehouse" model="ir.ui.view">
<field name="name">stock.warehouse</field>
<field name="model">stock.warehouse</field>
@@ -1246,11 +1239,11 @@
<field name="model">stock.move</field>
<field eval="8" name="priority"/>
<field name="arch" type="xml">
<tree decoration-muted="state == 'cancel'" decoration-danger="(state not in ('cancel','done')) and date > current_date" string="Moves">
<field name="name"/>
<tree decoration-muted="state == 'cancel'" decoration-danger="(state not in ('cancel','done')) and date > current_date" string="Moves" create="0">
<field name="name" invisible="1"/>
<field name="picking_id" string="Reference"/>
<field name="origin"/>
<field name="picking_type_id"/>
<field name="picking_type_id" invisible="1"/>
<field name="create_date" invisible="1" groups="base.group_no_one"/>
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, False)"/>
<field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom)"/>
@@ -1272,7 +1265,7 @@
<record id="view_move_picking_tree" model="ir.ui.view">
<field name="name">stock.move.tree</field>
<field name="model">stock.move</field>
<field eval="4" name="priority"/>
<field eval="12" name="priority"/>
<field name="arch" type="xml">
<tree decoration-muted="scrapped == True" string="Stock Moves" editable="bottom">
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.partner_id)"/>
@@ -1435,6 +1428,13 @@
</field>
</record>
<record id="act_product_stock_move_open" model="ir.actions.act_window">
<field name="context">{'search_default_product_id': active_id, 'default_product_id': active_id}</field>
<field name="name">Moves</field>
<field name="res_model">stock.move</field>
<field name="view_id" ref="stock.view_move_tree"/>
</record>
<record id="action_move_form2" model="ir.actions.act_window">
<field name="name">Stock Moves</field>
<field name="res_model">stock.move</field>
@@ -1510,9 +1510,6 @@
states="draft,waiting,confirmed,assigned"
groups="stock.group_stock_user"/>
<field name="state"/>
<button name="action_done" states="draft,assigned,confirmed"
icon="gtk-go-forward" type="object" groups="stock.group_stock_user"
class="oe_highlight" help="Done"/>
</tree>
</field>
</record>
@@ -2138,7 +2135,6 @@
<field name="in_date"/>
</tree>
</field>
<separator string="Contained Packages"/>
<field name="children_ids">
<tree string="Contained Packages">