-
-
Notifications
You must be signed in to change notification settings - Fork 582
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] pos_pricelist: FP taxes with multi-company. Fixes #84 #85
[FIX] pos_pricelist: FP taxes with multi-company. Fixes #84 #85
Conversation
The object account.fiscal.position.tax doesn't have multi-company rules, which leads to error in environments with multi-company and these records, because it finally accesses to the parent fiscal position, which on contrary has access rules, provoking an access error. This commit added the field company_id to the model, and add the corresponding access rule.
Please review @AdilHoumadi @legalsylvain |
_inherit = "account.fiscal.position.tax" | ||
|
||
company_id = fields.Many2one( | ||
related="position_id.company_id", string="Company") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is related field stored by default ? if not, security rule will not be applied on computed field ? Or not ?
(sorry if my question is not relevant).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not stored by default, and I have made it on purpose, because the direct access to this field is very strange, so I didn't want to put it as another regular field to be stored. But I can put it if you think so. I'm not sure if when accesing through the one2many field, the security rule is also applied.
Security rules are applied without problem anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your clarification.
Security rules are applied without problem anyway.
It's the most important ! I didn't know that security rules could be applied on non stored computed field. Thanks.
👍 regards. |
Anyone more can review this? |
I have to say, this solution feels very 'fundamental'. Can't you just put in a domain in https://github.com/pedrobaeza/pos/blob/8.0-pos_pricelist-fp_tax_multi_company/pos_pricelist/static/src/js/models.js#L670? Unless you really think there is a need for the regular company security measures on this model, but then this is not the right place. |
Hi @StefanRijnhart, I agree with that is a "fundamental" solution, but I'm not in favour to write domain in JS file. Regards. |
As stated by @legalsylvain, this is the less worst solution we found, because the domain at client level is indeed not the best option (and I don't know if I have access to the company id at that level). Putting this in a general module was also discarded because no other module uses directly this object till now, and it requires more work to be done. |
@StefanRijnhart. Are you ok with what we ( @pedrobaeza and I) said ? kind regards. |
Yes sorry, I'm still missing 50% email notifications from Github. If you agree on this, it is fine. Technically the fix looks good to me. 👍 |
Thanks for your review. |
The object account.fiscal.position.tax doesn't have multi-company rules,
which leads to error in environments with multi-company and these records,
because it finally accesses to the parent fiscal position, which on contrary
has access rules, provoking an access error.
This commit added the field company_id to the model, and add the corresponding
access rule.