-
-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[17.0][IMP] l10n_es_igic: Added pre-migration script #3867
base: 17.0
Are you sure you want to change the base?
Conversation
} | ||
|
||
|
||
def rename_taxes_xmlids(env, company_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La variable contiene un recordset, no un id, por lo que no debe llevar el sufijo _id
.
def rename_taxes_xmlids(env, company_id): | |
def rename_taxes_xmlids(env, company): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hecho
taxes_to_merge |= tax_id | ||
tax_to_merge_into = env.ref(f"account.{company_id.id}_{taxes[1]}", False) | ||
if len(taxes_to_merge) > 0 and tax_to_merge_into: | ||
openupgrade_merge_records.merge_records( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Antes de hacer esto, hay que fusionar las account.tax.repartition.line
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Siguiendo la documentación he optado por mantener el one2many en el impuesto target, evitando así duplicados. He cambiado un poco la lógica, antes fusionaba los impuestos anteriores con uno de los nuevos, ahora fusiono los anteriores con su similar anterior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, pero es que aquí no vale, porque puede haber facturas que tengan enlazadas esas repartition line en el many2one correspondiente, y entonces necesitas que ahora refieran a la repartition line correspondiente del impuesto fusionado. Fíjate que el campo tax_line_id
de account.move.line
es un campo calculado que depende de tax_repartition_line_id
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vale ya te entendí, lo reviso
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
He añadido lo que comentabas, cambiado las tuplas por arrays para asegurar la iteración correcta y para comparar las repartition_lines he usado (repartition_type,document_type,account_id)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Además he cambiado la forma de ejecutarse a SQL para evitar las restricciones de edición de las facturas
fc7d7fc
to
db0436d
Compare
db0436d
to
13a1455
Compare
Script para corregir los impuestos y cuentas, échadle un ojo @etobella @pedrobaeza, lo he probado múltiples veces con una máquina de pruebas y parece funcionar correctamente.