mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[FIX] computation of remaining qty
[FIX] test_flake8 [FIX] - use the already existing field product_qty - fix picking edition by warehouse user due to related none readonly field
This commit is contained in:
@@ -19,4 +19,4 @@ class StockMove(models.Model):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
picking_type_code = fields.Selection(
|
||||
related='picking_type_id.code', store=True)
|
||||
related='picking_type_id.code', store=True, readonly=True)
|
||||
|
||||
@@ -17,20 +17,18 @@ class AssignManualQuants(models.TransientModel):
|
||||
if record.quants_lines:
|
||||
move = self.env['stock.move'].browse(
|
||||
self.env.context['active_id'])
|
||||
move_qty = self.env['product.uom']._compute_qty_obj(
|
||||
move.product_uom, move.product_uom_qty, move.product_id.uom_id)
|
||||
if record.lines_qty > move_qty:
|
||||
if record.lines_qty > move.product_qty:
|
||||
raise exceptions.Warning(
|
||||
_('Quantity is higher than the needed one'))
|
||||
|
||||
@api.depends('quants_lines', 'quants_lines.qty')
|
||||
def _compute_qties(self):
|
||||
move = self.env['stock.move'].browse(self.env.context['active_id'])
|
||||
lines_qty = sum(self.quants_lines.mapped('qty'))
|
||||
|
||||
lines_qty = sum(quant_line.qty for quant_line in self.quants_lines
|
||||
if quant_line.selected)
|
||||
self.lines_qty = lines_qty
|
||||
move_qty = self.env['product.uom']._compute_qty_obj(
|
||||
move.product_uom, move.product_uom_qty, move.product_id.uom_id)
|
||||
self.move_qty = move_qty - lines_qty
|
||||
self.move_qty = move.product_qty - lines_qty
|
||||
|
||||
name = fields.Char(string='Name')
|
||||
lines_qty = fields.Float(
|
||||
|
||||
Reference in New Issue
Block a user