Commit Graph
23 Commits
Author SHA1 Message Date
Alvaro FuentesandChristophe Simonis c18b9f44be [IMP] *: optimize multi-company rule
When we use the `|` (or) version of this rule the ORM generates two
sub-queries when checking the company. This causes sub-optimal and in
some cases really bad planning for the queries and thus PG takes hours
to complete them.

Example (formatted):
```sql
    SELECT "mrp_routing_workcenter".id
      FROM "mrp_routing_workcenter"
 LEFT JOIN "mrp_bom" AS "mrp_routing_workcenter__bom_id"
        ON "mrp_routing_workcenter"."bom_id" = "mrp_routing_workcenter__bom_id"."id"
     WHERE "mrp_routing_workcenter"."workcenter_id" in (1)
       AND (  ("mrp_routing_workcenter"."bom_id" in (
                    SELECT "mrp_bom".id
                      FROM "mrp_bom"
                     WHERE ("mrp_bom"."company_id" in (1))
                   )
              )
           OR ("mrp_routing_workcenter"."bom_id" in (
                    SELECT "mrp_bom".id
                      FROM "mrp_bom"
                     WHERE "mrp_bom"."company_id" IS NULL
                   )
              )
           )
  ORDER BY "mrp_routing_workcenter__bom_id"."sequence",
           "mrp_routing_workcenter__bom_id"."id",
           "mrp_routing_workcenter"."sequence",
           "mrp_routing_workcenter"."id"
```

If we use the single term version the generated query has only one
sub-query:
```sql
    SELECT "mrp_routing_workcenter".id
      FROM "mrp_routing_workcenter"
 LEFT JOIN "mrp_bom" AS "mrp_routing_workcenter__bom_id"
        ON "mrp_routing_workcenter"."bom_id" = "mrp_routing_workcenter__bom_id"."id"
     WHERE "mrp_routing_workcenter"."workcenter_id" in (1)
       AND (  ("mrp_routing_workcenter"."bom_id" in (
                    SELECT "mrp_bom".id
                      FROM "mrp_bom"
                     WHERE (("mrp_bom"."company_id" in (1))
                        OR  ("mrp_bom"."company_id" IS NULL))
                   )
              )
           )
  ORDER BY "mrp_routing_workcenter__bom_id"."sequence",
           "mrp_routing_workcenter__bom_id"."id",
           "mrp_routing_workcenter"."sequence",
           "mrp_routing_workcenter"."id"
```
In this version PG is able to produce a better query plan resulting in
better execution times.

Also, the `company_id` field is required on some models, so the "= False" comparison is useless.

closes odoo/odoo#159123

X-original-commit: 1b5c41f36801fb886ec591f29dba42787d698526
Related: odoo/enterprise#59378
Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
Co-authored-by: Christophe Simonis <chs@odoo.com>
2024-03-25 17:50:06 +00:00
Yannick Tivisse 1da5b4e802 [IMP] resource: Move test models in their own module
Purpose
=======

When creating resources, SQL request were made to this test table.

Part-of: odoo/odoo#85133
2022-02-28 17:27:07 +00:00
254d6a71e8 [IMP] hr_holidays: Improve Accruals, dashboards and general UX (Back2basics)
Purpose
=======

Time Off : New Dashboard, Accruals feature, Public holidays, New time off type configuration view.

- Review of Dashboard
- Accrual feature : Currently, when you create an allocation, it's possible to create an
  Accrual, but there is no appraisal Plan. An Appraisal plan is use to define steps of accruals
  for each employee.
  In Belgium, we use accrual Allocation for European Leaves, or compensatory hours, it's a
  simple use case.  But in USA, it's possible to change the calculation mode each year.
  Also, in USA, it's possible to deal your accrual plan when you arrive on the company. It's a
  HR Officer task to create the right Accrual allocation for each new employee.
- Public Holidays :
  Improvement of global time off feature located on Working hours calendar. Now, Time off
  application have to manage Public Holidays.
- Review of Time Off type configuration

COM PR: https://github.com/odoo/odoo/pull/72511
ENT PR: https://github.com/odoo/enterprise/pull/19157
UPG PR: https://github.com/odoo/upgrade/pull/2791
TaskID:2475413

closes odoo/odoo#72511

Related: odoo/enterprise#19157
Related: odoo/upgrade#2791
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: William Braeckman <wbr@odoo.com>
Co-authored-by: Xavier BOL (xbo) <xbo@odoo.com>
Co-authored-by: Laurent Stukkens (LTU) <ltu@odoo.com>
Co-authored-by: Yannick Tivisse <yti@odoo.com>
2021-09-02 12:57:03 +00:00
Kevin Baptiste fe161c2105 [IMP] resource: improve resources views
Improve the UX of the different resource.resource views.

closes odoo/odoo#73822

