[IMP] stock: update UX of stock moves lines report
Note this includes the view shown when clicking on: - "History" button in inventory adjustments - "Product Moves" button in scrap/product forms - "Reporting" > "Moves History" At time of this commit being written. Other move line views not changed since they are specific to inputting data rather than readonly data. Minor UX updates to stock move lines report: - rename "Units of Measure" column to "Unit" - add color to quantity field (green = incoming qty into stock, red = outgoing, black = all others [i.e. internal transfers/external locations only, etc] - search filter order updated + src/dest location filters replaced with generic filter that checks if either meets condition - add src/dest package to list view - add status, lot, and from/to dest to kanban view and replace picking with reference so inventory adjustments are visible as well - order by date desc so most recent ones are first - always display location src/dest to help understanding of moves Specific to "History" button in Inventory Adjustments / Reporting > Locations (i.e. inventory report), moved product_id from domain to default_search for more user analysis flexibility/ease. "product moves" part of b2b task: 2882539 Part-of: odoo/odoo#97109
This commit is contained in:
@@ -62,6 +62,8 @@ class StockMoveLine(models.Model):
|
||||
compute="_compute_location_id", store=True, readonly=False, precompute=True,
|
||||
)
|
||||
location_dest_id = fields.Many2one('stock.location', 'To', domain="[('usage', '!=', 'view')]", check_company=True, required=True, compute="_compute_location_id", store=True, readonly=False, precompute=True)
|
||||
location_usage = fields.Selection(string="Source Location Type", related='location_id.usage')
|
||||
location_dest_usage = fields.Selection(string="Destination Location Type", related='location_dest_id.usage')
|
||||
lots_visible = fields.Boolean(compute='_compute_lots_visible')
|
||||
picking_partner_id = fields.Many2one(related='picking_id.partner_id', readonly=True)
|
||||
picking_code = fields.Selection(related='picking_id.picking_type_id.code', readonly=True)
|
||||
|
||||
@@ -331,7 +331,6 @@ class StockQuant(models.Model):
|
||||
self.ensure_one()
|
||||
action = self.env["ir.actions.actions"]._for_xml_id("stock.stock_move_line_action")
|
||||
action['domain'] = [
|
||||
('product_id', '=', self.product_id.id),
|
||||
'|',
|
||||
('location_id', '=', self.location_id.id),
|
||||
('location_dest_id', '=', self.location_id.id),
|
||||
@@ -340,6 +339,8 @@ class StockQuant(models.Model):
|
||||
('package_id', '=', self.package_id.id),
|
||||
('result_package_id', '=', self.package_id.id),
|
||||
]
|
||||
action['context'] = literal_eval(action.get('context'))
|
||||
action['context']['search_default_product_id'] = self.product_id.id
|
||||
return action
|
||||
|
||||
def action_view_orderpoints(self):
|
||||
@@ -433,9 +434,9 @@ class StockQuant(models.Model):
|
||||
'context': {
|
||||
'search_default_inventory': 1,
|
||||
'search_default_done': 1,
|
||||
'search_default_product_id': self.product_id.id,
|
||||
},
|
||||
'domain': [
|
||||
('product_id', '=', self.product_id.id),
|
||||
('company_id', '=', self.company_id.id),
|
||||
'|',
|
||||
('location_id', '=', self.location_id.id),
|
||||
|
||||
@@ -4,17 +4,23 @@
|
||||
<field name="name">stock.move.line.tree</field>
|
||||
<field name="model">stock.move.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Move Lines" create="0" default_order="date">
|
||||
<tree string="Move Lines" create="0" default_order="date desc">
|
||||
<field name="location_usage" invisible="1"/>
|
||||
<field name="location_dest_usage" invisible="1"/>
|
||||
<field name="date"/>
|
||||
<field name="reference" string="Reference"
|
||||
invisible="context.get('no_reference', False)"/>
|
||||
<field name="product_id"/>
|
||||
<field name="lot_id" groups="stock.group_production_lot"/>
|
||||
<field name="location_id" groups="stock.group_stock_multi_locations" />
|
||||
<field name="location_dest_id" groups="stock.group_stock_multi_locations" />
|
||||
<field name="qty_done" string="Quantity Done"/>
|
||||
<field name="product_uom_id" options="{'no_open': True, 'no_create': True}" string="Unit of Measure" groups="uom.group_uom"/>
|
||||
<field name="company_id" groups="base.group_multi_company" force_save="1"/>
|
||||
<field name="lot_id" optional="show" groups="stock.group_production_lot"/>
|
||||
<field name="package_id" optional="hide" groups="stock.group_tracking_lot"/>
|
||||
<field name="result_package_id" optional="hide" groups="stock.group_tracking_lot"/>
|
||||
<field name="location_id"/>
|
||||
<field name="location_dest_id"/>
|
||||
<field name="company_id" optional="hide" groups="base.group_multi_company" force_save="1"/>
|
||||
<field name="qty_done" string="Quantity"
|
||||
decoration-danger="(location_usage in ('internal','transit')) and (location_dest_usage not in ('internal','transit'))"
|
||||
decoration-success="(location_usage not in ('internal','transit')) and (location_dest_usage in ('internal','transit'))"/>
|
||||
<field name="product_uom_id" options="{'no_open': True, 'no_create': True}" string="Unit" groups="uom.group_uom"/>
|
||||
<field name="state" widget='badge' optional="show"
|
||||
decoration-danger="state=='cancel'"
|
||||
decoration-info="state== 'assigned'"
|
||||
@@ -103,12 +109,11 @@
|
||||
<field name="model">stock.move.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Stock Moves">
|
||||
<field name="location_id" string="Location" filter_domain="['|',('location_id', 'ilike', self),('location_dest_id', 'ilike', self)]" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="product_id"/>
|
||||
<field name="picking_id" string="Transfer"/>
|
||||
<field name="reference" string="Reference"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_category_name" string="Category"/>
|
||||
<field name="location_id" string="Source Location" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="location_dest_id" string="Destination Location" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="lot_id" string="Lot/Serial Number" groups="stock.group_production_lot"/>
|
||||
<field name="package_id" string="Source Package" groups="stock.group_tracking_lot"/>
|
||||
<field name="result_package_id" string="Destination Package" groups="stock.group_tracking_lot"/>
|
||||
@@ -146,22 +151,38 @@
|
||||
<field name="model">stock.move.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<kanban class="o_kanban_mobile">
|
||||
<field name="location_id" invisible="1"/>
|
||||
<field name="location_dest_id" invisible="1"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div t-attf-class="oe_kanban_card oe_kanban_global_click">
|
||||
<strong><field name="product_id"/></strong>
|
||||
<field name="picking_id"/>
|
||||
<field name="picking_id" invisible="1"/>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<field name="reference"/>
|
||||
</div>
|
||||
<div class="col-6 text-end">
|
||||
<field name="date"/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<strong><field name="product_id"/></strong>
|
||||
</div>
|
||||
<div groups="stock.group_stock_multi_locations">
|
||||
<field name="location_id"/>
|
||||
→
|
||||
<field name="location_dest_id"/>
|
||||
</div>
|
||||
<div groups="stock.group_production_lot" attrs="{'invisible': [('lot_id', '=', False),('lot_name', '=', False)]}">
|
||||
Lot/SN:
|
||||
<field name="lot_id" attrs="{'invisible': [('lot_id', '=', False),('lot_name', '!=', False)]}"/>
|
||||
<field name="lot_name" attrs="{'invisible': ['|',('lot_id', '!=', False),('lot_name', '=', False)]}"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<field name="lot_id" invisible="not context.get('show_lots_m2o')" groups="stock.group_production_lot" context="{'default_product_id': product_id, 'active_picking_id': picking_id}"/>
|
||||
<field name="lot_name" invisible="not context.get('show_lots_text')" groups="stock.group_production_lot"/>
|
||||
<field name="qty_done" string="Quantity Done"/>
|
||||
<field name="product_uom_id" string="Unit of Measure" groups="uom.group_uom"/>
|
||||
</div>
|
||||
<div class="col-6 text-end">
|
||||
<field name="date"/>
|
||||
<field name="state" widget="label_selection" options="{'classes': {'draft': 'default', 'cancel': 'danger', 'waiting': 'warning', 'confirmed': 'warning', 'done': 'success'}}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -177,7 +198,7 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_mode">tree,kanban,pivot,form</field>
|
||||
<field name="view_id" ref="view_move_line_tree"/>
|
||||
<field name="context">{'search_default_filter_last_12_months': 1, 'search_default_done': 1, 'create': 0}</field>
|
||||
<field name="context">{'search_default_done': 1, 'create': 0}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_empty_folder">
|
||||
There's no product move yet
|
||||
|
||||
@@ -297,7 +297,7 @@
|
||||
<field name="inherit_id" ref="stock.view_move_line_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='state']" position="after">
|
||||
<field name="batch_id" optional="show"/>
|
||||
<field name="batch_id" optional="hide"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user