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

Dear,

I'm unable to load base.automation data trought xml file.

odoo.tools.convert.ParseError: "External ID not found in the system: mgmtsystem_audit.date" while parsing /usr/lib/python3/dist-packages/odoo/addons-custom/mgmtsystem_audit/data/audit_automated_actions.xml:5, near
<record id="rule_set_prepare_to_audit" model="base.automation">
            <field name="name">Email all auditors 2 weeks before audit.</field>
            <field name="model_id" ref="mgmtsystem_audit.model_mgmtsystem_audit"/>
            <field name="active">1</field>
	    <field name="trigger">on_time</field>
            <field name="trg_date_id" ref="date"/>
            <field name="trg_date_range">14</field>
            <field name="trg_date_range_type">day</field>
            <field name="action_server_id" eval="[(6, 0, [ref('action_email_prepare_to_audit')])]"/>
        </record>
I try ... 
mgmtsystem_audit.field_mgmtsystem_audit_date
mgmtsystem_audit.date
field_mgmtsystem_audit_date

i have already external id not found ...

Thx

Avatar
Discard
Author Best Answer

up ... if i set trigger on_create everything is ok 

<odoo>
<data>
<record id="test_mail_template" model="mail.template">
<field name="name">Template Automation</field>
<field name="model_id" ref="mgmtsystem_audit.model_mgmtsystem_audit"/>
<field name="body_html"><div>Email automation</div></field>
</record>

<!-- Automated Action: Email all auditors 2 weeks before Audit. -->
<record id="rule_set_prepare_to_audit" model="base.automation">
<field name="name">Email all auditors 2 weeks before audit.</field>
<field name="model_id" ref="mgmtsystem_audit.model_mgmtsystem_audit"/>
<field name="active">1</field>
<field name="trigger">on_create</field>
<field name="state">email</field>
<field name="template_id" ref="mgmtsystem_audit.test_mail_template"/>
</record>

</data>
</odoo>

but if i do this and trigger on_time ... External_id not found for the field date

<odoo>
<data>
<record id="test_mail_template" model="mail.template">
<field name="name">Template Automation</field>
<field name="model_id" ref="mgmtsystem_audit.model_mgmtsystem_audit"/>
<field name="body_html"><div>Email automation</div></field>
</record>

<!-- Automated Action: Email all auditors 2 weeks before Audit. -->
<record id="rule_set_prepare_to_audit" model="base.automation">
<field name="name">Email all auditors 2 weeks before audit.</field>
<field name="model_id" ref="mgmtsystem_audit.model_mgmtsystem_audit"/>
<field name="active">1</field>
<field name="trigger">on_time</field>
<field name="trg_date_id" ref="field_mgmtsystem_audit_date"/>
<field name="trg_date_range">14</field>
<field name="trg_date_range_type">day</field>
<field name="state">email</field>
<field name="template_id" ref="mgmtsystem_audit.test_mail_template"/>
</record>

</data>
</odoo>

Erreur:
Odoo Server Error

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 88, in lookup
r = d[key]
File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 69, in wrapper
return func(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/tools/lru.py", line 44, in __getitem__
a = self.d[obj].me
KeyError: ('ir.model.data', <function IrModelData.xmlid_lookup at 0x7f31b2154950>, 'mgmtsystem_audit.field_mgmtsystem_audit_date')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 758, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 650, in _tag_record
f_val = self.id_get(f_ref)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 741, in id_get
res = self.model_id_get(id_str, raise_if_not_found)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 747, in model_id_get
return self.env['ir.model.data'].xmlid_to_res_model_res_id(id_str, raise_if_not_found=raise_if_not_found)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_model.py", line 1404, in xmlid_to_res_model_res_id
return self.xmlid_lookup(xmlid)[1:3]
File "<decorator-gen-25>", line 2, in xmlid_lookup
File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 93, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_model.py", line 1393, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: mgmtsystem_audit.field_mgmtsystem_audit_date

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 656, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 314, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/usr/lib/python3/dist-packages/odoo/http.py", line 698, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 346, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 941, in __call__
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 519, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 966, in call_button
action = self._call_kw(model, method, args, {})
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 954, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 749, in call_kw
return _call_kw_multi(method, model, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 736, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-67>", line 2, in button_immediate_upgrade
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
return method(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 622, in button_immediate_upgrade
return self._button_immediate_function(type(self).button_upgrade)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 561, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 417, in load_modules
force, status, report, loaded_modules, update_module, models_to_check)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 313, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 222, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package, report=report)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 68, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 802, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 865, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 755, in parse
self.parse(rec, mode)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 764, in parse
exc_info[2]
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 86, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 758, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 650, in _tag_record
f_val = self.id_get(f_ref)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 741, in id_get
res = self.model_id_get(id_str, raise_if_not_found)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 747, in model_id_get
return self.env['ir.model.data'].xmlid_to_res_model_res_id(id_str, raise_if_not_found=raise_if_not_found)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_model.py", line 1404, in xmlid_to_res_model_res_id
return self.xmlid_lookup(xmlid)[1:3]
File "<decorator-gen-25>", line 2, in xmlid_lookup
File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 93, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_model.py", line 1393, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % xmlid)
odoo.tools.convert.ParseError: "External ID not found in the system: mgmtsystem_audit.field_mgmtsystem_audit_date" while parsing /usr/lib/python3/dist-packages/odoo/addons-custom/mgmtsystem_audit/data/audit_automated_actions.xml:10, near
<record id="rule_set_prepare_to_audit" model="base.automation">
<field name="name">Email all auditors 2 weeks before audit.</field>
<field name="model_id" ref="mgmtsystem_audit.model_mgmtsystem_audit"/>
<field name="active">1</field>
<field name="trigger">on_time</field>
<field name="trg_date_id" ref="field_mgmtsystem_audit_date"/>
<field name="trg_date_range">14</field>
<field name="trg_date_range_type">day</field>
<field name="state">email</field>
<field name="template_id" ref="mgmtsystem_audit.test_mail_template"/>
</record>

Avatar
Discard
Author

Here the solution !!!

<field name="trg_date_id" search="[('model','=','product.template'),('name','=','date_limited')]" />

Author

Correct code :

<odoo>

<data>

<record id="test_mail_template" model="mail.template">

<field name="name">Template Automation</field>

<field name="model_id" ref="mgmtsystem_audit.model_mgmtsystem_audit"/>

<field name="body_html">&lt;div&gt;Email automation&lt;/div&gt;</field>

</record>

<!-- Automated Action: Email all auditors 2 weeks before Audit. -->

<record id="rule_set_prepare_to_audit" model="base.automation">

<field name="name">Email all auditors 2 weeks before audit.</field>

<field name="model_id" ref="mgmtsystem_audit.model_mgmtsystem_audit"/>

<field name="active">1</field>

<field name="trigger">on_time</field>

<field name="trg_date_id" search="[('model','=','mgmtsystem.audit'),('name','=','date')]"/>

<field name="trg_date_range">14</field>

<field name="trg_date_range_type">day</field>

<field name="state">email</field>

<field name="template_id" ref="mgmtsystem_audit.test_mail_template"/>

</record>

</data>

</odoo>