summaryrefslogtreecommitdiff
path: root/addons/product_expiry/views
diff options
context:
space:
mode:
Diffstat (limited to 'addons/product_expiry/views')
-rw-r--r--addons/product_expiry/views/product_template_views.xml38
-rw-r--r--addons/product_expiry/views/production_lot_views.xml55
-rw-r--r--addons/product_expiry/views/res_config_settings_views.xml23
-rw-r--r--addons/product_expiry/views/stock_move_views.xml44
-rw-r--r--addons/product_expiry/views/stock_quant_views.xml55
5 files changed, 215 insertions, 0 deletions
diff --git a/addons/product_expiry/views/product_template_views.xml b/addons/product_expiry/views/product_template_views.xml
new file mode 100644
index 00000000..a6deea0d
--- /dev/null
+++ b/addons/product_expiry/views/product_template_views.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding='UTF-8'?>
+<odoo>
+ <record id="view_product_form_expiry" model="ir.ui.view">
+ <field name="name">product.template.inherit.form</field>
+ <field name="model">product.template</field>
+ <field name="inherit_id" ref="stock.view_template_property_form" />
+ <field name="arch" type="xml">
+ <group name="traceability" position="inside">
+ <field name="use_expiration_date" attrs="{'invisible': [('tracking', '=','none')]}"/>
+ </group>
+ <group name="stock_property" position="after">
+ <group string="Dates" name="expiry_and_lots" groups="stock.group_production_lot"
+ attrs="{'invisible': ['|', ('tracking', '=','none'), ('use_expiration_date', '=', False)]}">
+ <label for="expiration_time"/>
+ <div>
+ <field name="expiration_time" class="oe_inline"/>
+ <span> days</span>
+ </div>
+ <label for="use_time"/>
+ <div>
+ <field name="use_time" class="oe_inline"/>
+ <span> days</span>
+ </div>
+ <label for="removal_time"/>
+ <div>
+ <field name="removal_time" class="oe_inline"/>
+ <span> days</span>
+ </div>
+ <label for="alert_time"/>
+ <div>
+ <field name="alert_time" class="oe_inline"/>
+ <span> days</span>
+ </div>
+ </group>
+ </group>
+ </field>
+ </record>
+</odoo>
diff --git a/addons/product_expiry/views/production_lot_views.xml b/addons/product_expiry/views/production_lot_views.xml
new file mode 100644
index 00000000..34a5a144
--- /dev/null
+++ b/addons/product_expiry/views/production_lot_views.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding='UTF-8'?>
+<odoo>
+ <record id="view_move_form_expiry" 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" />
+ <field name="arch" type="xml">
+ <xpath expr="//page[@name='description']" position="before">
+ <page string="Dates" name="expiration_dates" attrs="{'invisible': [('use_expiration_date', '=', False)]}">
+ <field name="use_expiration_date" invisible="1"/>
+ <group>
+ <group>
+ <field name="expiration_date" />
+ <field name="removal_date" />
+ </group>
+ <group>
+ <field name="use_date" />
+ <field name="alert_date" />
+ </group>
+ </group>
+ </page>
+ </xpath>
+ <xpath expr="//div[hasclass('oe_title')]" position="inside">
+ <field name="product_expiry_alert" invisible="1"/>
+ <span class="badge badge-danger" attrs="{'invisible': [('product_expiry_alert', '=', False)]}">Expiration Alert</span>
+ </xpath>
+ </field>
+ </record>
+
+ <record id="search_product_lot_filter_inherit_product_expiry" model="ir.ui.view">
+ <field name="name">stock.production.lot.search.inherit</field>
+ <field name="model">stock.production.lot</field>
+ <field name="inherit_id" ref="stock.search_product_lot_filter"/>
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='product_id']" position="after">
+ <filter string="Expiration Alerts" name="expiration_alerts" domain="[('alert_date', '&lt;=', time.strftime('%Y-%m-%d %H:%M:%S'))]"/>
+ </xpath>
+ </field>
+ </record>
+
+ <record id="view_production_lot_view_tree" model="ir.ui.view">
+ <field name="name">stock.production.lot.tree.inherit.product.expiry</field>
+ <field name="model">stock.production.lot</field>
+ <field name="inherit_id" ref="stock.view_production_lot_tree"/>
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='create_date']" position="after">
+ <field name="product_qty" invisible="1"/>
+ <field name="alert_date" optional="hide" widget='remaining_days' attrs="{'invisible': [('product_qty', '&lt;=', 0)]}"/>
+ <field name="use_date" optional="hide"/>
+ <field name="removal_date" optional="hide"/>
+ <field name="expiration_date" optional="hide"/>
+ </xpath>
+ </field>
+ </record>
+</odoo>
diff --git a/addons/product_expiry/views/res_config_settings_views.xml b/addons/product_expiry/views/res_config_settings_views.xml
new file mode 100644
index 00000000..1c636bed
--- /dev/null
+++ b/addons/product_expiry/views/res_config_settings_views.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <record id="res_config_settings_view_form_stock" model="ir.ui.view">
+ <field name="name">res.config.settings.view.form.inherit.product.expiry.stock</field>
+ <field name="model">res.config.settings</field>
+ <field name="inherit_id" ref="stock.res_config_settings_view_form"/>
+ <field name="arch" type="xml">
+ <xpath expr="//div[@id='group_lot_on_delivery_slip']" position="after">
+ <div class="col-12 col-lg-6 o_setting_box" attrs="{'invisible': ['|', ('group_lot_on_delivery_slip', '=', False), ('module_product_expiry', '=', False)]}" id="group_expiry_date_on_delivery_slip">
+ <div class="o_setting_left_pane">
+ <field name="group_expiry_date_on_delivery_slip"/>
+ </div>
+ <div class="o_setting_right_pane">
+ <label for="group_expiry_date_on_delivery_slip"/>
+ <div class="text-muted">
+ Expiration dates will appear on the delivery slip
+ </div>
+ </div>
+ </div>
+ </xpath>
+ </field>
+ </record>
+</odoo>
diff --git a/addons/product_expiry/views/stock_move_views.xml b/addons/product_expiry/views/stock_move_views.xml
new file mode 100644
index 00000000..98f62fe6
--- /dev/null
+++ b/addons/product_expiry/views/stock_move_views.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <record id="view_stock_move_operations_expiry" model="ir.ui.view">
+ <field name="name">stock.move.operations.inherit.form</field>
+ <field name="model">stock.move</field>
+ <field name="inherit_id" ref="stock.view_stock_move_operations"/>
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='product_id']" position="after" >
+ <field name="picking_code" invisible="1"/>
+ <field name="use_expiration_date" invisible="1"/>
+ </xpath>
+ </field>
+ </record>
+
+ <record id="view_stock_move_line_operation_tree_expiry" model="ir.ui.view">
+ <field name="name">stock.move.line.inherit.tree</field>
+ <field name="model">stock.move.line</field>
+ <field name="inherit_id" ref="stock.view_stock_move_line_operation_tree"/>
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='lot_name']" position="after" >
+ <field name="picking_type_use_existing_lots" invisible="1"/>
+ <field name="expiration_date" force_save="1" attrs="{
+ 'column_invisible': ['|', ('parent.use_expiration_date', '!=', True), ('parent.picking_code', '!=', 'incoming')],
+ 'readonly': [('picking_type_use_existing_lots', '=', True)],
+ }"/>
+ </xpath>
+ </field>
+ </record>
+
+ <record id="view_stock_move_line_detailed_operation_tree_expiry" model="ir.ui.view">
+ <field name="name">stock.move.line.operations.inherit.tree</field>
+ <field name="model">stock.move.line</field>
+ <field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/>
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='lot_name']" position="after">
+ <field name="picking_type_use_existing_lots" invisible="1"/>
+ <field name="expiration_date" force_save="1" attrs="{
+ 'column_invisible': [('parent.picking_type_code', '!=', 'incoming')],
+ 'readonly': [('picking_type_use_existing_lots', '=', True)],
+ }"/>
+ </xpath>
+ </field>
+ </record>
+</odoo>
diff --git a/addons/product_expiry/views/stock_quant_views.xml b/addons/product_expiry/views/stock_quant_views.xml
new file mode 100644
index 00000000..d15b1437
--- /dev/null
+++ b/addons/product_expiry/views/stock_quant_views.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding='UTF-8'?>
+<odoo>
+ <record id="view_quant_form_expiry" model="ir.ui.view">
+ <field name="name">stock.quant.inherit.form</field>
+ <field name="model">stock.quant</field>
+ <field name="inherit_id" ref="stock.view_stock_quant_form"/>
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='lot_id']" position="after" >
+ <field name="removal_date"/>
+ </xpath>
+ </field>
+ </record>
+
+ <record id="view_stock_quant_tree_expiry" model="ir.ui.view">
+ <field name="name">stock.quant.inherit.form</field>
+ <field name="model">stock.quant</field>
+ <field name="inherit_id" ref="stock.view_stock_quant_tree"/>
+ <field name="arch" type="xml">
+ <xpath expr="//tree" position="attributes">
+ <attribute name="decoration-danger">
+ removal_date &lt; current_date or quantity &lt; 0
+ </attribute>
+ </xpath>
+ <xpath expr="//field[@name='quantity']" position="after" >
+ <field name="removal_date"/>
+ </xpath>
+ </field>
+ </record>
+
+ <record id="view_stock_quant_tree_editable_expiry" model="ir.ui.view">
+ <field name="name">stock.quant.inherit.form</field>
+ <field name="model">stock.quant</field>
+ <field name="inherit_id" ref="stock.view_stock_quant_tree_editable"/>
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='inventory_quantity']" position="before">
+ <field name="use_expiration_date" invisible="1"/>
+ <field name="removal_date" optional="show"
+ invisible="context.get('hide_removal_date')" attrs="{'readonly': ['|', ('tracking', '=', 'none'), ('use_expiration_date', '=', False)]}"/>
+ </xpath>
+ </field>
+ </record>
+
+ <record id="quant_search_view_inherit_product_expiry" model="ir.ui.view">
+ <field name="name">stock.quant.search.inherit</field>
+ <field name="model">stock.quant</field>
+ <field name="inherit_id" ref="stock.quant_search_view"/>
+ <field name="arch" type="xml">
+ <xpath expr="//filter[@name='reserved']" position="after">
+ <separator/>
+ <filter string="Expiration Alerts" name="expiration_alerts"
+ domain="[('removal_date', '&lt;=', context_today().strftime('%Y-%m-%d'))]"/>
+ </xpath>
+ </field>
+ </record>
+</odoo>