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

[14.0][FIX] l10n_it_fatturapa_in: Fixed singleton error on field computation #2355

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion l10n_it_fatturapa_in/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ def e_inv_dati_ritenuta(self):
"invoice_date",
)
def _compute_e_invoice_validation_error(self):
self.ensure_one()
self.e_invoice_validation_error = False
self.e_invoice_validation_message = False
Copy link
Member

Choose a reason for hiding this comment

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

Da odoo/odoo@9920f20 è possibile assegnare un valore ad un campo per più record, quindi per risolvere il problema credo sia sufficente rimuovere self.ensure_one, puoi provare?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Funziona. Ho anche aggiunto un piccolo test, provato prima e dopo la patch.

Copy link
Member

Choose a reason for hiding this comment

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

Grazie, puoi dare un nome più significativo al test e/o aggiungere una docstring?
test_2349_fix non fa capire cosa dovrebbe testare.


Expand Down
6 changes: 6 additions & 0 deletions l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,12 @@ def test_xml_import_summary_tax_rate(self):
self.assertEqual(invoice.invoice_line_ids[1].price_unit, 3.52)
self.assertEqual(invoice.invoice_line_ids[1].quantity, 1.0)

def test_e_invoice_field_compute(self):
"""Check successful creation of multiple invoices.
See https://github.com/OCA/l10n-italy/issues/2349"""
invoices = self.invoice_model.create([{}, {}])
self.assertEqual(invoices.mapped("e_invoice_validation_error"), [False, False])


class TestFatturaPAEnasarco(FatturapaCommon):
def setUp(self):
Expand Down