Fee CN/DN

This commit is contained in:
2026-06-16 23:47:35 +02:00
parent d0dd8965cd
commit ee1cb3e7fb
4 changed files with 225 additions and 39 deletions

View File

@@ -2057,10 +2057,16 @@ 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):
fee_correction = (
gl[0].fee
and any(Decimal(str(i.quantity or 0)) < 0 for i in gl)
and any(Decimal(str(i.quantity or 0)) > 0 for i in gl))
if (gl[0].fee and not gl[0].product.landed_cost
and not fee_correction):
diff = gl[0].fee.amount - gl[0].fee.get_non_cog(lot)
account_move = gl[0].fee._get_account_move_fee(lot,'in',diff)
Move.save([account_move])
if account_move:
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