Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] account_withholding: compute tax_repartition_line_id when accou…
…nt payment group is posted Ticket: 62171
- Loading branch information
1 parent
45b6f78
commit 8d0e6da
Showing
3 changed files
with
18 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
account_withholding/migrations/16.0.1.2.0/post-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from openupgradelib import openupgrade | ||
import logging | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
withholdings = env['account.payment'].search([]).filtered(lambda x: x.tax_withholding_id and x.state == 'posted') | ||
for withholding in withholdings: | ||
liquidity_lines, counterpart_lines, writeoff_lines = withholding._seek_for_lines() | ||
if not liquidity_lines.tax_repartition_line_id or not liquidity_lines.tax_line_id: | ||
rep_line = withholding._get_withholding_repartition_line() | ||
liquidity_lines.tax_repartition_line_id = rep_line | ||
liquidity_lines.tax_line_id = rep_line.tax_id | ||
logger.info('Se computaron campos tax_repartition_line_id y tax_line_id en líneas de retenciones ya publicadas') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters