[FIX] stock: delivery slip

Complement of commit b0d498c11d

The delivered quantity displayed on the "Delivery Slip" should use the
same UOM than the "Ordered Quantity".

opw-766914
This commit is contained in:
Nicolas Martinelli
2017-08-30 16:12:15 +02:00
parent 1b7e31f341
commit 65f5fc6bf8
2 changed files with 19 additions and 3 deletions
@@ -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])
+8 -3
View File
@@ -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>