OCA / l10n-italy

Odoo Italian localization
https://www.odoo-italia.org
GNU Affero General Public License v3.0
142 stars 297 forks source link

l10n_it_bill_of_entry: Gestione del multi-azienda nei test #4192

Open SirAionTech opened 4 weeks ago

SirAionTech commented 4 weeks ago

Module

l10n_it_bill_of_entry

Describe the bug

I test del modulo in oggetto ogni tanto falliscono, a volte addirittura vanno bene in Odoo e non in OCB o viceversa: image (da https://github.com/OCA/l10n-italy/actions/runs/9382740516) l'errore è

odoo.exceptions.AccessError: Due to security restrictions, you are not allowed to access 'Tax' (account.tax) records.

Stack trace
2024-06-05 10:54:17,219 511 ERROR odoo odoo.addons.l10n_it_bill_of_entry.tests.test_bill_of_entry: ERROR: TestBillOfEntry.test_generate_bill_of_entry Traceback (most recent call last): File "/opt/odoo/odoo/api.py", line 1007, in get cache_value = field_cache[record._ids[0]] KeyError: During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/odoo/odoo/fields.py", line 1161, in __get__ value = env.cache.get(record, self) File "/opt/odoo/odoo/api.py", line 1014, in get raise CacheMiss(record, field) odoo.exceptions.CacheMiss: 'account.move(,).tax_totals' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/odoo/odoo/api.py", line 1007, in get cache_value = field_cache[record._ids[0]] KeyError: 106 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/odoo/odoo/fields.py", line 1161, in __get__ value = env.cache.get(record, self) File "/opt/odoo/odoo/api.py", line 1014, in get raise CacheMiss(record, field) odoo.exceptions.CacheMiss: 'account.tax(106,).company_id' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/odoo/odoo/fields.py", line 1187, in __get__ recs._fetch_field(self) File "/opt/odoo/odoo/models.py", line 3201, in _fetch_field self._read(fnames) File "/opt/odoo/odoo/models.py", line 3327, in _read raise self.env['ir.rule']._make_access_error('read', forbidden) odoo.exceptions.AccessError: Due to security restrictions, you are not allowed to access 'Tax' (account.tax) records. Contact your administrator to request access if necessary. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/odoo/odoo/fields.py", line 1210, in __get__ self.compute_value(recs) File "/opt/odoo/odoo/fields.py", line 2358, in compute_value super().compute_value(records) File "/opt/odoo/odoo/fields.py", line 1392, in compute_value records._compute_field_value(self) File "/opt/odoo/addons/mail/models/mail_thread.py", line 403, in _compute_field_value return super()._compute_field_value(field) File "/opt/odoo/odoo/models.py", line 4232, in _compute_field_value fields.determine(field.compute, self) File "/opt/odoo/odoo/fields.py", line 98, in determine return needle(*args) File "/opt/odoo/addons/account/models/account_move.py", line 1219, in _compute_tax_totals move.tax_totals = self.env['account.tax']._prepare_tax_totals(**kwargs) File "/opt/odoo/addons/account/models/account_tax.py", line 1225, in _prepare_tax_totals to_update_vals, tax_values_list = self._compute_taxes_for_single_line(base_line) File "/opt/odoo/addons/account/models/account_tax.py", line 876, in _compute_taxes_for_single_line taxes_res = taxes.with_context(**base_line['extra_context']).compute_all( File "/opt/odoo/addons/account/models/account_tax.py", line 481, in compute_all company = self[0].company_id File "/opt/odoo/odoo/fields.py", line 2804, in __get__ return super().__get__(records, owner) File "/opt/odoo/odoo/fields.py", line 1189, in __get__ record._fetch_field(self) File "/opt/odoo/odoo/models.py", line 3201, in _fetch_field self._read(fnames) File "/opt/odoo/odoo/models.py", line 3327, in _read raise self.env['ir.rule']._make_access_error('read', forbidden) odoo.exceptions.AccessError: Due to security restrictions, you are not allowed to access 'Tax' (account.tax) records. Contact your administrator to request access if necessary. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/odoo/odoo/api.py", line 1007, in get cache_value = field_cache[record._ids[0]] KeyError: 106 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/odoo/odoo/fields.py", line 1161, in __get__ value = env.cache.get(record, self) File "/opt/odoo/odoo/api.py", line 1014, in get raise CacheMiss(record, field) odoo.exceptions.CacheMiss: 'account.tax(106,).company_id' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/odoo/odoo/fields.py", line 1187, in __get__ recs._fetch_field(self) File "/opt/odoo/odoo/models.py", line 3201, in _fetch_field self._read(fnames) File "/opt/odoo/odoo/models.py", line 3327, in _read raise self.env['ir.rule']._make_access_error('read', forbidden) odoo.exceptions.AccessError: Due to security restrictions, you are not allowed to access 'Tax' (account.tax) records. Contact your administrator to request access if necessary. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/__w/l10n-italy/l10n-italy/l10n_it_bill_of_entry/tests/test_bill_of_entry.py", line 146, in setUp self.bill_of_entry = self._create_invoice( File "/__w/l10n-italy/l10n-italy/l10n_it_bill_of_entry/tests/test_bill_of_entry.py", line 27, in _create_invoice with invoice_form.invoice_line_ids.new() as line: File "/opt/odoo/odoo/tests/common.py", line 2298, in __exit__ self.save() File "/opt/odoo/odoo/tests/common.py", line 2635, in save proxy._parent._perform_onchange([proxy._field], self._env.context) File "/opt/odoo/odoo/tests/common.py", line 2440, in _perform_onchange result = record.onchange(self._onchange_values(), fields, spec) File "/opt/odoo/addons/account/models/account_move.py", line 2423, in onchange return super().onchange(values, field_name, field_onchange) File "/opt/odoo/odoo/models.py", line 6613, in onchange todo = [ File "/opt/odoo/odoo/models.py", line 6616, in if name not in done and snapshot0.has_changed(name) File "/opt/odoo/odoo/models.py", line 6399, in has_changed return self[name] != record[name] File "/opt/odoo/odoo/models.py", line 5[948](https://github.com/OCA/l10n-italy/actions/runs/9382740516/job/25834819882#step:8:949), in __getitem__ return self._fields[key].__get__(self, self.env.registry[self._name]) File "/opt/odoo/odoo/fields.py", line 1212, in __get__ self.compute_value(record) File "/opt/odoo/odoo/fields.py", line 2358, in compute_value super().compute_value(records) File "/opt/odoo/odoo/fields.py", line 1392, in compute_value records._compute_field_value(self) File "/opt/odoo/addons/mail/models/mail_thread.py", line 403, in _compute_field_value return super()._compute_field_value(field) File "/opt/odoo/odoo/models.py", line 4232, in _compute_field_value fields.determine(field.compute, self) File "/opt/odoo/odoo/fields.py", line 98, in determine return needle(*args) File "/opt/odoo/addons/account/models/account_move.py", line 1219, in _compute_tax_totals move.tax_totals = self.env['account.tax']._prepare_tax_totals(**kwargs) File "/opt/odoo/addons/account/models/account_tax.py", line 1225, in _prepare_tax_totals to_update_vals, tax_values_list = self._compute_taxes_for_single_line(base_line) File "/opt/odoo/addons/account/models/account_tax.py", line 876, in _compute_taxes_for_single_line taxes_res = taxes.with_context(**base_line['extra_context']).compute_all( File "/opt/odoo/addons/account/models/account_tax.py", line 481, in compute_all company = self[0].company_id File "/opt/odoo/odoo/fields.py", line 2804, in __get__ return super().__get__(records, owner) File "/opt/odoo/odoo/fields.py", line 1189, in __get__ record._fetch_field(self) File "/opt/odoo/odoo/models.py", line 3201, in _fetch_field self._read(fnames) File "/opt/odoo/odoo/models.py", line 3327, in _read raise self.env['ir.rule']._make_access_error('read', forbidden) odoo.exceptions.AccessError: Due to security restrictions, you are not allowed to access 'Tax' (account.tax) records. Contact your administrator to request access if necessary.

To Reproduce

Affected versions:

Steps to reproduce the behavior:

  1. Eseguire i test automatici come nella CI

Expected behavior I test passano