mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[FIX] stock_quant_manual_assign: computed field is not the same
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
from openerp import api, exceptions, fields, models, _
|
||||
import openerp.addons.decimal_precision as dp
|
||||
from openerp.tools.float_utils import float_compare
|
||||
|
||||
|
||||
class AssignManualQuants(models.TransientModel):
|
||||
@@ -13,13 +14,14 @@ class AssignManualQuants(models.TransientModel):
|
||||
@api.multi
|
||||
@api.constrains('quants_lines')
|
||||
def check_qty(self):
|
||||
for record in self:
|
||||
if record.quants_lines:
|
||||
move = self.env['stock.move'].browse(
|
||||
self.env.context['active_id'])
|
||||
if record.lines_qty > move.product_qty:
|
||||
raise exceptions.Warning(
|
||||
_('Quantity is higher than the needed one'))
|
||||
precision_digits = dp.get_precision('Product Unit of Measure'
|
||||
)(self.env.cr)[1]
|
||||
move = self.env['stock.move'].browse(self.env.context['active_id'])
|
||||
for record in self.filtered(lambda x: x.quants_lines):
|
||||
if float_compare(record.lines_qty, move.product_qty,
|
||||
precision_digits=precision_digits) > 0:
|
||||
raise exceptions.Warning(
|
||||
_('Quantity is higher than the needed one'))
|
||||
|
||||
@api.depends('quants_lines', 'quants_lines.qty')
|
||||
def _compute_qties(self):
|
||||
|
||||
Reference in New Issue
Block a user