Skip to content
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

[FIX] l10n_es_vat_book: Missed copy dictionary method #1223

Merged

Conversation

carlosdauden
Copy link
Contributor

@carlosdauden carlosdauden commented Nov 14, 2019

Resuelve este problema #1221

  • Crear una factura de con importe 0 y con algún recargo de equivalencia en los impuestos
  • Calcular el Libro de IVA en un período que incluya esta factura.
  • Se obtiene el error:

File "/home/odoo/build/OCA/l10n-spain/l10n_es_vat_book/models/l10n_es_vat_book.py", line 265, in upsert_book_line_tax
lambda l: not l['special_tax_group'], implied_lines))
StopIteration

@Tecnativa

@pedrobaeza
Copy link
Member

Supongo que es para solucionar #1221?

@pedrobaeza
Copy link
Member

Pon por favor en el mensaje del commit los pasos para reproducir el problema y por qué esto es la solución

@carlosdauden
Copy link
Contributor Author

Sí, pero bueno, un copy cuando se va a utilizar un diccionario más de una vez siempre va bien 😄

@carlosdauden
Copy link
Contributor Author

Ya digo que no lo he puesto directamente relacionado con el problema porque es algo que ya debería haber hecho cuando se van asignar un diccionario de valores iniciales a varias líneas distintas donde pueden variar esos valores.

@pedrobaeza
Copy link
Member

Ya, pero eso, luego están los commits tan escuetos y se pierde el sentido de las cosas mirando hacia atrás. Haz por favor el esfuerzo. Ejemplo de mensaje de commit: odoo/odoo@4b99272

Y aunque fuera un error de codificación inicial, el caso es que ha surgido a raíz de la publicación del issue, por lo que sí que debe ir vinculado.

@carlosdauden carlosdauden force-pushed the 11.0-FIX-l10n_es_vat_book-balance_zero branch from 97ab62e to 9c98f8d Compare November 14, 2019 18:56
Steps to reproduce the problem:

- Create an invoice with 0 amount, but any line.
- Put in that line a tax "Recargo equivalencia X%".
- Create a VAT book in the interval of the invoice.
- Compute the book
- We get the error

File "/home/odoo/build/OCA/l10n-spain/l10n_es_vat_book/models/l10n_es_vat_book.py", line 265, in upsert_book_line_tax
lambda l: not l['special_tax_group'], implied_lines))
StopIteration

This is due to a reused dictionary in the loop, so we perform a copy of the original dictionary each time.

Fixes OCA#1221
@pedrobaeza pedrobaeza force-pushed the 11.0-FIX-l10n_es_vat_book-balance_zero branch from 9c98f8d to a1e8233 Compare November 14, 2019 22:12
@pedrobaeza
Copy link
Member

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 11.0-ocabot-merge-pr-1223-by-pedrobaeza-bump-patch, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Nov 14, 2019
Signed-off-by pedrobaeza
@pedrobaeza
Copy link
Member

Cherry-pick para 12 en 107ae0e

@OCA-git-bot OCA-git-bot merged commit a1e8233 into OCA:11.0 Nov 14, 2019
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 0b9937c. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants