Fee FI bug
This commit is contained in:
@@ -317,14 +317,26 @@ class Fee(ModelSQL,ModelView):
|
||||
if self.product:
|
||||
return self.product.template.landed_cost
|
||||
|
||||
def get_quantity(self,name=None):
|
||||
qt = self.get_fee_lots_qt()
|
||||
if qt:
|
||||
return qt
|
||||
LotQt = Pool().get('lot.qt')
|
||||
lqts = LotQt.search(['lot_shipment_in','=',self.shipment_in.id])
|
||||
if lqts:
|
||||
return Decimal(lqts[0].lot_quantity)
|
||||
def get_quantity(self,name=None):
|
||||
qt = self.get_fee_lots_qt()
|
||||
if qt:
|
||||
return qt
|
||||
line = self.line or self.sale_line
|
||||
if line and line.lots:
|
||||
return sum(
|
||||
Decimal(lot.get_current_quantity_converted(0, self.unit))
|
||||
for lot in line.lots)
|
||||
LotQt = Pool().get('lot.qt')
|
||||
if self.shipment_in:
|
||||
lqts = LotQt.search(['lot_shipment_in','=',self.shipment_in.id])
|
||||
if lqts:
|
||||
return Decimal(lqts[0].lot_quantity)
|
||||
|
||||
def _get_amount_quantity(self):
|
||||
quantity = self.quantity
|
||||
if quantity is None:
|
||||
quantity = self.get_quantity()
|
||||
return Decimal(quantity or 0)
|
||||
|
||||
def get_amount(self,name=None):
|
||||
Date = Pool().get('ir.date')
|
||||
@@ -358,7 +370,7 @@ class Fee(ModelSQL,ModelView):
|
||||
compounding='simple'
|
||||
)
|
||||
|
||||
return round(factor * self.line.unit_price * (self.quantity if self.quantity else 0) * sign,2)
|
||||
return round(factor * self.line.unit_price * self._get_amount_quantity() * sign,2)
|
||||
if self.sale_line:
|
||||
if self.sale_line.sale.payment_term:
|
||||
beg_date = self.fee_date if self.fee_date else Date.today()
|
||||
@@ -374,7 +386,7 @@ class Fee(ModelSQL,ModelView):
|
||||
compounding='simple'
|
||||
)
|
||||
logger.info("FACTOR:%s",factor)
|
||||
return round(factor * self.sale_line.unit_price * (self.quantity if self.quantity else 0) * sign,2)
|
||||
return round(factor * self.sale_line.unit_price * self._get_amount_quantity() * sign,2)
|
||||
|
||||
elif self.mode == 'perqt':
|
||||
if self.shipment_in:
|
||||
|
||||
Reference in New Issue
Block a user