diff --git a/modules/lot/lot.py b/modules/lot/lot.py index 907461e..043ac27 100755 --- a/modules/lot/lot.py +++ b/modules/lot/lot.py @@ -477,15 +477,16 @@ class Lot(ModelSQL, ModelView): else: return str(self.line.currency.symbol) + "/" + str(self.line.unit.symbol) - def get_hist_quantity(self,seq): + def get_hist_quantity(self,state_id=0): qt = Decimal(0) gross_qt = Decimal(0) if self.lot_state: if self.lot_hist: - if seq != 0: - st = seq + if state_id != 0: + st = state_id else: st = self.lot_state.id + logger.info("GET_HIST_QT:%s",st) lot = [e for e in self.lot_hist if e.quantity_type.id == st][0] qt = round(lot.quantity,5) gross_qt = round(lot.gross_quantity,5) @@ -502,21 +503,21 @@ class Lot(ModelSQL, ModelView): physic_sum += round(Decimal(Uom.compute_qty(Uom(l.lot_unit_line),float(l.get_current_quantity()),l.line.unit)),5) return line.quantity_theorical - physic_sum - def get_current_quantity(self,seq=0,name=None): + def get_current_quantity(self,state_id=0,name=None): # if self.lot_type == 'physic': - qt, gross_qt = self.get_hist_quantity(seq) + qt, gross_qt = self.get_hist_quantity(state_id) return qt # else: # return self.get_virtual_diff() - def get_current_quantity_converted(self,seq=0,name=None): + def get_current_quantity_converted(self,state_id=0,name=None): Uom = Pool().get('product.uom') unit = self.line.unit if self.line else self.sale_line.unit - return round(Decimal(Uom.compute_qty(self.lot_unit_line, float(self.get_current_quantity(seq)), unit)),5) + return round(Decimal(Uom.compute_qty(self.lot_unit_line, float(self.get_current_quantity(state_id)), unit)),5) - def get_current_gross_quantity(self,seq=0,name=None): + def get_current_gross_quantity(self,state_id=0,name=None): if self.lot_type == 'physic': - qt, gross_qt = self.get_hist_quantity(seq) + qt, gross_qt = self.get_hist_quantity(state_id) return gross_qt else: return None