Comments (11)
Please make a PR (https://odoo-community.org/page/code) rewriting it this way:
@api.multi
def _compute_company_id(self):
for record in self:
if self.env.user.company_id in record.company_ids:
record.company_id = self.env.user.company_id
else:
record.company_id = (
self.env.user.company_ids - record.company_ids
)[:1]
from multi-company.
Hi, I don't understand your code? what does (self.env.user.company_ids - record.company_ids) do? it intersects the 2 lists? (I think this is what we want, the intersection of the 2 lists...)
from multi-company.
Set operation called difference
from multi-company.
But you are right. It's intersection what is needed. Please change it to self.env.user.company_ids & record.company_ids
from multi-company.
i thought the minus was overwritten by odoo or something...
from multi-company.
Well, indeed each operator can be overwritten in Python for adding your own logic about what the operation means for you, and it's done in that way with recordset, but as said, it's intersection what we want.
from multi-company.
yeah, i mean i thought the minus was overwritten in odoo to do intersection, which would be crazy, but since i'm new to python and odoo, i wasn't sure :)
from multi-company.
Sorry, my bad
from multi-company.
no problem
from multi-company.
Sorry but i think i will use the original code... record.company_ids is actually res.company.assignment. The code you suggested needs to be converted to sets and it also give me apple-orange error...
from multi-company.
Fixed after merging #91
from multi-company.
Related Issues (20)
- It changes automatically the company after sale order confirm HOT 1
- Migration to version 16.0 HOT 12
- [14.0][ADD] purchase_sale_inter_company: Transfer all attribute and attriute values from PO to SO HOT 1
- Multi company email domain + signatures: New module available HOT 4
- multi_company_product reinstall issu HOT 1
- Multi Company Partner Performance HOT 2
- post_init_hook in partner_multi_company need to consider allowed companies of users.
- multicurrency error in payment for another company HOT 1
- [BUG][14.0] `partner_multi_company` removes partner_share from res.partner ir.rule HOT 1
- [14.0] mail_template_multi_company: User of non-default company cannot send mails of subsequently installed modules HOT 1
- Double negation HOT 1
- partner_multi_company restores wrong ir.rule
- [QUESTION] A couple of questions about some parts of code HOT 1
- The Inter-Company tab not getting showed HOT 2
- Migration to version 17.0 HOT 8
- [16.0] Error in Domain Regardless of company_ids Field State HOT 1
- [PROBLEM] Migration from v15 to v16 HOT 2
- Lack of connection to base_multi_company post_init_hook in partner_multi_company and product_multi_company modules in version 16 HOT 1
- Multi-company product variant access error HOT 5
- Error with multy-company rules HOT 3
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 multi-company.