subscription and multicompany not working well together

Asked by derekhl

I am using Openerp 6.1 with support for multicompany, as we need to manage two companies from the same openerp instance. However, when I try to use the subcriptions module for recurring invoices, I get the following error.

As a first step, I go to Tools -> Configuration -> Recurring Events -> Document Types and try to create a document type for invoices. I set name='invoices' and Object = 'Invoice', then save, getting the following error message:

OpenERP Server Error
Client Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/", line 180, in dispatch
    response["result"] = method(controller, self, **self.params)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/", line 930, in get
    return self.do_get(req, model, ids, fields)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/", line 952, in do_get
    records =, fields, req.session.eval_context(req.context))
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/openerplib/", line 250, in proxy
    args, kw)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/openerplib/", line 117, in proxy
    result = self.connector.send(self.service_name, method, *args)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/", line 608, in send
    raise xmlrpclib.Fault(, formatted_info)

Server Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/", line 593, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/usr/lib/pymodules/python2.7/openerp/", line 360, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/lib/pymodules/python2.7/openerp/service/", line 586, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/pymodules/python2.7/openerp/osv/", line 167, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/usr/lib/pymodules/python2.7/openerp/osv/", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/osv/", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/osv/", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/osv/", line 3416, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "/usr/lib/pymodules/python2.7/openerp/osv/", line 3539, in _read_flat
    res2 = self._columns[f].get(cr, self, ids, f, user, context=context, values=res)
  File "/usr/lib/pymodules/python2.7/openerp/osv/", line 551, in get
    ids2 = obj.pool.get(self._obj).search(cr, user, self._domain + [(self._fields_id, 'in', ids)], limit=self._limit, context=context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/", line 2245, in search
    return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
  File "/usr/lib/pymodules/python2.7/openerp/osv/", line 4587, in _search
    self._apply_ir_rules(cr, user, query, 'read', context=context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/", line 4471, in _apply_ir_rules
    apply_rule(*rule_obj.domain_get(cr, uid, self._name, mode, context=context))
  File "/usr/lib/pymodules/python2.7/openerp/addons/base/ir/", line 155, in domain_get
    query = self.pool.get(model_name)._where_calc(cr, 1, dom, active_test=False)
  File "/usr/lib/pymodules/python2.7/openerp/osv/", line 4435, in _where_calc
    e = expression.expression(cr, user, domain, self, context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/", line 358, in __init__
    self.parse(cr, uid, distribute_not(normalize(exp)), table, context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/", line 454, in parse
    raise ValueError("Invalid field %r in domain expression %r" % (left, exp))
ValueError: Invalid field 'company_id' in domain expression ['|', ('company_id', '=', False), ('company_id', 'child_of', [2])]

I tried the same as a superadmin user, and it works, but i'm afraid of generating all our recurring documents this way. If this is not a bug, but a misunderstanding on my side of permissions / security, I apologize in advance. But the error message seems to me that the company_id is not taken into account in the subscription module.


Question information

English Edit question
Odoo Addons (MOVED TO GITHUB) Edit question
No assignee Edit question
Solved by:
Serpent Consulting Services
Last query:
Last reply:
Revision history for this message
Twinkle Christian(OpenERP) (tch-openerp) said :


I have checked this issue ,but this issue is working fine as also with multi company and subscription. SO, would you please check your configurations again and correct me if I did any wrong steps.

Thanks & waiting for your answer.

Revision history for this message
Best Serpent Consulting Services (serpent-consulting-services) said :


This is more like a config issue.

I could only reproduce when I gave multicompany access to subcription models via the medium of record rules.

We cannot do this as they do not have the company_id field.

Kindly disable/remove the record rules of these models for multicompany (if you have made).

This will surely help.

Revision history for this message
derekhl (derekhl) said :

Thank you very much! Indeed that was the problem, removing the record rule allowed us to create Document Type, and periodic docuements, which seem to be working perfectly now. Sorry I reported this as a bug originally.


Revision history for this message
derekhl (derekhl) said :

Thanks Serpent Consulting Services, that solved my question.

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :