Module
quality_control_stock (quality_control_stock_oca in later versions)
Describe the bug
qc.inspection records may have following states: draft, ready, waiting, success, failed, and canceled
|
state = fields.Selection( |
|
[('draft', 'Draft'), |
|
('ready', 'Ready'), |
|
('waiting', 'Waiting supervisor approval'), |
|
('success', 'Quality success'), |
|
('failed', 'Quality failed'), |
|
('canceled', 'Canceled')], |
|
string='State', readonly=True, default='draft') |
In the quality_control_stock (quality_control_stock_oca in later versions) stock.move and stock.production.line is equipped with done_inspections field which is calculated as the number of failed + success records
|
self.passed_inspections = len([x for x in self.qc_inspections if |
|
x.state == 'success']) |
|
self.failed_inspections = len([x for x in self.qc_inspections if |
|
x.state == 'failed']) |
|
self.done_inspections = (self.passed_inspections + |
|
self.failed_inspections) |
However, in the stat button that shows that field
|
<button class="oe_inline oe_stat_button" |
|
type="action" |
|
name="%(action_qc_inspection_per_picking_done)d" |
|
icon="fa-pencil"> |
|
<field name="done_inspections" widget="statinfo" /> |
|
</button> |
links to an action that shows qc.inspection which state is not draft or waiting
|
<record id="action_qc_inspection_per_picking_done" model="ir.actions.act_window"> |
|
<field name="name">Quality inspection from picking done</field> |
|
<field name="res_model">qc.inspection</field> |
|
<field name="view_mode">tree,form</field> |
|
<field name="domain">[('picking', '=', active_id), ('state', 'not in', ['draft', 'waiting'])]</field> |
|
</record> |
which may be different from success + failed because there are ready and canceled states.
To Reproduce
8.0 - 18.0
Steps to reproduce the behavior:
- Install quality_control_stock (or quality_control_stock_oca in later versions)
- Create several qc.inspection records related to a certain stock.picking or stock.production.lot with varying state, especially create some with ready and canceled state.
- Go to the corresponding stock.picking or stock.production.lot, check the figure at the Done button, click the button to display the corresponding records. The number of corresponding records may be different from the figure at the Done button.
Expected behavior
The figure at the Done button should reflect the number of records that is pulled by clicking the button (or vv.)
Additional context
The best solution may be to change the filtering of action_qc_inspection_per_picking_done action
|
<field name="domain">[('picking', '=', active_id), ('state', 'not in', ['draft', 'waiting'])]</field> |
to match the done_inspection logic, which is filter only those with success or failed state.
Module
quality_control_stock (quality_control_stock_oca in later versions)
Describe the bug
qc.inspection records may have following states: draft, ready, waiting, success, failed, and canceled
manufacture/quality_control/models/qc_inspection.py
Lines 57 to 64 in 51a9e81
In the quality_control_stock (quality_control_stock_oca in later versions) stock.move and stock.production.line is equipped with done_inspections field which is calculated as the number of failed + success records
manufacture/quality_control_stock/models/stock_picking.py
Lines 17 to 22 in 51a9e81
However, in the stat button that shows that field
manufacture/quality_control_stock/views/stock_picking_view.xml
Lines 49 to 54 in 51a9e81
manufacture/quality_control_stock/views/stock_picking_view.xml
Lines 12 to 17 in 51a9e81
To Reproduce
8.0 - 18.0
Steps to reproduce the behavior:
Expected behavior
The figure at the Done button should reflect the number of records that is pulled by clicking the button (or vv.)
Additional context
The best solution may be to change the filtering of action_qc_inspection_per_picking_done action
manufacture/quality_control_stock/views/stock_picking_view.xml
Line 16 in 51a9e81