El 03/07/14 09:59, Cédric Krier ha escrit:
Hi,

I was requested to provide a plan for multi-company as I say in
issue3974 [1].

TL;DR: drop record rule, add domain on fields

First, what is wrong with the current implementation? The multi-company
is a legacy from TinyERP/OpenERP/Odoo (partially from me). It uses the
record rule to split the records by companies and many part of the code
rely on this to find the right subset of records etc.
It is a wrong design because it is mixing 2 things, the access right and
the business logic. There are no reason to rely on access right to
ensure that an sale generate invoices from the same company.

So the plan is to remove all the company record rule/access right (it is
part of the customization/configuration) and use domains to enforce
company where it is needed (invoices on sale, account on moves, etc.)
So by default everyone will see every companies, restriction will be
part of the configuration.
When you say restriction will be part of the configuration, you say it's up to every company that needs to multi-company support to add the needed access rules or another mechanims they want in order to restrict the access to companies to some users?
And the company context will be used only for default value of company
field.
But the company fields on res.user will still be there? Or you plan to remove it also?
It will probably require to add some more 'company' fields, for example
on move. They will be needed on «main documents» and thanks to the
domain inversion and the validation, children lines will be filled
correctly and the integrity will be respected.

The only tricky part that I see for this change, is the stock quantity
computation. But probably we could just add a filter for companies.
So in a multi-company environment the user will be able to compute the stock for one company, and for all the companies in the system?


--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

Reply via email to