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_it_delivery_note: fix delivery note invoice assignment by using invoice IDs #4591

Conversation

GSLabIt
Copy link
Contributor

@GSLabIt GSLabIt commented Jan 30, 2025

Fix Mixing apples and oranges.

File "/opt/odoo/custom/oca/l10n-italy/l10n_it_delivery_note/wizard/delivery_note_create.py", line 132, in confirm
sale_order_id._assign_delivery_notes_invoices(sale_order_id.invoice_ids)
File "/opt/odoo/custom/oca/l10n-italy/l10n_it_delivery_note/models/sale_order.py", line 92, in _assign_delivery_notes_invoices
ready_invoice_ids = [
File "/opt/odoo/custom/oca/l10n-italy/l10n_it_delivery_note/models/sale_order.py", line 95, in
if invoice_id in invoice_ids
File "/usr/lib/python3/dist-packages/odoo/models.py", line 5601, in contains
raise TypeError("Mixing apples and oranges: %s in %s" % (item, self))
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 652, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 317, in _handle_exception
raise exception.with_traceback(None) from new_cause
TypeError: Mixing apples and oranges: 899717 in account.move(899717,)

@OCA-git-bot
Copy link
Contributor

Hi @MarcoCalcagni, @renda-dev, @aleuffre,
some modules you are maintaining are being modified, check this out!

@francesco-ooops
Copy link
Contributor

@GSLabIt grazie della PR! puoi verificare se l'errore sussiste anche nella 16?

Copy link
Contributor

@aleuffre aleuffre left a comment

Choose a reason for hiding this comment

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

Code review, LGTM

(In alternativa, si poteva considerare di passare il recordset e adattare la funzione _assign_delivery_notes_invoices, credo sia meglio lavorare con i recordset quando si può)

@GSLabIt
Copy link
Contributor Author

GSLabIt commented Jan 30, 2025

Code review, LGTM

(In alternativa, si poteva considerare di passare il recordset e adattare la funzione _assign_delivery_notes_invoices, credo sia meglio lavorare con i recordset quando si può)

Ci ho pensato, e sarebbe una cosa sensata ... ma sono stato già cazziato in passato per aver modificato una cosa del genere ..per cui ho scelto di legare l'asino ...

vedi anche questa:

def _generate_delivery_note_lines(self, invoice_ids):
invoices = self.env["account.move"].browse(invoice_ids)
invoices.update_delivery_note_lines()

@francesco-ooops
Copy link
Contributor

@tafaRU @Borruso @TheMule71 abbiamo errori bloccanti in produzione che derivano da #2569

Possibile fare review e merge in tempi brevi? Grazie!

Copy link
Contributor

@Borruso Borruso left a comment

Choose a reason for hiding this comment

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

LGTM

@Borruso
Copy link
Contributor

Borruso commented Jan 31, 2025

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

Sorry @Borruso you are not allowed to merge.

To do so you must either have push permissions on the repository, or be a declared maintainer of all modified addons.

If you wish to adopt an addon and become it's maintainer, open a pull request to add your GitHub login to the maintainers key of its manifest.

@francesco-ooops
Copy link
Contributor

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 14.0-ocabot-merge-pr-4591-by-francesco-ooops-bump-patch, awaiting test results.

@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at fb14058. 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.

l10n_it_delivery_note: fix delivery note invoice assignment by using invoice IDs
5 participants