Skip to content

Conversation

@Andrii9090
Copy link
Contributor

@Andrii9090 Andrii9090 commented Oct 10, 2025

Migración a 18.
Hay otro PR 4251 de la migración de este modulo y nosotros empezamos a trabajar con el código de este PR (en versión hasta commit) para ayudar a terminar la migración, pero al al final hemos ido por diferentes caminos y por eso abro este PR.

La prorrata se calcula en los métodos create y write de account.move

Un vídeo corto con la prueba funcional desde runbot
https://www.loom.com/share/65d61eb381a54ef69093fea0284f19db?sid=fb1fe2b6-ec55-4058-b2a4-a852de28ada4

@moduon MT-11110

etobella and others added 30 commits October 9, 2025 16:32
The VAT prorate tax line should contain the analytic info from the
expense line.

With this commit, we put such information, and make sure that is
synchronized on any change.

TT41832
When doing a refund, the account of the prorate line is changed to the
tax repartition line default one (472).

That's because there's some code on the method `_reverse_move_vals`
that is checking `tax_repartition_line_id` value in the returned
dictionary for ignoring the copied value. See
https://github.com/odoo/odoo/blob/82b1e68b60eb14896666adfd3ad1f753e944d393/addons/account/models/account_move.py#L2515-L2533

What we do for tricking it (as it's atomic and can't be intercepted in
other part) is:

- When copying values, we move the `tax_repartition_line_id` into
  another field name.
- Thus, `_reverse_move_vals` is not modifying the account.
- Immediately after returning from `_reverse_move_vals`, we restored
  the field value.

TT44656
The dynamic lines management has totally changed in this version, so the
code has been rewritten mostly from scratch, but now is cleaner thanks
to the avoid of a lot of hooks.

Some JSON from tests were not correct in previous version due to
rounding, and now they are OK: 10 / 1.2 = 8.3333333, which is 8.33, not
8.34.

TT43236
Currently translated at 100.0% (24 of 24 strings)

Translation: l10n-spain-16.0/l10n-spain-16.0-l10n_es_vat_prorate
Translate-URL: https://translation.odoo-community.org/projects/l10n-spain-16-0/l10n-spain-16-0-l10n_es_vat_prorate/es/
Currently translated at 100.0% (24 of 24 strings)

Translation: l10n-spain-16.0/l10n-spain-16.0-l10n_es_vat_prorate
Translate-URL: https://translation.odoo-community.org/projects/l10n-spain-16-0/l10n-spain-16-0-l10n_es_vat_prorate/ca/
Currently translated at 100.0% (36 of 36 strings)

Translation: l10n-spain-17.0/l10n-spain-17.0-l10n_es_vat_prorate
Translate-URL: https://translation.odoo-community.org/projects/l10n-spain-17-0/l10n-spain-17-0-l10n_es_vat_prorate/es/
Currently translated at 100.0% (36 of 36 strings)

Translation: l10n-spain-17.0/l10n-spain-17.0-l10n_es_vat_prorate
Translate-URL: https://translation.odoo-community.org/projects/l10n-spain-17-0/l10n-spain-17-0-l10n_es_vat_prorate/ca/
…taxes

Odoo screwed up the tax XML-IDs in the middle of the 17.0 lifecycle,
introducing an unfolding of the exempt taxes, using existing ones
that belongs to the sales intra and extra community taxes.

After that, they have renamed the XML-IDs of both taxes to new ones.

We need to handle this in 2 ways:

- Detect and correct existing installations previous to this
  taxpocalypse for renaming them.
- Change the reference in all places to the new XML-IDs.

Besides, we have to add the unfolded exempt taxes in the reports.
When you publish a vendor bill with prorate taxes, and then reset it to
draft and change amounts, there's a chance that Odoo rewrites the
move lines switching the prorated expense and the tax, causing that
the new tax line, being the old expense one, have the flag `vat_prorate`
set, and thus not being included in AEAT reports.

As it seems we can't do anything for assuring the same move lines
processing order upstream, what we do is to force in all the entries
the False value, and then only putting to True when building the
VAT prorate expense line.

TT57089
- account.move~with_special_vat_prorate can't depend on company prorate
  modifications, or this will trigger the line check computation,
  marking/unmarking all the existing invoices.
- Remove double assignation vat_prorate = False.
- Terms homogenized.
- Make prorate tree editable again.
- Better text for invoice line column.
- Translations.
Copy link
Contributor

@ArantxaSudon ArantxaSudon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisión funcional hecha. Buen trabajo

Dejo un vídeo de la prueba funcional
https://www.loom.com/share/a8fd70cb465d40a689dbdf4ec094c9fe

Muchas gracias @Andrii9090

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

1 similar comment
@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@rafaelbn
Copy link
Member

Hola a todos:

Estuvimos hablando con @ValentinVinagre y con @HaraldPanten y estuvimos de acuerdo en terminar en este PR que se puede hacer merge.

Agregamos a los autores del anterior PR como co-autores en un win2win @Tisho99 ping.

Por favor, ¿Le podéis dar una revisión para dejarlo terminado?

Es una prioridad por lo que tenemos tiempo.

Muchas gracias
Saludos

@Tisho99
Copy link
Contributor

Tisho99 commented Oct 27, 2025

Hola @Anxo82 creo que el mensaje de arriba es para ti.

Por parte de Sygel, Anxo es quien estuvo con la migración, aunque si el no puede revisarlo no creo que haya problema en que lo revise otro

PD: Gracias por el trabajo realizado y por indicar la co-autoría

@Anxo82
Copy link
Contributor

Anxo82 commented Oct 27, 2025

Hola a todos:
@rafaelbn , @HaraldPanten he hecho alguna comprobación adicional para probar que las facturas rectificativas también funcionan correctamente y todo OK.

Muchas gracias.

Copy link
Contributor

@EmilioPascual EmilioPascual left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Andrii9090 gracias por el esfuerzo con esta migración.
He revisado funcionalmente y he encontrado algunos bugs.

  1. Hay un error con las rectificativas cuando hay un cambio de periodo de prorrata entre la factura origen y la rectificativa.
  2. Hay un error con las cuentas que selecciona al aplicar la prorrata cuando se tienen diferentes cuentas.

He grabado un vídeo para mostrartelo visualmente:

https://www.loom.com/share/13cedc8c65b14443a8e8aede2ea91685

@Andrii9090
Copy link
Contributor Author

¡@EmilioPascual gracias por revisar!
He modificado el código:
Al generar una factura rectificativa desde una factura de proveedor, se aplica la misma prorrata que en la factura original.
Se asigna correctamente la cuenta, tomando la que corresponde a la línea de la factura.

He grabado una prueba de los cambios
https://www.loom.com/share/52cbb67c16b54ef3926daa4001fd9716

@EmilioPascual
Copy link
Contributor

Siguen fallando algunas cosillas:

  1. Si añado complejidad a la combinación entre cuentas contables e impuestos, no está llevando a la cuenta correcta.
  2. El desarrollo no está teniendo en cuenta la contabilidad analítica.

He grabado un vídeo con estos casos de uso:

https://www.loom.com/share/516ac2c5deb747c79c08c917cf13ec83

Copy link
Member

@rafaelbn rafaelbn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He vuelto a probar mezclando, como comenta Emilio líneas con diferentes impuestos, cuentas contables y cuentas analíticas. He pasado un video interno porque he grabado 16 vs 18 en la instancia del cliente.

El comportamiento efectivamente ha cambiado en algún momento y ahora es no esperado.

Avísame para volver a probar por favor.

Gracias

@HaraldPanten
Copy link
Contributor

Coincido con las pruebas que hizo Emilio y los comentarios de Rafa; el resultado no es el esperado. Ya vais informando sobre los avances.

Gracias.

@Andrii9090 Andrii9090 force-pushed the 18.0-mig-l10n_es_vat_prorate branch 2 times, most recently from 63becec to 222ffe7 Compare October 30, 2025 12:00
@Andrii9090
Copy link
Contributor Author

Hola! He modificado el código contando con las revisiones de @rafaelbn y @EmilioPascual
Aquí grabé un vídeo con pruebas funcionales
https://www.loom.com/share/041b5908d61d479381999c6d01903ab0

Copy link
Contributor

@EmilioPascual EmilioPascual left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excelente trabajo @Andrii9090

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisión de código.

Comment on lines 12 to 13
prorate_id = fields.Many2one(
string="Prorate",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¿en la v18, cuando un campo acaba en _id Odoo no te lo incluye en el string por defecto?

Al menos en versiones anteriores, si quitas string="Prorate", el campo pasaría a llamarse Prorate id...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El campo tiene label Prorate , creo que han cambiado en v18
image

Comment on lines 40 to 41
string="With VAT Prorate",
help="The line will create a vat prorate",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO these lines should be restored.

It was better before than now. Besides, changing translations means more work for the translations team, which can be avoided if they are kept.

readonly=False,
)

prorate_line_ids = fields.Many2many(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: me pregunto igual que antes... ¿El campo no se llamará Prorate line ids? ¿No sería mejor añadirle un string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aquí lo mismo
image

@Andrii9090 Andrii9090 force-pushed the 18.0-mig-l10n_es_vat_prorate branch from 222ffe7 to 2426fdb Compare November 3, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.