-
Notifications
You must be signed in to change notification settings - Fork 23.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] fields,models: assure check_company and _check_company_auto makes sense #46721
Conversation
2a27c5d
to
1a611e3
Compare
i think you missed the fact that check_company=True is set on property fields on these occurrences, so it is working properly and should not be reported by your warnings |
I don't understand your statement. Those four property fields of |
but a proper domain will be applied return "[('company_id', 'in', [allowed_company_ids[0], False])]" |
Interesting. I didn't know that this But also note that those four property fields of product category have already a defined domain, so the return you pointed won't apply to them. Their domain will be the one they have explicitly defined so they don't need the check_company=True :) |
they don't ? https://github.com/odoo/odoo/blob/13.0/addons/stock_account/views/product_views.xml#L22 |
here 🤔 odoo/addons/stock_account/models/product.py Line 650 in a4e9549
|
oh you're right :) so we could either
the second option has a functional impact and i don't think we want to go in that direction, i'll ask around |
1a611e3
to
b4108ce
Compare
…nsistency As how the company consistency related things work now, it is necessary to add some logged warnings to detect wrong uses. Thus, the added warnings are: - Don't put _check_company_auto to a model which doesn't have a 'company_id' field. - Don't put check_company attribute to fields whose model doesn't have a 'company_id' field. - Don't put check_company attribute to fields whose model doesn't have _check_company_auto=True (or explicit _check_company_auto=False, cases where is preferred to call _check_company() method in another method distinct from write/create)
b4108ce
to
08e9c58
Compare
excluded property fields in warnings 2 and 3 😉 |
Dear @MiquelRForgeFlow, Thank you for your contribution but the version 13.0 is no longer supported. We apology if we could not look at your request in time. This is an automated message. |
As how the company consistency related things work now, it is necessary to add some logged warnings to detect wrong uses. Thus, the added warnings are:
1. Don't put
_check_company_auto
to a model which doesn't have a 'company_id' field.2. Don't put
check_company=True
attribute to fields whose model doesn't have a 'company_id' field.3. Don't put
check_company=True
attribute to fields whose model doesn't have_check_company_auto=True
(or explicit_check_company_auto=False
, cases where is preferred to call _check_company() method in another method distinct from write/create)Description of the issue/feature this PR addresses:
product.category
doesn't have 'company_id' field_check_company_auto=False
, the detected ones are:account.analytic.line.employee_id
product.supplierinfo.name
product.supplierinfo.product_id
product.supplierinfo.product_tmpl_id
purchase.order.user_id
purchase.requisition.user_id
sale.order.template.line.product_id
stock.quant.package.packaging_id
choose.delivery.package.delivery_packaging_id
Current behavior before PR:
The
check_company=True
attributes in several fields are not working.Desired behavior after PR is merged:
The detected cases above are fixed.
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr