diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2017-08-30 10:30:51 +0200 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2017-08-30 16:12:15 +0200 |
| commit | 65f5fc6bf8442fc7004d0fc8e006184359f0fe4e (patch) | |
| tree | 62fbf53fd02247d8fd809ca2c86b034c2330a77d | |
| parent | 1b7e31f341ff40dff060cc244cab296bf530125f (diff) | |
[FIX] stock: delivery slip
Complement of commit b0d498c11dd46c608e29f16067ef64a922e3ffc1
The delivered quantity displayed on the "Delivery Slip" should use the
same UOM than the "Ordered Quantity".
opw-766914
| -rw-r--r-- | addons/stock/models/stock_pack_operation.py | 11 | ||||
| -rw-r--r-- | addons/stock/report/report_deliveryslip.xml | 11 |
2 files changed, 19 insertions, 3 deletions
diff --git a/addons/stock/models/stock_pack_operation.py b/addons/stock/models/stock_pack_operation.py index 8cdf5d5ce09..b06a977a90b 100644 --- a/addons/stock/models/stock_pack_operation.py +++ b/addons/stock/models/stock_pack_operation.py @@ -34,6 +34,9 @@ class PackOperation(models.Model): product_qty = fields.Float('To Do', default=0.0, digits=dp.get_precision('Product Unit of Measure'), required=True) ordered_qty = fields.Float('Ordered Quantity', digits=dp.get_precision('Product Unit of Measure')) qty_done = fields.Float('Done', default=0.0, digits=dp.get_precision('Product Unit of Measure')) + qty_done_uom_ordered = fields.Float( + 'Quantity Done', digits=dp.get_precision('Product Unit of Measure'), compute='_compute_qty_done_uom_ordered', + help='Quantity done in UOM ordered') is_done = fields.Boolean(compute='_compute_is_done', string='Done', readonly=False, oldname='processed_boolean') package_id = fields.Many2one('stock.quant.package', 'Source Package') pack_lot_ids = fields.One2many('stock.pack.operation.lot', 'operation_id', 'Lots/Serial Numbers Used') @@ -126,6 +129,14 @@ class PackOperation(models.Model): else: self.lots_visible = self.product_id.tracking != 'none' + @api.multi + def _compute_qty_done_uom_ordered(self): + for pack in self: + if pack.product_uom_id and pack.linked_move_operation_ids: + pack.qty_done_uom_ordered = pack.product_uom_id._compute_quantity(pack.qty_done, pack.linked_move_operation_ids[0].move_id.product_uom) + else: + pack.qty_done_uom_ordered = pack.qty_done + @api.onchange('pack_lot_ids') def _onchange_packlots(self): self.qty_done = sum([x.qty for x in self.pack_lot_ids]) diff --git a/addons/stock/report/report_deliveryslip.xml b/addons/stock/report/report_deliveryslip.xml index 615a1534492..a6866cdc9aa 100644 --- a/addons/stock/report/report_deliveryslip.xml +++ b/addons/stock/report/report_deliveryslip.xml @@ -119,11 +119,16 @@ </t> </td> <td class="text-right" t-if="pack_operation.state == 'done'"> - <t t-if="pack_operation.ordered_qty != pack_operation.qty_done"> + <t t-if="pack_operation.ordered_qty != pack_operation.qty_done_uom_ordered"> <t t-set="backorder" t-value="True"/> </t> - <span t-field="pack_operation.qty_done"/> - <span t-field="pack_operation.product_uom_id"/> + <span t-field="pack_operation.qty_done_uom_ordered"/> + <t t-if="pack_operation.linked_move_operation_ids"> + <span t-field="pack_operation.linked_move_operation_ids[0].move_id.product_uom"></span> + </t> + <t t-else="1"> + <span t-field="pack_operation.product_uom_id"></span> + </t> </td> </tr> </tbody> |
