04.02.26
This commit is contained in:
@@ -503,9 +503,9 @@ 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,state_id=0,name=None):
|
||||
def get_current_quantity(self,name=None):
|
||||
# if self.lot_type == 'physic':
|
||||
qt, gross_qt = self.get_hist_quantity(state_id)
|
||||
qt, gross_qt = self.get_hist_quantity()
|
||||
return qt
|
||||
# else:
|
||||
# return self.get_virtual_diff()
|
||||
@@ -513,11 +513,12 @@ class Lot(ModelSQL, ModelView):
|
||||
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(state_id)), unit)),5)
|
||||
qt, gross_qt = self.get_hist_quantity(state_id)
|
||||
return round(Decimal(Uom.compute_qty(self.lot_unit_line, float(qt), unit)),5)
|
||||
|
||||
def get_current_gross_quantity(self,state_id=0,name=None):
|
||||
def get_current_gross_quantity(self,name=None):
|
||||
if self.lot_type == 'physic':
|
||||
qt, gross_qt = self.get_hist_quantity(state_id)
|
||||
qt, gross_qt = self.get_hist_quantity()
|
||||
return gross_qt
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -1931,12 +1931,12 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
|
||||
elif fee[0].mode == 'ppack':
|
||||
invoice_line.quantity = fee[0].quantity
|
||||
else:
|
||||
seq = 0
|
||||
state_id = 0
|
||||
LotQtType = Pool().get('lot.qt.type')
|
||||
lqt = LotQtType.search([('name','=','BL')])
|
||||
if lqt:
|
||||
seq = lqt[0].sequence
|
||||
invoice_line.quantity = fee[0].get_fee_lots_qt(seq)
|
||||
state_id = lqt[0].id
|
||||
invoice_line.quantity = fee[0].get_fee_lots_qt(state_id)
|
||||
|
||||
lines.append(invoice_line)
|
||||
logger.info("GETINVLINE:%s",self.product.type)
|
||||
|
||||
@@ -334,12 +334,12 @@ class Fee(ModelSQL,ModelView):
|
||||
|
||||
return super().copy(fees, default=default)
|
||||
|
||||
def get_fee_lots_qt(self,seq=0):
|
||||
def get_fee_lots_qt(self,state_id=0):
|
||||
qt = Decimal(0)
|
||||
FeeLots = Pool().get('fee.lots')
|
||||
fee_lots = FeeLots.search([('fee', '=', self.id)])
|
||||
if fee_lots:
|
||||
qt = sum([e.lot.get_current_quantity_converted(seq) for e in fee_lots])
|
||||
qt = sum([e.lot.get_current_quantity_converted(state_id) for e in fee_lots])
|
||||
logger.info("GET_FEE_LOTS_QT:%s",qt)
|
||||
return qt
|
||||
|
||||
|
||||
Reference in New Issue
Block a user