Bug Add physical lot
This commit is contained in:
@@ -1278,21 +1278,23 @@ class LotQt(
|
||||
LotQt = Pool().get('lot.qt')
|
||||
Lot = Pool().get('lot.lot')
|
||||
purchase = lqt.lot_p.line.purchase
|
||||
lots = []
|
||||
tot_qt = 0
|
||||
for l in vlots:
|
||||
lot,qt = lqt.add_physical_lot(l)
|
||||
lots.append(lot)
|
||||
tot_qt += qt
|
||||
|
||||
#create move for lots
|
||||
Purchase._process_shipment([purchase],lots)
|
||||
|
||||
#update LotQt
|
||||
lqt.lot_quantity -= round(tot_qt,5)
|
||||
if lqt.lot_quantity < 0:
|
||||
lqt.lot_quantity = 0
|
||||
LotQt.save([lqt])
|
||||
lots = []
|
||||
tot_qt = 0
|
||||
with Transaction().set_context(
|
||||
_purchase_trade_skip_quantity_consistency=True):
|
||||
for l in vlots:
|
||||
lot,qt = lqt.add_physical_lot(l)
|
||||
lots.append(lot)
|
||||
tot_qt += qt
|
||||
|
||||
#create move for lots
|
||||
Purchase._process_shipment([purchase],lots)
|
||||
|
||||
#update LotQt
|
||||
lqt.lot_quantity -= round(tot_qt,5)
|
||||
if lqt.lot_quantity < 0:
|
||||
lqt.lot_quantity = 0
|
||||
LotQt.save([lqt])
|
||||
affected_lines = []
|
||||
if lqt.lot_p and lqt.lot_p.line:
|
||||
affected_lines.append(lqt.lot_p.line)
|
||||
|
||||
Reference in New Issue
Block a user