subscription and multicompany not working well together

Asked by derekhl on 2013-09-04

Hi,
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/http.py", line 180, in dispatch
    response["result"] = method(controller, self, **self.params)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 930, in get
    return self.do_get(req, model, ids, fields)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 952, in do_get
    records = Model.read(ids, fields, req.session.eval_context(req.context))
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/openerplib/main.py", line 250, in proxy
    args, kw)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/openerplib/main.py", line 117, in proxy
    result = self.connector.send(self.service_name, method, *args)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/http.py", line 608, in send
    raise xmlrpclib.Fault(openerp.tools.exception_to_unicode(e), formatted_info)

Server Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/http.py", line 593, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 360, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 586, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 167, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3416, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", 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/fields.py", 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/orm.py", 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/orm.py", line 4587, in _search
    self._apply_ir_rules(cr, user, query, 'read', context=context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", 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/ir_rule.py", 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/orm.py", line 4435, in _where_calc
    e = expression.expression(cr, user, domain, self, context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/expression.py", line 358, in __init__
    self.parse(cr, uid, distribute_not(normalize(exp)), table, context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/expression.py", 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.

Thanks,
Derek

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Serpent Consulting Services
Solved:
2013-09-06
Last query:
2013-09-06
Last reply:
2013-09-06

Hello,

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.

Derek,

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.
Thanks.

derekhl (derek-hossack) said : #3

Hi,
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.

Greetings,
Derek

derekhl (derek-hossack) said : #4

Thanks Serpent Consulting Services, that solved my question.