summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorPierre Masereel <pim@odoo.com>2017-10-27 15:14:08 +0200
committerSimon Lejeune <sle@openerp.com>2017-10-30 11:30:57 +0100
commit5e3b86b90c7bb9805cf6f704d2d53d3eac5a528f (patch)
treeae59c8e576d43fbcc97caf142677d14c4c2ec0e4 /addons
parentc3bf1618bd9540f86ec8f236bdfafce80e610c3e (diff)
[FIX] stock,product_expiry: simple view of lots
When a lot is quick created, we don't want to be able to select a product different than the one passed as default. So we have defined where the product_id is readonly, and we still use the old view when a lot is created from the menuitem lot.
Diffstat (limited to 'addons')
-rw-r--r--addons/product_expiry/views/production_lot_views.xml28
-rw-r--r--addons/stock/views/stock_production_lot_views.xml30
2 files changed, 54 insertions, 4 deletions
diff --git a/addons/product_expiry/views/production_lot_views.xml b/addons/product_expiry/views/production_lot_views.xml
index 9922b02fe8a..afe1824ef91 100644
--- a/addons/product_expiry/views/production_lot_views.xml
+++ b/addons/product_expiry/views/production_lot_views.xml
@@ -12,7 +12,7 @@
<field name="removal_date" />
</group>
<group>
- <field name="life_date" />
+ <field name="life_date" />
<field name="alert_date" />
</group>
</group>
@@ -20,7 +20,31 @@
<xpath expr="//div[hasclass('oe_title')]" position="inside">
<field name="product_expiry_alert" invisible="1"/>
<span class="label label-danger" attrs="{'invisible': [('product_expiry_alert', '=', False)]}">Expiration Alert</span>
- </xpath>
+ </xpath>
+ </field>
+ </record>
+
+ <record id="view_move_form_expiry_simple" model="ir.ui.view">
+ <field name="name">stock.production.lot.inherit.form</field>
+ <field name="model">stock.production.lot</field>
+ <field name="inherit_id" ref="stock.view_production_lot_form_simple" />
+ <field name="arch" type="xml">
+ <xpath expr="//group[@name='main_group']" position="after">
+ <group string="Dates">
+ <group>
+ <field name="use_date" />
+ <field name="removal_date" />
+ </group>
+ <group>
+ <field name="life_date" />
+ <field name="alert_date" />
+ </group>
+ </group>
+ </xpath>
+ <xpath expr="//div[hasclass('oe_title')]" position="inside">
+ <field name="product_expiry_alert" invisible="1"/>
+ <span class="label label-danger" attrs="{'invisible': [('product_expiry_alert', '=', False)]}">Expiration Alert</span>
+ </xpath>
</field>
</record>
diff --git a/addons/stock/views/stock_production_lot_views.xml b/addons/stock/views/stock_production_lot_views.xml
index 98347b3beef..19ee7968de8 100644
--- a/addons/stock/views/stock_production_lot_views.xml
+++ b/addons/stock/views/stock_production_lot_views.xml
@@ -9,6 +9,7 @@
<record id="view_production_lot_form" model="ir.ui.view">
<field name="name">stock.production.lot.form</field>
<field name="model">stock.production.lot</field>
+ <field name="priority">10</field>
<field name="arch" type="xml">
<form string="Lots/Serial Numbers">
<sheet>
@@ -41,6 +42,29 @@
</form>
</field>
</record>
+
+ <record id="view_production_lot_form_simple" model="ir.ui.view">
+ <field name="name">stock.production.lot.form.simple</field>
+ <field name="model">stock.production.lot</field>
+ <field name="priority">1</field>
+ <field name="arch" type="xml">
+ <form string="Lots/Serial Numbers">
+ <sheet>
+ <div class="oe_title">
+ <label for="name" class="oe_edit_only"/>
+ <h1>
+ <field name="name" placeholder="e.g. LOT/0001/20121"/>
+ </h1>
+ </div>
+ <group name="main_group">
+ <field name="product_id" attrs="{'readonly': [('product_id', '!=', False)]}" force_save="1" help="Product this lot/serial number contains. You cannot change it anymore if it has already been moved."/>
+ <field name="ref"/>
+ </group>
+ </sheet>
+ </form>
+ </field>
+ </record>
+
<record id="view_production_lot_tree" model="ir.ui.view">
<field name="name">stock.production.lot.tree</field>
<field name="model">stock.production.lot</field>
@@ -71,8 +95,10 @@
<field name="name">Lots/Serial Numbers</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.production.lot</field>
- <field name="view_type">form</field>
- <field name="view_id" ref="view_production_lot_tree"/>
+ <field name="view_ids"
+ eval="[(5, 0, 0),
+ (0, 0, {'view_mode': 'tree', 'view_id': ref('view_production_lot_tree')}),
+ (0, 0, {'view_mode': 'form', 'view_id': ref('view_production_lot_form')})]"/>
<field name="search_view_id" ref="search_product_lot_filter"/>
<field name="context">{'search_default_group_by_product': 1}</field>
<field name="help" type="html">