Comments (4)
It makes sense, my only concern would be the (unlikely) possibility of a document without company_id, nowadays almost every document in odoo has it but we need to cover every use case.
If you are brave enough you can try to make a PR, if not I would try to find some time for this in the following weeks.
from server-ux.
@LoisRForgeFlow
For me a PR to fix it is a bit out of my league. I will definitely help functionally with a PR though.
from server-ux.
@LoisRForgeFlow
I did some work on this:
- Added a field
company_id = fields.Many2one(
comodel_name="res.company",
compute='_compute_company_id',
store=True)
- Add method to compute:
@api.depends('model', 'res_id')
def _compute_company_id(self):
for rec in self:
model = self.env[rec.model]
rel_rec = model.search(
[("id", "=", rec.res_id)],
limit=1)
if rel_rec and 'company_id' in model._fields:
rec.company_id = rel_rec.company_id
else:
rec.company_id = None
- update review_user_count to filter on company:
@api.model
def review_user_count(self):
user_reviews = {}
to_review_docs = {}
**company = self.env.company**
for review in self.env.user.**sudo().**review_ids.filtered(
lambda r: r.status == "pending" **and r.company_id.id in company.ids**
):
My problem is that we have to inherit all modules with models we want to search on. Any suggestions to avoid this?
EDIT:
And of-course also added a record rule:
<record id="tier_review_comp_rule" model="ir.rule">
<field name="name">Tier Review multi-company</field>
<field name="model_id" ref="model_tier_review"/>
<field name="domain_force"> ['|',('company_id', 'in', company_ids),('company_id','=',False)]</field>
</record>
from server-ux.
Solved
from server-ux.
Related Issues (20)
- After installing the base tier validation on odoo14, then got "Error: QWeb2: Template 'tier.validation.ReviewMenu' not found." HOT 1
- Adding batch for server_action_mass_edit HOT 3
- [14.0] [base_tier_validation] Field validate_by incompatible with fields reviewer or reviewer_group or reviewer_field HOT 1
- Unable to install module "base_binary_url_import" and "Test Base Binary URL Import" HOT 1
- [16.0][mass_editing] Action "Mass Edit" doesn't appear in "Server Actions" or in Actions during objects choosing HOT 3
- [16.0] date_range lost compatibility with web_advanced_search HOT 2
- date_range module causes error when selecting a json type field HOT 6
- base_tier_validation: wrong counter for pending review HOT 1
- [15.0] Branch tests are broken HOT 1
- Migration to version 17.0 HOT 15
- [RFQ][base_revision] add a module base_version HOT 2
- error in installing date_range version 17 HOT 1
- [15.0] [base_revision] add client_order_ref to the fields that get copied to new revision HOT 1
- [16.0] [base_tier_validation] Incorrect timezone for Validation Date in Tier Review HOT 1
- [14.0] date_range : date range generator ask for end date even if it's already filled
- [16.0+] base_tier_validation: Selection Field not translated. HOT 3
- base_tier_validation: Missing field "need_validation" in form-embedded lists HOT 2
- base_tier_validation: blocking notifications cron, a.k.a. should it block sudo writes? HOT 4
- [16.0][base_tier_validation] Make "full" form readonly optional HOT 2
- [17.0][base_tier_validation] Some modules have inconsistent states, some dependencies may be missing: ['base_tier_validation'] HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from server-ux.