Skip to Content
Menu
This question has been flagged
1 Reply
3384 Views

I try to add automated action to raise warning when to switch from 1st stage to second without paid invoice.

I get below error when try to change stage_id of pipeline.

Error:

Odoo Server Error


Traceback (most recent call last):

  File "/home/odoo/src/odoo/odoo/http.py", line 650, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

  File "/home/odoo/src/odoo/odoo/http.py", line 310, in _handle_exception

    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])

  File "/home/odoo/src/odoo/odoo/tools/pycompat.py", line 87, in reraise

    raise value

  File "/home/odoo/src/odoo/odoo/http.py", line 692, in dispatch

    result = self._call_function(**self.params)

  File "/home/odoo/src/odoo/odoo/http.py", line 342, in _call_function

    return checked_call(self.db, *args, **kwargs)

  File "/home/odoo/src/odoo/odoo/service/model.py", line 97, in wrapper

    return f(dbname, *args, **kwargs)

  File "/home/odoo/src/odoo/odoo/http.py", line 335, in checked_call

    result = self.endpoint(*a, **kw)

  File "/home/odoo/src/odoo/odoo/http.py", line 936, in __call__

    return self.method(*args, **kw)

  File "/home/odoo/src/odoo/odoo/http.py", line 515, in response_wrap

    response = f(*args, **kw)

  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 934, in call_kw

    return self._call_kw(model, method, args, kwargs)

  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 926, in _call_kw

    return call_kw(request.env[model], method, args, kwargs)

  File "/home/odoo/src/odoo/odoo/api.py", line 689, in call_kw

    return call_kw_multi(method, model, args, kwargs)

  File "/home/odoo/src/odoo/odoo/api.py", line 680, in call_kw_multi

    result = method(recs, *args, **kwargs)

  File "/home/odoo/src/odoo/addons/crm/models/crm_lead.py", line 314, in write

    return super(Lead, self).write(vals)

  File "/home/odoo/src/odoo/addons/mail/models/mail_thread.py", line 282, in write

    result = super(MailThread, self).write(values)

  File "/home/odoo/src/odoo/addons/mail/models/mail_activity.py", line 343, in write

    return super(MailActivityMixin, self).write(vals)

  File "/home/odoo/src/odoo/odoo/models.py", line 3089, in write

    self._write(old_vals)

  File "/home/odoo/src/odoo/addons/base_automation/models/base_automation.py", line 227, in _write

    pre = {action: action._filter_pre(records) for action in actions}

  File "/home/odoo/src/odoo/addons/base_automation/models/base_automation.py", line 227, in <dictcomp>

    pre = {action: action._filter_pre(records) for action in actions}

  File "/home/odoo/src/odoo/addons/base_automation/models/base_automation.py", line 146, in _filter_pre

    return records.search(domain)

  File "/home/odoo/src/odoo/odoo/models.py", line 1480, in search

    res = self._search(args, offset=offset, limit=limit, order=order, count=count)

  File "/home/odoo/src/odoo/odoo/models.py", line 3769, in _search

    if expression.is_false(self, args):

  File "/home/odoo/src/odoo/odoo/osv/expression.py", line 213, in is_false

    for token in reversed(normalize_domain(domain)):

  File "/home/odoo/src/odoo/odoo/osv/expression.py", line 205, in normalize_domain

    assert expected == 0, 'This domain is syntactically not correct: %s' % (domain)

AssertionError: This domain is syntactically not correct: [('id', 'in', [1]), '|', ['stage_id', '=', 1]]


Here is my code:

<record id="crm2invoice.automation_no_invoice_raise_warning"
model="base.automation">
<field name="action_server_id"
ref="crm2invoice.action_no_invoice_raise_warning"/>
<field name="active" eval="True"/>
<field name="filter_domain">["&amp;",["stage_id","!=",1]]</field>
<field name="filter_pre_domain">["|",["stage_id","=",1]]</field>
<field name="trigger">on_create_or_write</field>
</record>

But, after importing action, when I manually edit and save "flter_domain" and  "filter_pre_domain" manually from GUI in automated actions ODOO 11, problem dissappears. I see filtered domains properly



Avatar
Discard
Best Answer

Hi

<record id="crm2invoice.automation_no_invoice_raise_warning"
model="base.automation">
<field name="action_server_id"
ref="crm2invoice.action_no_invoice_raise_warning"/>
<field name="active" eval="True"/>
<field name="filter_domain">[('stage_id','!=',1)]</field>
<field name="trigger">on_create_or_write</field>
</record>

Regards,

Nikhilkrishnan

Avatar
Discard