Skip to content

Commit

Permalink
[FIX] account_withholding: compute tax_repartition_line_id when accou…
Browse files Browse the repository at this point in the history
…nt payment group is posted

closes #371

Ticket: 62171
Signed-off-by: Juan José Scarafía <jjs@adhoc.com.ar>
  • Loading branch information
pablohmontenegro committed Jun 13, 2023
1 parent 45b6f78 commit 1eae07b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion account_withholding/__manifest__.py
Expand Up @@ -34,5 +34,5 @@
'installable': True,
'name': 'Withholdings on Payments',
'test': [],
'version': "16.0.1.1.0",
'version': "16.0.2.0.0",
}
9 changes: 9 additions & 0 deletions account_withholding/migrations/16.0.2.0.0/post-migration.py
@@ -0,0 +1,9 @@
from openupgradelib import openupgrade
import logging
logger = logging.getLogger(__name__)


@openupgrade.migrate()
def migrate(env, version):
env['account.move.line'].search([('tax_repartition_line_id', '!=', False), ('create_date', '>', '2023-01-1'), ('tax_state', '=', False)])._compute_tax_state()
logger.info('Se computaron campos tax_repartition_line_id y tax_line_id en líneas de retenciones ya publicadas')
6 changes: 2 additions & 4 deletions account_withholding/models/account_payment.py
Expand Up @@ -64,10 +64,8 @@ def action_post(self):
for withholding in withholdings:
liquidity_lines, counterpart_lines, writeoff_lines = withholding._seek_for_lines()
rep_line = withholding._get_withholding_repartition_line()
liquidity_lines._write({
'tax_repartition_line_id': rep_line.id,
'tax_line_id': rep_line.tax_id.id,
})
liquidity_lines.tax_repartition_line_id = rep_line
liquidity_lines.tax_line_id = rep_line.tax_id
return res

def action_draft(self):
Expand Down

0 comments on commit 1eae07b

Please sign in to comment.