OCA / l10n-finland

GNU Affero General Public License v3.0
4 stars 20 forks source link

[MIG] 16.0 l10n_fi_edicode #54

Closed jarmokortetjarvi closed 1 year ago

jarmokortetjarvi commented 1 year ago

No major changes. Rewritten and simplified _name_search() as it wasn't working anymore.

Actual diff https://github.com/OCA/l10n-finland/compare/15.0...jarmokortetjarvi:16.0-mig-l10n_fi_edicode?expand=1

aisopuro commented 1 year ago

Heads up @jarmokortetjarvi in case GitHub is as bad at informing you as it is informing me: the pipeline is failing on tests:

2023-03-05 09:26:41,827 240 ERROR odoo odoo.addons.l10n_fi_edicode.tests.test_edi_operator: FAIL: TestPartnerOperatorInvoice.test_name_search_negative
Traceback (most recent call last):
  File "/__w/l10n-finland/l10n-finland/l10n_fi_edicode/tests/test_edi_operator.py", line 24, in test_name_search_negative
    operators = self.env["res.partner.operator.einvoice"].name_search(
  File "/opt/odoo/odoo/models.py", line 1605, in name_search
    ids = self._name_search(name, args, operator, limit=limit)
  File "/__w/l10n-finland/l10n-finland/l10n_fi_edicode/models/res_partner_operator_einvoice.py", line 61, in _name_search
    return self._search(domain + args, limit=limit, access_rights_uid=name_get_uid)
  File "/opt/odoo/odoo/models.py", line 4617, in _search
    if expression.is_false(self, domain):
  File "/opt/odoo/odoo/osv/expression.py", line 215, in is_false
    for token in reversed(normalize_domain(domain)):
  File "/opt/odoo/odoo/osv/expression.py", line 207, in normalize_domain
    assert expected == 0, 'This domain is syntactically not correct: %s' % (domain)
AssertionError: This domain is syntactically not correct: ['&', '|', ('identifier', '=ilike', 'Apix%'), ('name', 'not ilike', 'Apix')]

Looks like the name_search method now needs to handle the case where the operator is negative, but args is empty?

jarmokortetjarvi commented 1 year ago

I have some concerns about _name_search(), so I'll re-check it and and create a new PR later.