This commit is contained in:
2026-01-29 10:31:42 +01:00
parent 7155708d4b
commit 9447a685f2
2 changed files with 17 additions and 7 deletions

View File

@@ -177,4 +177,14 @@ class InvoiceLine(metaclass=PoolMeta):
anglo_saxon_move_lines = self._get_anglo_saxon_move_lines(
cost, type_)
result.extend(anglo_saxon_move_lines)
#Fee inventoried delivery management
if self.lot:
FeeLots = Pool().get('fee.lots')
fees = FeeLots.search(['lot','=',self.lot.id])
for fl in fees:
if fl.fee.type == 'ordered' and fl.fee.product.template.landed_cost:
AccountMove = Pool().get('account.move')
account_move = fl.fee._get_account_move_fee(fl.lot,'out')
AccountMove.save([account_move])
return result

View File

@@ -195,7 +195,7 @@ class Fee(ModelSQL,ModelView):
def get_landed_status(self,name):
if self.product:
return self.product.landed_cost
return self.product.template.landed_cost
def get_quantity(self,name=None):
qt = self.get_fee_lots_qt()
@@ -376,7 +376,7 @@ class Fee(ModelSQL,ModelView):
if not fee.sale_line:
feelots = FeeLots.search(['fee','=',fee.id])
for fl in feelots:
if fee.product.landed_cost:
if fee.product.template.landed_cost:
move = fl.lot.get_received_move()
if move:
Warning = Pool().get('res.user.warning')
@@ -394,7 +394,7 @@ class Fee(ModelSQL,ModelView):
return fees
def _get_account_move_fee(self,lot):
def _get_account_move_fee(self,lot,in_out='in'):
pool = Pool()
AccountMove = pool.get('account.move')
Date = pool.get('ir.date')
@@ -404,7 +404,7 @@ class Fee(ModelSQL,ModelView):
if self.product.type != 'service':
return
if self.product.landed_cost:
if self.product.template.landed_cost:
return
today = Date.today()
@@ -451,7 +451,7 @@ class Fee(ModelSQL,ModelView):
move_line.amount_second_currency = amount_converted
move_line_.debit = Decimal(0)
move_line_.credit = amount
move_line_.account = self.product.account_stock_in_used
move_line_.account = self.product.account_stock_in_used if in_out == 'in' else self.product.account_stock_out_used
if hasattr(move_line_, 'second_currency') and move_line_.second_currency:
move_line_.amount_second_currency = -amount_converted
else:
@@ -462,7 +462,7 @@ class Fee(ModelSQL,ModelView):
move_line.amount_second_currency = -amount_converted
move_line_.debit = amount
move_line_.credit = Decimal(0)
move_line_.account = self.product.account_stock_in_used
move_line_.account = self.product.account_stock_in_used if in_out == 'in' else self.product.account_stock_out_used
if hasattr(move_line_, 'second_currency') and move_line_.second_currency:
move_line_.amount_second_currency = amount_converted
@@ -475,7 +475,7 @@ class Fee(ModelSQL,ModelView):
journal = journal[0]
description = None
description = 'Fee not inventoried'
description = 'Fee'
return AccountMove(
journal=journal,
period=period,