2014-07-03 9:59 GMT+02:00 Cédric Krier <cedric.kr...@b2ck.com>:
> 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.

I agree current design is wrong.

> 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.
> And the company context will be used only for default value of company
> field.

I'm not sure this is the desired behaviour nor consistent with how
Tryton currently works. For example, to me it looks quite similar to
the warehouse field in sales. There, the warehouse is only filled in
automatically if the user has access to one warehouse only.

Well, maybe some users will desire this behaviour but I think it is an
error-prone default.

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

I agree the filter is the way to go.

I took a look at the patch and I see that by now you used user's
default company. I really prefer the filter.

>
> Also this change will not affect any mono-company installation which I
> guess is the majority.
>
>
> [1] https://bugs.tryton.org/issue3974
> --
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/



-- 
Albert Cervera i Areny
Tel. 93 553 18 03
@albertnan
www.NaN-tic.com

Reply via email to