Skip to content
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

[MERGE] base,* : remove force_company context key mechanism #36804

Open
wants to merge 16 commits into
base: master
from

Conversation

@Feyensv
Copy link
Contributor

commented Sep 12, 2019

ORM

  • Add with_company to update allowed_company_ids context key.
  • Consider sudoed environment to accept/refuse a company
  • Crash when invalid allowed_company_ids context is given.

If a computed field depends on the current company and/or restricted company, add company in depends_context decorator arguments (done by default for company_dependent fields).

Replace force_company and custom company* context keys by with_company uses.

  • remove force_company keys
  • remove company_id keys --> partly done, remaining is for master
  • remove company context keys
  • remove company_ids and multi_company context keys --> for Master

Task-ID

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@C3POdoo C3POdoo added the RD label Sep 12, 2019
@Feyensv Feyensv requested review from antonylesuisse, rco-odoo and tivisse Sep 12, 2019
@Feyensv Feyensv force-pushed the odoo-dev:master-rem-force-comp-vfe branch from 796521c to 80de47e Sep 12, 2019
@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Sep 12, 2019
@Feyensv Feyensv requested a review from odony Sep 13, 2019
@tivisse

This comment has been minimized.

Copy link
Contributor

commented Sep 13, 2019

Hi @Feyensv

I probably won't take a look at this before the OXP. We're currently in a stabilization phase.

I also think that @odony and @rco-odoo should take a look a this too.

@Feyensv

This comment has been minimized.

Copy link
Contributor Author

commented Sep 13, 2019

@tivisse their review is already requested ^^.
No problem, either AL wants to merge this in 12.5 and we will request reviews personally, or it will wait in its current state 👍.

@robodoo robodoo removed the CI 🤖 label Sep 13, 2019
@Feyensv Feyensv force-pushed the odoo-dev:master-rem-force-comp-vfe branch 3 times, most recently from 38a5738 to b533f33 Sep 14, 2019
@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Sep 14, 2019
@Feyensv Feyensv force-pushed the odoo-dev:master-rem-force-comp-vfe branch from a3b13a1 to 40e6d52 Sep 16, 2019
@robodoo robodoo added the CI 🤖 label Sep 16, 2019
@Feyensv Feyensv force-pushed the odoo-dev:master-rem-force-comp-vfe branch from 40e6d52 to 987a031 Sep 16, 2019
@robodoo robodoo removed the CI 🤖 label Sep 16, 2019
@Feyensv Feyensv force-pushed the odoo-dev:master-rem-force-comp-vfe branch 2 times, most recently from 9ce411a to 94e32e1 Sep 16, 2019
addons/account/models/chart_template.py Outdated Show resolved Hide resolved
odoo/models.py Outdated Show resolved Hide resolved
addons/l10n_ar/models/account_fiscal_position.py Outdated Show resolved Hide resolved
addons/sale_timesheet/models/sale_order.py Outdated Show resolved Hide resolved
@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Sep 16, 2019
@Feyensv Feyensv force-pushed the odoo-dev:master-rem-force-comp-vfe branch from 6317284 to 0b36886 Sep 16, 2019
@Feyensv Feyensv force-pushed the odoo-dev:master-rem-force-comp-vfe branch from cdec972 to da2df26 Oct 11, 2019
@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Oct 11, 2019
@Feyensv Feyensv force-pushed the odoo-dev:master-rem-force-comp-vfe branch from da2df26 to 183763e Oct 14, 2019
@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Oct 14, 2019
@Feyensv Feyensv force-pushed the odoo-dev:master-rem-force-comp-vfe branch from 183763e to dfea039 Oct 16, 2019
@robodoo robodoo removed the CI 🤖 label Oct 16, 2019
'notifications': notifications_all,
'context': {
'statement_line_ids': statement_line_ids_all,
'company_ids': self.env.companies.ids, # VFE FIXME allowed companies or user companies for bank statement import ?

This comment has been minimized.

Copy link
@Feyensv

Feyensv Oct 16, 2019

Author Contributor

@smetl when importing bank statements, should we always fallback on all companies of user, or only those in the environment ?

@@ -186,6 +187,7 @@ def _default_user(self):
partner_id = fields.Many2one('res.partner', string='Partner', domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]")
user_id = fields.Many2one('res.users', string='User', default=_default_user)
tag_ids = fields.Many2many('account.analytic.tag', 'account_analytic_line_tag_rel', 'line_id', 'tag_id', string='Tags', copy=True, domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]")
# VFE FIXME shouldn't it be related to analytic account company_id ???????

This comment has been minimized.

Copy link
@Feyensv

Feyensv Oct 16, 2019

Author Contributor

@smetl is it logical to have account.analytic.line having a required company_id (not related on their required account) whereas the one on the account.analytic.account isn't required ? 🤔

@@ -303,8 +303,9 @@ def _create_invoices(self, group=False):
currency = repair.pricelist_id.currency_id
# Fallback on the user company as the 'company_id' is not required.
company = repair.company_id or self.env.user.company_id
# VFE FIXME why user company and not environment company as fallback ?

This comment has been minimized.

Copy link
@Feyensv

Feyensv Oct 16, 2019

Author Contributor

@sle-odoo When creating invoices from repair, when the repair has no company_id, the user company is used as fallback and not the one from the environment. Is it done on purpose (or a remains not seen by yti during his multi company changes) ?

Edit: the company_id is required, it seems we could just remove the fallback.

Feyensv added 9 commits Sep 12, 2019
Use correct company to get fiscal positions and properties

Ensure company used to fetch fiscal positions is always the correct one
when coming from a company restricted model (company_id required, or
related.required).

NB: if the company_id isn't defined, with_company doesn't change the
environment.

purchase: get_fiscal_position doesn't consider company_id ctxt key

others: properties were accessed with potentially the wrong company.
@Feyensv Feyensv force-pushed the odoo-dev:master-rem-force-comp-vfe branch from dfea039 to e771358 Oct 16, 2019
@robodoo robodoo added the CI 🤖 label Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.