diff --git a/modules/purchase_trade/lot.py b/modules/purchase_trade/lot.py index c8ac26c..2fdd0a6 100755 --- a/modules/purchase_trade/lot.py +++ b/modules/purchase_trade/lot.py @@ -1253,6 +1253,8 @@ class LotQt( 'lot_theoretical_qt': theoretical, 'lot_tol_min': tol_min, 'lot_tol_max': tol_max, + 'lot_tolerance_min': -tol_min, + 'lot_tolerance_max': tol_max, 'lot_qt_min': round( theoretical * (Decimal(1) - tol_min / Decimal(100)), 5), 'lot_qt_max': round( @@ -3160,12 +3162,10 @@ class LotMatchingLot(ModelView): lot_qt_max = fields.Numeric("Qt max", readonly=True) lot_tol_min = fields.Numeric("Tol -", readonly=True) lot_tol_max = fields.Numeric("Tol +", readonly=True) + lot_tolerance_min = fields.Numeric("Tolerance min", readonly=True) + lot_tolerance_max = fields.Numeric("Tolerance max", readonly=True) lot_tolerance_used = fields.Function( fields.Numeric("Tolerance used"), 'on_change_with_lot_tolerance_used') - lot_tolerance_min = fields.Function( - fields.Numeric("Tolerance min"), 'on_change_with_lot_tolerance_min') - lot_tolerance_max = fields.Function( - fields.Numeric("Tolerance max"), 'on_change_with_lot_tolerance_max') lot_unit = fields.Many2One('product.uom',"Unit",readonly=True) lot_matched_qt = fields.Numeric("Qt to match") lot_cp = fields.Many2One('party.party',"Counterparty") @@ -3193,14 +3193,6 @@ class LotMatchingLot(ModelView): return round( ((projected - theoretical) / theoretical) * Decimal(100), 5) - @fields.depends('lot_tol_min') - def on_change_with_lot_tolerance_min(self, name=None): - return -Decimal(str(self.lot_tol_min or 0)) - - @fields.depends('lot_tol_max') - def on_change_with_lot_tolerance_max(self, name=None): - return Decimal(str(self.lot_tol_max or 0)) - def get_shipment_origin(self, name): if self.lot_shipment_in: return 'stock.shipment.in,' + str(self.lot_shipment_in.id) diff --git a/modules/purchase_trade/tests/test_module.py b/modules/purchase_trade/tests/test_module.py index 522b999..eff3f23 100644 --- a/modules/purchase_trade/tests/test_module.py +++ b/modules/purchase_trade/tests/test_module.py @@ -2770,18 +2770,12 @@ class PurchaseTradeTestCase(ModuleTestCase): matching_lot.lot_theoretical_qt = Decimal('100') matching_lot.lot_already_matched_qt = Decimal('40') matching_lot.lot_matched_qt = Decimal('65') - matching_lot.lot_tol_min = Decimal('5') - matching_lot.lot_tol_max = Decimal('10') + matching_lot.lot_tolerance_min = Decimal('-5') + matching_lot.lot_tolerance_max = Decimal('10') self.assertEqual( matching_lot.on_change_with_lot_tolerance_used(), Decimal('5.00000')) - self.assertEqual( - matching_lot.on_change_with_lot_tolerance_min(), - Decimal('-5')) - self.assertEqual( - matching_lot.on_change_with_lot_tolerance_max(), - Decimal('10')) def test_go_matching_defaults_selected_open_lot_qts(self): 'go to matching only preloads selected unmatched open lot.qt rows'