I try to install this module on Odoo https://apps.openerp.com/apps/7.0/smsclient/ but it fails during the installation, so i can't even try it as an sms solution for Odoo. Did anybody manage to install it? Or can suggest me another module to send sms via Odoo?
Here is the trace
Traceback (most recent call last):
File "/home/user/odoo/odoo/openerp/http.py", line 500, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/user/odoo/odoo/openerp/http.py", line 517, in dispatch
result = self._call_function(**self.params)
File "/home/user/odoo/odoo/openerp/http.py", line 283, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/user/odoo/odoo/openerp/service/model.py", line 113, in wrapper
return f(dbname, *args, **kwargs)
File "/home/user/odoo/odoo/openerp/http.py", line 280, in checked_call
return self.endpoint(*a, **kw)
File "/home/user/odoo/odoo/openerp/http.py", line 733, in __call__
return self.method(*args, **kw)
File "/home/user/odoo/odoo/openerp/http.py", line 376, in response_wrap
response = f(*args, **kw)
File "/home/user/odoo/odoo/addons/web/controllers/main.py", line 948, in call_button
action = self._call_kw(model, method, args, {})
File "/home/user/odoo/odoo/addons/web/controllers/main.py", line 936, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/home/user/odoo/odoo/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/user/odoo/odoo/openerp/addons/base/module/module.py", line 450, in button_immediate_install
return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
File "/home/user/odoo/odoo/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/user/odoo/odoo/openerp/addons/base/module/module.py", line 497, in _button_immediate_function
registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
File "/home/user/odoo/odoo/openerp/modules/registry.py", line 324, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/user/odoo/odoo/openerp/modules/loading.py", line 358, in load_modules
loaded_modules, update_module)
File "/home/user/odoo/odoo/openerp/modules/loading.py", line 263, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/home/user/odoo/odoo/openerp/modules/loading.py", line 182, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/home/user/odoo/odoo/openerp/modules/loading.py", line 118, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/home/user/odoo/odoo/openerp/tools/convert.py", line 899, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/home/user/odoo/odoo/openerp/tools/convert.py", line 985, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/home/user/odoo/odoo/openerp/tools/convert.py", line 851, in parse
self._tags[rec.tag](self.cr, rec, n, mode=mode)
File "/home/user/odoo/odoo/openerp/tools/convert.py", line 765, in _tag_record
id = self.pool['ir.model.data']._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
File "/home/user/odoo/odoo/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/user/odoo/odoo/openerp/addons/base/ir/ir_model.py", line 1051, in _update
res_id = model_obj.create(cr, uid, values, context=context)
File "/home/user/odoo/odoo/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/user/odoo/odoo/openerp/addons/base/ir/ir_ui_view.py", line 264, in create
context=context)
File "/home/user/odoo/odoo/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/user/odoo/odoo/openerp/api.py", line 332, in old_api
result = method(recs, *args, **kwargs)
File "/home/user/odoo/odoo/openerp/models.py", line 3977, in create
record = self.browse(self._create(old_vals))
File "/home/user/odoo/odoo/openerp/api.py", line 235, in wrapper
return new_api(self, *args, **kwargs)
File "/home/user/odoo/odoo/openerp/api.py", line 464, in new_api
result = method(self._model, cr, uid, *args, **kwargs)
File "/home/user/odoo/odoo/openerp/models.py", line 4158, in _create
recs._validate_fields(vals)
File "/home/user/odoo/odoo/openerp/api.py", line 235, in wrapper
return new_api(self, *args, **kwargs)
File "/home/user/odoo/odoo/openerp/models.py", line 1299, in _validate_fields
raise ValidationError('\n'.join(errors))
ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition
Error details:
Element '<field name="mobile">' cannot be located in parent view
Error context:
View `ir.actions.server.form.inherit`
[view_id: 345, xml_id: n/a, model: ir.actions.server, parent_id: 13]" while parsing /home/user/odoo/odoo/openerp/addons/smsclient/serveraction_view.xml:4, near
<record model="ir.ui.view" id="view_server_statistics_graph">
<field name="name">ir.actions.server.form.inherit</field>
<field name="model">ir.actions.server</field>
<field name="inherit_id" ref="base.view_server_action_form"/>
<field name="arch" type="xml">
<data><field name="mobile" position="after">
<field name="sms_server" invisible="1"/>
<field name="sms_template_id" domain="[('sms_template','=',True)]" attrs="{'required':[('state','=','sms')]}"/>
</field>
<field name="sms" position="attributes">
<attribute name="invisible">1</attribute>
<attribute name="required">0</attribute>
<attribute name="attrs">{}</attribute>
</field>
</data></field>
</record>
Related
I am using a module similar to this one: HR Org Chart
I want to open the view by clicking on a button in Profile Section.
I referred here: Reference
I am getting this error:
Odoo Server Error
Traceback (most recent call last):
File "/home/arijit/Project/odoo/odoo/src/odoo/tools/convert.py", line 678, in _tag_root
f(rec)
File "/home/arijit/Project/odoo/odoo/src/odoo/tools/convert.py", line 493, in _tag_record
model = env[rec_model]
File "/home/arijit/Project/odoo/odoo/src/odoo/api.py", line 533, in __getitem__
return self.registry[model_name]._browse(self, (), ())
File "/home/arijit/Project/odoo/odoo/src/odoo/modules/registry.py", line 177, in __getitem__
return self.models[model_name]
KeyError: 'ir.ui.client'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/arijit/Project/odoo/odoo/src/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/home/arijit/Project/odoo/odoo/src/odoo/http.py", line 683, in dispatch
result = self._call_function(**self.params)
File "/home/arijit/Project/odoo/odoo/src/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/arijit/Project/odoo/odoo/src/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/home/arijit/Project/odoo/odoo/src/odoo/http.py", line 347, in checked_call
result = self.endpoint(*a, **kw)
File "/home/arijit/Project/odoo/odoo/src/odoo/http.py", line 912, in __call__
return self.method(*args, **kw)
File "/home/arijit/Project/odoo/odoo/src/odoo/http.py", line 531, in response_wrap
response = f(*args, **kw)
File "/home/arijit/Project/odoo/odoo/src/addons/web/controllers/main.py", line 1367, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/home/arijit/Project/odoo/odoo/src/addons/web/controllers/main.py", line 1355, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/arijit/Project/odoo/odoo/src/odoo/api.py", line 456, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/home/arijit/Project/odoo/odoo/src/odoo/api.py", line 443, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-77>", line 2, in button_immediate_upgrade
File "/home/arijit/Project/odoo/odoo/src/odoo/addons/base/models/ir_module.py", line 73, in check_and_log
return method(self, *args, **kwargs)
File "/home/arijit/Project/odoo/odoo/src/odoo/addons/base/models/ir_module.py", line 656, in button_immediate_upgrade
return self._button_immediate_function(type(self).button_upgrade)
File "/home/arijit/Project/odoo/odoo/src/odoo/addons/base/models/ir_module.py", line 595, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/home/arijit/Project/odoo/odoo/src/odoo/modules/registry.py", line 89, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/arijit/Project/odoo/odoo/src/odoo/modules/loading.py", line 465, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/home/arijit/Project/odoo/odoo/src/odoo/modules/loading.py", line 362, in load_marked_modules
loaded, processed = load_module_graph(
File "/home/arijit/Project/odoo/odoo/src/odoo/modules/loading.py", line 221, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package)
File "/home/arijit/Project/odoo/odoo/src/odoo/modules/loading.py", line 69, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind)
File "/home/arijit/Project/odoo/odoo/src/odoo/tools/convert.py", line 734, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate)
File "/home/arijit/Project/odoo/odoo/src/odoo/tools/convert.py", line 800, in convert_xml_import
obj.parse(doc.getroot())
File "/home/arijit/Project/odoo/odoo/src/odoo/tools/convert.py", line 720, in parse
self._tag_root(de)
File "/home/arijit/Project/odoo/odoo/src/odoo/tools/convert.py", line 682, in _tag_root
raise ParseError('while parsing %s:%s, near\n%s' % (
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/arijit/Project/odoo/odoo/src/odoo/http.py", line 639, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/arijit/Project/odoo/odoo/src/odoo/http.py", line 315, in _handle_exception
raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing /home/arijit/Project/odoo/odoo/src/addons/hr_organizational_chart/views/show_employee_chart.xml:21, near
<record id="action_organizational_chart" model="ir.ui.client">
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<div id="o_work_employee_main" position="after">
<div id="o_employee_right">
<button name="%(hr_organization_chart.action_organizational_chart)d" type="action" string="Submit"/>
</div>
</div>
</field>
</record>
I want to add a button in the Employee profile section which should open up the module chart view.
Trying something like this to add the button in my profile section:
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<div id="o_work_employee_main" position="after">
<div id="o_employee_right">
<button name="%(hr_organization_chart.action_organizational_chart)d" type="action" string="Submit" />
</div>
</div>
</field>
The action_organizational_chart you want to reference from button is of type ir.ui.client which is not an action, its a view.
You should first create an ir.actions.act_window action that reference to your view, and then reference your button to that action instead of your view.
In trying to migrate a module from odoo 11 to 13 I get the error KeyError: 'tax_line_ids'. Please help me solve this issue.
It's a brazilian module for billets
I've put "->" in the lines where tax_line_ids are detected in code. Somebody help me please. I can't find this module easily 'cause it's brazilian. The company that made it in odoo 11 now works with another company which charges for the billets so they stopped updating
Odoo Server Error
Traceback (most recent call last):
File "C:\Users\Eliane\Documents\Odoo\server\odoo\http.py", line 624, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "C:\Users\Eliane\Documents\Odoo\server\odoo\tools\pycompat.py", line 14, in reraise
raise value
File "C:\Users\Eliane\Documents\Odoo\server\odoo\http.py", line 669, in dispatch
result = self._call_function(**self.params)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\http.py", line 350, in _call_function
return checked_call(self.db, *args, **kwargs)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\service\model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\http.py", line 915, in __call__
return self.method(*args, **kw)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\http.py", line 515, in response_wrap
response = f(*args, **kw)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\addons\web\controllers\main.py", line 1326, in call_button
action = self._call_kw(model, method, args, kwargs)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\addons\web\controllers\main.py", line 1314, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\api.py", line 387, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\api.py", line 374, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-60>", line 2, in button_immediate_install
File "C:\Users\Eliane\Documents\Odoo\server\odoo\addons\base\models\ir_module.py", line 72, in check_and_log
return method(self, *args, **kwargs)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\addons\base\models\ir_module.py", line 463, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\addons\base\models\ir_module.py", line 573, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\modules\registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\modules\loading.py", line 423, in load_modules
loaded_modules, update_module, models_to_check)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\modules\loading.py", line 315, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "C:\Users\Eliane\Documents\Odoo\server\odoo\modules\loading.py", line 201, in load_module_graph
registry.setup_models(cr)
File "C:\Users\Eliane\Documents\Odoo\server\odoo\modules\registry.py", line 266, in setup_models
dependencies[field] = set(field.resolve_depends(model))
File "C:\Users\Eliane\Documents\Odoo\server\odoo\fields.py", line 695, in resolve_depends
field = field_model._fields[fname]
-> KeyError: 'tax_line_ids'
file 1
class AccountInvoice(models.Model):
_inherit = 'account.move'
#api.depends('invoice_line_ids.price_subtotal',
'invoice_line_ids.price_total',
-> 'tax_line_ids.amount',
'currency_id', 'company_id')
in file 1 still
#api.model
def tax_line_move_line_get(self):
res = super(AccountInvoice, self).tax_line_move_line_get()
done_taxes = []
-> for tax_line in sorted(self.tax_line_ids, key=lambda x: -x.sequence):
if tax_line.amount and tax_line.tax_id.deduced_account_id:
tax = tax_line.tax_id
done_taxes.append(tax.id)
res.append({
'invoice_tax_line_id': tax_line.id,
'tax_line_id': tax_line.tax_id.id,
'type': 'tax',
'name': tax_line.name,
'price_unit': tax_line.amount * -1,
'quantity': 1,
'price': tax_line.amount * -1,
'account_id': tax_line.tax_id.deduced_account_id.id,
'account_analytic_id': tax_line.account_analytic_id.id,
'invoice_id': self.id,
'tax_ids': [(6, 0, done_taxes)]
if tax_line.tax_id.include_base_amount else []
})
return res
another xml file
-> <field name="tax_line_ids" position="after">
<group name="documentos_relacionados" string="Documentos Relacionados">
<field colspan="4" nolabel="1" name="fiscal_document_related_ids">
<tree>
<field name="document_type"/>
<field name="access_key"/>
<field name="serie"/>
<field name="internal_number"/>
</tree>
The field tax_line_ids is no longer available.
If you check the commit you will see that o.tax_line_ids was replaced by o.line_ids.filtered(lambda line: line.tax_line_id).
Try to replace o.tax_line_ids with o.line_ids.filtered(lambda line: line.tax_line_id) in your methods.
Remplace tax_line_ids.amount with line_ids.tax_line_id.amount in depends decorator.
Use another field in the XML definition.
I have error
2016-08-03 08:07:05,005 29822 ERROR odoov8 openerp.addons.base.ir.ir_ui_view: Field `shipaddr` not exist
My model extend sale.order:
from openerp.osv import osv, fields
class sale_order(osv.osv):
_inherit = 'sale.order'
_columns = {
#shipaddr = fields.Many2many('res.partner', string="Shipping address", readonly=False),
'shipaddr' : fields.many2many('res.partner', 'vips_shop_order_to_ship_rel', 'order_id', 'shipping_address_id', string="Shipping address"),
}
While I not added template for view all work fine (field not created but i haven't error)
<record model="ir.ui.view" id="sale_order_shipaddr_form_view">
<field name="name">order.shipaddr</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Shipping address">
<group>
<field name="shipaddr"/>
</group>
</page>
</notebook>
</field>
</record>
After added this template I receive error in top. I received also this:
2016-08-03 08:07:05,022 29822 ERROR odoov8 werkzeug: Error on request:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi
execute(self.server.app)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/home/skif/odoo/openerp/service/server.py", line 291, in app
return self.app(e, s)
File "/home/skif/odoo/openerp/service/wsgi_server.py", line 216, in application
return application_unproxied(environ, start_response)
File "/home/skif/odoo/openerp/service/wsgi_server.py", line 202, in application_unproxied
result = handler(environ, start_response)
File "/home/skif/odoo/openerp/http.py", line 1293, in __call__
return self.dispatch(environ, start_response)
File "/home/skif/odoo/openerp/http.py", line 1267, in __call__
return self.app(environ, start_wrapped)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 588, in __call__
return self.app(environ, start_response)
File "/home/skif/odoo/openerp/http.py", line 1431, in dispatch
ir_http = request.registry['ir.http']
File "/home/skif/odoo/openerp/http.py", line 349, in registry
return openerp.modules.registry.RegistryManager.get(self.db) if self.db else None
File "/home/skif/odoo/openerp/modules/registry.py", line 339, in get
update_module)
File "/home/skif/odoo/openerp/modules/registry.py", line 370, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/skif/odoo/openerp/modules/loading.py", line 351, in load_modules
force, status, report, loaded_modules, update_module)
File "/home/skif/odoo/openerp/modules/loading.py", line 255, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/home/skif/odoo/openerp/modules/loading.py", line 176, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/home/skif/odoo/openerp/modules/loading.py", line 118, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/home/skif/odoo/openerp/tools/convert.py", line 900, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/home/skif/odoo/openerp/tools/convert.py", line 986, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/home/skif/odoo/openerp/tools/convert.py", line 852, in parse
self._tags[rec.tag](self.cr, rec, n, mode=mode)
File "/home/skif/odoo/openerp/tools/convert.py", line 762, in _tag_record
id = self.pool['ir.model.data']._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
File "/home/skif/odoo/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/home/skif/odoo/openerp/addons/base/ir/ir_model.py", line 1065, in _update
res_id = model_obj.create(cr, uid, values, context=context)
File "/home/skif/odoo/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/home/skif/odoo/openerp/addons/base/ir/ir_ui_view.py", line 255, in create
context=context)
File "/home/skif/odoo/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/home/skif/odoo/openerp/api.py", line 372, in old_api
result = method(recs, *args, **kwargs)
File "/home/skif/odoo/openerp/models.py", line 4094, in create
record = self.browse(self._create(old_vals))
File "/home/skif/odoo/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/home/skif/odoo/openerp/api.py", line 508, in new_api
result = method(self._model, cr, uid, *args, **old_kwargs)
File "/home/skif/odoo/openerp/models.py", line 4285, in _create
recs._validate_fields(vals)
File "/home/skif/odoo/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/home/skif/odoo/openerp/models.py", line 1271, in _validate_fields
raise ValidationError('
'.join(errors))
ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition
Error details:
Field `shipaddr` not exist
Context error:
View `order.shipaddr`
[view_id: 1642, xml_id: n/a, model: sale.order, parent_id: 582]" while parsing /home/skif/odoo/my-modules/vips_shop/views/sale_order.xml:5, near
<record model="ir.ui.view" id="sale_order_shipaddr_form_view">
<field name="name">order.shipaddr</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Shipping address">
<group>
<field name="shipaddr"/>
</group>
</page>
</notebook>
</field>
</record>
Why did not create a field in my model?
__openerp__.py
{
###
# any module necessary for this one to work correctly
'depends': ['base','sale', 'product', 'vips_vc'],
###
}
Module sale is using osv.osv model. Documentation for Odoo8 specified model.Model for create columns. I can not find doc for osv. This construction i wrote using code other modules. May be it not right.
Where have I error? Where am I can read doc for osv?
Thanks to Rawly for answer
In file openerp.py I fogot to add 'import sale_order'.
Now this file contains:
import controllers
import models
import partner
import product
import sale_order
As you see I added sale_order.
All working fine
I have develop a module for odoo 8.
When I tried to deploy it a I got this error:
Traceback (most recent call last):
File "/opt/odoo/openerp/http.py", line 539, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/openerp/http.py", line 576, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/openerp/http.py", line 312, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/openerp/http.py", line 309, in checked_call
return self.endpoint(*a, **kw)
File "/opt/odoo/openerp/http.py", line 805, in __call__
return self.method(*args, **kw)
File "/opt/odoo/openerp/http.py", line 405, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/addons/web/controllers/main.py", line 948, in call_button
action = self._call_kw(model, method, args, {})
File "/opt/odoo/addons/web/controllers/main.py", line 936, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/opt/odoo/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/openerp/addons/base/module/module.py", line 447, in button_immediate_install
return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
File "/opt/odoo/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/openerp/addons/base/module/module.py", line 495, in _button_immediate_function
registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
File "/opt/odoo/openerp/modules/registry.py", line 370, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo/openerp/modules/loading.py", line 355, in load_modules
loaded_modules, update_module)
File "/opt/odoo/openerp/modules/loading.py", line 255, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/opt/odoo/openerp/modules/loading.py", line 176, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/opt/odoo/openerp/modules/loading.py", line 118, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/opt/odoo/openerp/tools/convert.py", line 900, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/opt/odoo/openerp/tools/convert.py", line 986, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/opt/odoo/openerp/tools/convert.py", line 852, in parse
self._tags[rec.tag](self.cr, rec, n, mode=mode)
File "/opt/odoo/openerp/tools/convert.py", line 762, in _tag_record
id = self.pool['ir.model.data']._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
File "/opt/odoo/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/openerp/addons/base/ir/ir_model.py", line 1065, in _update
res_id = model_obj.create(cr, uid, values, context=context)
File "/opt/odoo/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/openerp/addons/base/ir/ir_ui_view.py", line 255, in create
context=context)
File "/opt/odoo/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/openerp/api.py", line 372, in old_api
result = method(recs, *args, **kwargs)
File "/opt/odoo/openerp/models.py", line 4093, in create
record = self.browse(self._create(old_vals))
File "/opt/odoo/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/openerp/api.py", line 508, in new_api
result = method(self._model, cr, uid, *args, **old_kwargs)
File "/opt/odoo/openerp/models.py", line 4284, in _create
recs._validate_fields(vals)
File "/opt/odoo/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/openerp/models.py", line 1271, in _validate_fields
raise ValidationError('\n'.join(errors))
ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition
Error details:
Field `note` does not exist
Error context:
View `hr.skill form`
[view_id: 1027, xml_id: n/a, model: hr.skill, parent_id: 849]" while parsing /opt/odoo/addons/nge_skills_management/skill.xml:32, near
<record id="view_skill_form_inherit" model="ir.ui.view">
<field name="model">hr.skill</field>
<field name="inherit_id" ref="hr_skill.view_skill_form"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='name']" position="after">
<field name="note" string="Note"/>
</xpath>
</field>
</record>
But When I check my database I found the note field:
select * from nge_skills_management_hr_skill;
id | parent_left | parent_right | create_uid | create_date | name | write_uid | note | parent_id | write_date | active
----+-------------+--------------+------------+-------------+------+-----------+------+-----------+------------+--------
There are my source code:
skill.py
from openerp import api, fields, models
class hr_skill(models.Model):
_inherit = "hr.skill"
_name = "nge_skills_management.hr_skill"
note = fields.Selection([('a', '3'),('b', '2'),('c', '1')])
skill.xml
<menuitem id="main_skill_menu" name="Nge Skills" />
<menuitem id="skill_menu" name="My skills"
parent="main_skill_menu" />
<record id="action_home_page" model="ir.actions.client">
<field name="name">Skill Home</field>
<field name="tag">nge_skills_management.homepage</field>
</record>
<menuitem id="home_page_skill_menu" name="Home Page" parent="skill_menu"
action="action_home_page"/>
<record model="ir.actions.act_window" id="nge_skills_action">
<field name="name">NGE Skills</field>
<field name="res_model">hr.skill</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[["parent_id.name", "=", "Programmation"]]</field>
</record>
<record id="view_skill_form_inherit" model="ir.ui.view">
<field name="model">hr.skill</field>
<field name="inherit_id" ref="hr_skill.view_skill_form"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='name']" position="after">
<field name="note" string="Note"/>
</xpath>
</field>
</record>
<menuitem id="nge_skills_action_menu" name="NGE SKILLS" parent="skill_menu"
action="nge_skills_action"/>
Can anyone help me please !!
In odoo specifying _name creates a new table in the database (the name of the module is the name of the database table with the . replaced with _).
The problem is you are using:
_name = 'nge_skills_management.hr_skill' which is going to create a new table with the fields in hr.skill and add a notes field to it not to the hr_skill module
what you want (Normal inheritance) is simply to specify _inherit='hr.skill' only. this will enable you add new fields or new methods to the hr.skill model
I have received a module written for v7 that I wish to port to v8. There is a report written in RML that I supposed to work on v8 (RML is deprecated but still functional correct?) The report is declared as following:
<report
auto="False"
id="account.account_invoices"
model="account.invoice"
name="account.report_invoice_custom"
rml="recreate_customization/report/account_print_invoice.rml"
string="Invoices"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
attachment_use="True"
usage="default"
/>
The parser:
import time
from openerp.report import report_sxw
class account_invoice(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_invoice, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
report_sxw.report_sxw(
'report.account.report_invoice_custom',
'account.invoice',
'recreate_customization/report/account_print_invoice.rml',
parser=account_invoice
)
My problem is that I get :
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi
execute(self.server.app)
File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/service/server.py", line 280, in app
return self.app(e, s)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/service/wsgi_server.py", line 216, in application
return application_unproxied(environ, start_response)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/service/wsgi_server.py", line 202, in application_unproxied
result = handler(environ, start_response)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 1214, in __call__
return self.dispatch(environ, start_response)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 1188, in __call__
return self.app(environ, start_wrapped)
File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 579, in __call__
return self.app(environ, start_response)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 1355, in dispatch
result = ir_http._dispatch()
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_http.py", line 130, in _dispatch
return self._handle_exception(e)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_http.py", line 100, in _handle_exception
return request._handle_exception(exception)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 595, in _handle_exception
return super(HttpRequest, self)._handle_exception(exception)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_http.py", line 126, in _dispatch
result = request.dispatch()
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 613, in dispatch
r = self._call_function(**self.params)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 282, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/service/model.py", line 113, in wrapper
return f(dbname, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 279, in checked_call
return self.endpoint(*a, **kw)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 732, in __call__
return self.method(*args, **kw)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 375, in response_wrap
response = f(*args, **kw)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 375, in response_wrap
response = f(*args, **kw)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/controllers/main.py", line 64, in report_routes
pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=options_data, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/models/report.py", line 168, in get_pdf
html = self.get_html(cr, uid, ids, report_name, data=data, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/models/report.py", line 153, in get_html
return self.render(cr, uid, [], report.report_name, docargs, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/models/report.py", line 129, in render
return view_obj.render(cr, uid, template, values, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_ui_view.py", line 1007, in render
return self.pool[engine].render(cr, uid, id_or_xml_id, qcontext, loader=loader, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_qweb.py", line 247, in render
return self.render_node(self.get_template(id_or_xml_id, qwebcontext), qwebcontext)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_qweb.py", line 187, in get_template
raise_qweb_exception(QWebTemplateNotFound, message="Loader could not find template %r" % name, template=origin_template)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_qweb.py", line 185, in get_template
xml_doc = qwebcontext.loader(name)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_ui_view.py", line 1005, in loader
return self.read_template(cr, uid, name, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "<string>", line 2, in read_template
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/tools/cache.py", line 119, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_ui_view.py", line 849, in read_template
view_id = self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, xml_id, raise_if_not_found=True)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_model.py", line 925, in xmlid_to_res_id
return self.xmlid_to_res_model_res_id(cr, uid, xmlid, raise_if_not_found)[1]
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_model.py", line 917, in xmlid_to_res_model_res_id
return self.xmlid_lookup(cr, uid, xmlid)[1:3]
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "<string>", line 2, in xmlid_lookup
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/tools/cache.py", line 71, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_model.py", line 907, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % (xmlid))
QWebTemplateNotFound: External ID not found in the system: account.report_invoice_custom
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/controllers/main.py", line 117, in report_download
response = self.report_routes(reportname, docids=docids, converter='pdf')
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/http.py", line 375, in response_wrap
response = f(*args, **kw)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/controllers/main.py", line 64, in report_routes
pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=options_data, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/models/report.py", line 168, in get_pdf
html = self.get_html(cr, uid, ids, report_name, data=data, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/models/report.py", line 153, in get_html
return self.render(cr, uid, [], report.report_name, docargs, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/addons/report/models/report.py", line 129, in render
return view_obj.render(cr, uid, template, values, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_ui_view.py", line 1007, in render
return self.pool[engine].render(cr, uid, id_or_xml_id, qcontext, loader=loader, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_qweb.py", line 247, in render
return self.render_node(self.get_template(id_or_xml_id, qwebcontext), qwebcontext)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_qweb.py", line 187, in get_template
raise_qweb_exception(QWebTemplateNotFound, message="Loader could not find template %r" % name, template=origin_template)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_qweb.py", line 185, in get_template
xml_doc = qwebcontext.loader(name)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_ui_view.py", line 1005, in loader
return self.read_template(cr, uid, name, context=context)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "<string>", line 2, in read_template
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/tools/cache.py", line 119, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_ui_view.py", line 849, in read_template
view_id = self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, xml_id, raise_if_not_found=True)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_model.py", line 925, in xmlid_to_res_id
return self.xmlid_to_res_model_res_id(cr, uid, xmlid, raise_if_not_found)[1]
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_model.py", line 917, in xmlid_to_res_model_res_id
return self.xmlid_lookup(cr, uid, xmlid)[1:3]
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "<string>", line 2, in xmlid_lookup
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/tools/cache.py", line 71, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/george/odoo/odoov8/odoo-server-v8/openerp/addons/base/ir/ir_model.py", line 907, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % (xmlid))
QWebTemplateNotFound: External ID not found in the system: account.report_invoice_custom
You used account.report_invoice_custom as a report name, you need to change without specifying a module name and id must be unique.
<report
auto="False"
id="account.account_invoices"
model="account.invoice"
name="report_invoice_custom"
rml="recreate_customization/report/account_print_invoice.rml"
string="Invoices"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
attachment_use="True"
usage="default"
/>
Parser:
import time
from openerp.report import report_sxw
class account_invoice(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_invoice, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
report_sxw.report_sxw(
'report.report_invoice_custom',
'account.invoice',
'addons/recreate_customization/report/account_print_invoice.rml',
parser=account_invoice
)