[IMP] product_expiry,purchase_requisition,stock*: visual changes
- The `picking_type_id` field in the pickings form view is not openable; - Display the `description` field (optional) in the SVL list view; - Add the `expiration_date` field (optional) in the quant list views; - Add a description text for the landed cost; - Renames field `requisition_id`: "Purchase Agreement" > "Blanket Order" - In Inventory Adjustment, hides the "Apply All" button is at least one record is selected; - In `product_expiry`, renames two views to stick to the XML's coding guidelines: https://www.odoo.com/documentation/16.0/contributing/development/coding_guidelines.html#xml-ids-and-naming - For the replenishment: - Places the field `product_id` as the first option when the user writes something in the searchbar; - Renames `route_id`: "Preferred Route" > "Route"; - Renames the button "Automate Orders" into "Automate"; - Set the `route_id` field as "optional=hide" until `mrp_purchase` is installed (in this case, it will be set as "optional=show") because in this case, there is at least two routes (Buy and Manufacturing). task-3076044 Part-of: odoo/odoo#109511
This commit is contained in:
@@ -7,6 +7,7 @@ from odoo import api, fields, models
|
||||
class StockQuant(models.Model):
|
||||
_inherit = 'stock.quant'
|
||||
|
||||
expiration_date = fields.Datetime(related='lot_id.expiration_date', store=True, readonly=False)
|
||||
removal_date = fields.Datetime(related='lot_id.removal_date', store=True, readonly=False)
|
||||
use_expiration_date = fields.Boolean(related='product_id.use_expiration_date', readonly=True)
|
||||
|
||||
@@ -15,7 +16,7 @@ class StockQuant(models.Model):
|
||||
""" Returns a list of fields user can edit when he want to create a quant in `inventory_mode`.
|
||||
"""
|
||||
res = super()._get_inventory_fields_create()
|
||||
res += ['removal_date']
|
||||
res += ['expiration_date', 'removal_date']
|
||||
return res
|
||||
|
||||
@api.model
|
||||
@@ -23,7 +24,7 @@ class StockQuant(models.Model):
|
||||
""" Returns a list of fields user can edit when he want to edit a quant in `inventory_mode`.
|
||||
"""
|
||||
res = super()._get_inventory_fields_write()
|
||||
res += ['removal_date']
|
||||
res += ['expiration_date', 'removal_date']
|
||||
return res
|
||||
|
||||
@api.model
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding='UTF-8'?>
|
||||
<odoo>
|
||||
<record id="view_stock_quant_tree_expiry" model="ir.ui.view">
|
||||
<field name="name">stock.quant.inherit.form</field>
|
||||
<record id="view_stock_quant_tree" model="ir.ui.view">
|
||||
<field name="name">stock.quant.tree.inherit.expiry_date</field>
|
||||
<field name="model">stock.quant</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_quant_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
@@ -16,19 +16,35 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_stock_quant_tree_editable_expiry" model="ir.ui.view">
|
||||
<field name="name">stock.quant.inherit.form</field>
|
||||
<record id="view_stock_quant_tree_editable" model="ir.ui.view">
|
||||
<field name="name">stock.quant.tree.editable.inherit.expiry_date</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='lot_id']" position="after">
|
||||
<field name="use_expiration_date" invisible="1"/>
|
||||
<field name="expiration_date" optional="hide" invisible="context.get('hide_removal_date')"
|
||||
attrs="{'readonly': ['|', ('tracking', '=', 'none'), ('use_expiration_date', '=', False)]}"/>
|
||||
<field name="removal_date" optional="hide"
|
||||
invisible="context.get('hide_removal_date')" attrs="{'readonly': ['|', ('tracking', '=', 'none'), ('use_expiration_date', '=', False)]}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_stock_quant_tree_inventory_editable" model="ir.ui.view">
|
||||
<field name="name">stock.quant.inventory.tree.editable.inherit.expiry_date</field>
|
||||
<field name="model">stock.quant</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_quant_tree_inventory_editable"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='lot_id']" position="after">
|
||||
<field name="use_expiration_date" invisible="1"/>
|
||||
<field name="expiration_date" groups="stock.group_production_lot"
|
||||
optional="hide" invisible="context.get('hide_removal_date')"
|
||||
attrs="{'readonly': ['|', '|', ('tracking', '=', 'none'), ('lot_id', '=', False), ('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>
|
||||
@@ -40,5 +56,5 @@
|
||||
domain="[('lot_id.alert_date', '<=', context_today().strftime('%Y-%m-%d'))]"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -17,6 +17,7 @@ from purchase order.
|
||||
'views/mrp_bom_views.xml',
|
||||
'views/purchase_order_views.xml',
|
||||
'views/mrp_production_views.xml',
|
||||
'views/stock_orderpoint_views.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'depends': ['mrp', 'purchase_stock'],
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_warehouse_orderpoint_tree_editable" model="ir.ui.view">
|
||||
<field name="name">stock.warehouse.orderpoint.tree.editable.inherit.show_route</field>
|
||||
<field name="model">stock.warehouse.orderpoint</field>
|
||||
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_tree_editable"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='route_id']" position="attributes">
|
||||
<attribute name="optional">show</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -23,7 +23,7 @@ class PurchaseOrderGroup(models.Model):
|
||||
class PurchaseOrder(models.Model):
|
||||
_inherit = 'purchase.order'
|
||||
|
||||
requisition_id = fields.Many2one('purchase.requisition', string='Purchase Agreement', copy=False)
|
||||
requisition_id = fields.Many2one('purchase.requisition', string='Blanket Order', copy=False)
|
||||
is_quantity_copy = fields.Selection(related='requisition_id.is_quantity_copy', readonly=False)
|
||||
|
||||
purchase_group_id = fields.Many2one('purchase.order.group')
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='action_stock_replenishment_info']" position="before">
|
||||
<field name="show_supplier" invisible="1"/>
|
||||
<field name="supplier_id" string="Vendor" optional="show" attrs="{'invisible': [('show_supplier', '=', False)]}" options="{'no_create': True}"/>
|
||||
<field name="supplier_id" string="Vendor" optional="hidden" attrs="{'invisible': [('show_supplier', '=', False)]}" options="{'no_create': True}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -83,7 +83,7 @@ class StockWarehouseOrderpoint(models.Model):
|
||||
rule_ids = fields.Many2many('stock.rule', string='Rules used', compute='_compute_rules')
|
||||
lead_days_date = fields.Date(compute='_compute_lead_days')
|
||||
route_id = fields.Many2one(
|
||||
'stock.route', string='Preferred Route', domain="[('product_selectable', '=', True)]")
|
||||
'stock.route', string='Route', domain="[('product_selectable', '=', True)]")
|
||||
qty_on_hand = fields.Float('On Hand', readonly=True, compute='_compute_qty', digits='Product Unit of Measure')
|
||||
qty_forecast = fields.Float('Forecast', readonly=True, compute='_compute_qty', digits='Product Unit of Measure')
|
||||
qty_to_order = fields.Float('To Order', compute='_compute_qty_to_order', store=True, readonly=False, digits='Product Unit of Measure')
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<t t-name="InventoryReport.Buttons" t-inherit="web.ListView.Buttons" t-inherit-mode="primary" owl="1">
|
||||
<xpath expr="(//div/*)[last()]" position="after">
|
||||
<button t-if="props.context.inventory_mode and !props.context.inventory_report_mode"
|
||||
<button t-if="props.context.inventory_mode and !props.context.inventory_report_mode and nbSelected == 0"
|
||||
class="btn btn-secondary" type="button" t-on-click="onClickApplyAll">
|
||||
Apply All
|
||||
</button>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<field name="qty_forecast" force_save="1"/>
|
||||
<button name="action_product_forecast_report" type="object" icon="fa-area-chart" title="Forecast Report" attrs="{'invisible': [('id', '=', False)]}"/>
|
||||
<field name="visibility_days" optional="hidden"/>
|
||||
<field name="route_id" options="{'no_create': True, 'no_open': True}"/>
|
||||
<field name="route_id" options="{'no_create': True, 'no_open': True}" optional="hidden"/>
|
||||
<button name="action_stock_replenishment_info" type="object" icon="fa-info-circle" title="Replenishment Information" attrs="{'invisible': [('id', '=', False)]}"/>
|
||||
<field name="trigger" optional="hide"/>
|
||||
<field name="group_id" optional="hide" groups="stock.group_adv_location"/>
|
||||
@@ -62,7 +62,7 @@
|
||||
<field name="company_id" optional="hide" readonly="1" groups="base.group_multi_company"/>
|
||||
<button name="action_replenish" string="Order Once" type="object" class="o_replenish_buttons" icon="fa-truck"
|
||||
attrs="{'invisible': [('qty_to_order', '<=', 0.0)]}"/>
|
||||
<button name="action_replenish_auto" string="Automate Orders" type="object" class="o_replenish_buttons" icon="fa-refresh"
|
||||
<button name="action_replenish_auto" string="Automate" type="object" class="o_replenish_buttons" icon="fa-refresh"
|
||||
attrs="{'invisible': ['|', ('qty_to_order', '<=', 0.0), ('trigger', '=', 'auto')]}"/>
|
||||
<button name="%(action_orderpoint_snooze)d" string="Snooze" type="action" class="text-warning" icon="fa-bell-slash"
|
||||
attrs="{'invisible': [('trigger', '!=', 'manual')]}" context="{'default_orderpoint_ids': [id]}"/>
|
||||
@@ -75,13 +75,13 @@
|
||||
<field name="model">stock.warehouse.orderpoint</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Replenishment Report Search">
|
||||
<field name="name" string="Reordering Rule"/>
|
||||
<field name="product_id"/>
|
||||
<field name="trigger"/>
|
||||
<field name="product_category_id"/>
|
||||
<field name="group_id" groups="stock.group_adv_location"/>
|
||||
<field name="warehouse_id" groups="stock.group_stock_multi_warehouses"/>
|
||||
<field name="location_id" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="name" string="Reordering Rule"/>
|
||||
<filter string="Trigger Manual" name="filter_creation_trigger" domain="[('trigger', '=', 'manual')]"/>
|
||||
<separator/>
|
||||
<filter string="To Reorder" name="filter_to_reorder" domain="[('qty_to_order', '>', 0.0)]"/>
|
||||
@@ -107,8 +107,8 @@
|
||||
<field name="model">stock.warehouse.orderpoint</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Reordering Rules Search">
|
||||
<field name="name" string="Reordering Rule"/>
|
||||
<field name="product_id"/>
|
||||
<field name="name" string="Reordering Rule"/>
|
||||
<field name="trigger"/>
|
||||
<field name="group_id" groups="stock.group_adv_location"/>
|
||||
<field name="warehouse_id" groups="stock.group_stock_multi_warehouses"/>
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
attrs="{'invisible': [('picking_type_code', 'in', ['incoming', 'outgoing'])]}"/>
|
||||
</div>
|
||||
<field name="partner_id" nolabel="1"/>
|
||||
<field name="picking_type_id" attrs="{'invisible': [('hide_picking_type', '=', True)], 'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="picking_type_id" options="{'no_open': True}" attrs="{'invisible': [('hide_picking_type', '=', True)], 'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="location_id" groups="!stock.group_stock_multi_locations" invisible="1"/>
|
||||
<field name="location_dest_id" groups="!stock.group_stock_multi_locations" invisible="1"/>
|
||||
<field name="location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations" attrs="{'invisible': [('picking_type_code', '=', 'incoming')]}"/>
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
<field name="uom_id" groups="uom.group_uom" />
|
||||
<field name="currency_id" invisible="1" />
|
||||
<field name="value" sum="Total Value"/>
|
||||
<field name="description" optional="hide"/>
|
||||
<groupby name="product_id">
|
||||
<field name="cost_method" invisible="1"/>
|
||||
<field name="quantity_svl" invisible="1"/>
|
||||
|
||||
@@ -220,6 +220,8 @@
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Create a new landed cost
|
||||
</p><p>
|
||||
Landed costs allow you to include additional costs (shipment, insurance, customs duties, etc) into the cost of the product.
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user