30.01.26
This commit is contained in:
@@ -2031,6 +2031,9 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin, InvoiceReportMixin):
|
||||
var_qt = sum([i.quantity for i in gl])
|
||||
logger.info("LOT_TO_PROCESS:%s",lot)
|
||||
logger.info("FEE_TO_PROCESS:%s",gl[0].fee)
|
||||
if (gl[0].fee and not gl[0].product.landed_cost):
|
||||
account_move = gl[0].fee._get_account_move_fee(lot,'in',gl[0].fee.get_non_cog(lot))
|
||||
Move.save([account_move])
|
||||
if (lot and not gl[0].fee) or (gl[0].fee and gl[0].product.landed_cost):
|
||||
adjust_move_lines = []
|
||||
mov = None
|
||||
|
||||
@@ -120,6 +120,23 @@ class Fee(ModelSQL,ModelView):
|
||||
if ml:
|
||||
return round(Decimal(sum([e.credit-e.debit for e in ml if e.description != 'Delivery fee'])),2)
|
||||
|
||||
def get_non_cog(self,lot):
|
||||
MoveLine = Pool().get('account.move.line')
|
||||
Currency = Pool().get('currency.currency')
|
||||
Date = Pool().get('ir.date')
|
||||
AccountConfiguration = Pool().get('account.configuration')
|
||||
account_configuration = AccountConfiguration(1)
|
||||
Uom = Pool().get('product.uom')
|
||||
ml = MoveLine.search([
|
||||
('lot', '=', lot.id),
|
||||
('fee', '=', self.id),
|
||||
('account', '=', self.product.account_stock_in_used.id),
|
||||
])
|
||||
|
||||
logger.info("GET_COG_FEE:%s",ml)
|
||||
if ml:
|
||||
return round(Decimal(sum([e.credit-e.debit for e in ml])),2)
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
@@ -402,7 +419,7 @@ class Fee(ModelSQL,ModelView):
|
||||
|
||||
return fees
|
||||
|
||||
def _get_account_move_fee(self,lot,in_out='in'):
|
||||
def _get_account_move_fee(self,lot,in_out='in',amt = None):
|
||||
pool = Pool()
|
||||
AccountMove = pool.get('account.move')
|
||||
Date = pool.get('ir.date')
|
||||
@@ -439,7 +456,7 @@ class Fee(ModelSQL,ModelView):
|
||||
move_line_.lot = lot
|
||||
move_line_.fee = self
|
||||
move_line_.origin = None
|
||||
amount = self.amount
|
||||
amount = amt if amt else self.amount
|
||||
|
||||
if self.currency != company.currency:
|
||||
with Transaction().set_context(date=today):
|
||||
|
||||
Reference in New Issue
Block a user