Taskid: 2566432
Related: odoo/enterprise#19695
Related: odoo/upgrade#2649
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-08-24 10:55:22 +00:00
Victor Feyens a3ded9043d [IMP] *: declare ir.rule in noupdate
ir.rule are default values but can be customized based on the
company's policy and needs.
This is typically a record that is in noupdate as should be
customization-friendly.
2020-03-20 16:21:25 +01:00
William Henrotin 6fad651883 [REF] resource: relax ir rule on leaves
The field user_id on resource.resource is optional but the access rules
on resource.calendar.leaves request that field set. Which means a user
can only see his own leaves but not the ones of a machine's calendar for.
instance

This commit relax those rules to give access to the user's leaves and the
one not assigned to a specific user

Task : 1892819
2019-05-28 06:50:00 +00:00
Nans Lefebvre 3539221364 [FIX] resource: give admin rights to edit global leaves
Commit 27d41ccb introduced record rules on resource.calendar.leaves.
However it gave no way to create, edit or delete a global rule.
We grant this right to the group_erp_manager, so that an admin can do it.

opw 1968376

closes odoo/odoo#32832

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-04-19 12:25:36 +00:00
Thibault Delavallée 9944209ef7 [IMP] resource: add resource mixin adding fields and an API for resource
Purpose is to replace existing inherits of resource.resource by an inherit
on the mixin itself. The mixin offers several methods to compute working
intervals, attendance, hours, ... This mixin will be improved in future
commits when new methods that will be required with future improvements
of various service apps.

This commit also adds tests for the mixin itself. A new model is defined
only for testing purpose to test the mixin.
2017-02-27 14:04:48 +01:00
Thibault Delavallée 27d41ccbb5 [REF] resource: update security rules
Add some rules to enable the read of calendar records by employees as
those rules should not be defined a bit everywhere in various addons.
2017-02-27 14:04:48 +01:00
Mansi Gandhi a4e57ea16c [MIG] resource: Migrated to new api. 2016-07-13 12:53:34 +02:00
Christophe Simonis ada9724655 [MERGE] forward port of branch 7.0 up to 3509e15 2014-08-28 16:12:55 +02:00
Denis Ledoux 362221b6f5 [FIX] resource: security, resource not readable by externals 2014-08-26 18:10:14 +02:00
Martin Trigaux 5e051e9484 [FIX] resource: better access rights
bzr revid: mat@openerp.com-20130911142549-cpzg8588ol31b8k1
2013-09-11 16:25:49 +02:00
Martin Trigaux 143b485baf [IMP]resource: avoid better permissions on calendar_leaves
bzr revid: mat@openerp.com-20130514134227-xnvyzjikwph8bp5k
2013-05-14 15:42:27 +02:00
Fabien Pinckaers f27318c8af [IMP] Security Rule: removed duplicates due to inheritancies of groups
bzr revid: fp@tinyerp.com-20111212181113-mhnnbps3ip8ls6pp
2011-12-12 19:11:13 +01:00
François Degrave 8850bcb84b [FIX] dependencies in security groups
bzr revid: fde@openerp.com-20101228083043-6sfsuh4uvqvhu3ap
2010-12-28 09:30:43 +01:00
François Degrave 9ca1866d50 [IMP] access rights for manufacturing manager, project user and manager groups
bzr revid: fde@openerp.com-20101221153314-kd8nrmuhe5kcp6uf
2010-12-21 16:33:14 +01:00
AMP (OpenERP) 9b5984dca8 [MOD] project_*: usability improvement in access rights
bzr revid: amp@tinyerp.com-20100805101407-vr205zdnfy3dre9h
2010-08-05 15:44:07 +05:30
qdp-launchpad@tinyerp.com 9566dcc295 [IMP] resource/project_long_term: renamed resource.calendar.week object into resource.calendar.attendance
bzr revid: qdp-launchpad@tinyerp.com-20100719094640-w08n8337ip7rf7yn
2010-07-19 15:16:40 +05:30
Fabien Pinckaers 540d03afb8 merge
bzr revid: fp@tinyerp.com-20100614102826-j6k1dwsbi0f1w6ep
2010-06-14 12:28:26 +02:00
Fabien Pinckaers 8baf16f25e [IMP] access rights. Remove bad stuff on point of sale
bzr revid: fp@tinyerp.com-20100612162154-f9dgju8wsmn79gq0
2010-06-12 18:21:54 +02:00
uco (OpenERP) 48e7f8370a [ADD]: Added access rules for remaining objects in account, hr, mail_gateway, mrp, stock, project, base_calendar and resource modules.
bzr revid: uco@tinyerp.co.in-20100305100813-2wsyownr15sk335s
2010-03-05 15:38:13 +05:30
HDA (OpenERP) 92ae38eb0a Project management improvements
bzr revid: hda@tinyerp.com-20100119073547-dqn2c0i9ycx6kp3a
2010-01-19 13:05:47 +05:30