diff --git a/modules/account_stock_anglo_saxon/invoice.py b/modules/account_stock_anglo_saxon/invoice.py index 8cf55a0..fbdc3f0 100755 --- a/modules/account_stock_anglo_saxon/invoice.py +++ b/modules/account_stock_anglo_saxon/invoice.py @@ -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 diff --git a/modules/purchase_trade/fee.py b/modules/purchase_trade/fee.py index 687862f..7d938af 100755 --- a/modules/purchase_trade/fee.py +++ b/modules/purchase_trade/fee.py @@ -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,