Commit Graph
16 Commits
Author SHA1 Message Date
Sébastien Theys 7e5505da06 [FIX] base, mail, website_forum: correct populate of base models
Significantly improves the usability and the result of the populate for
base models and channel/member/message.

- make populate of base models re-entrant
- adapt size to values that make sense:
  - small shows something relevant, and can be quickly ran several times
  - medium is fast enough to be usuable but big enough to highlight
    performance issues
  - large is... still not to be attempted
- avoid conflicting conditions that either make no sense or can lead to
  crashes when populating the data or running the database
- better spread of data in channel/member/messages

closes odoo/odoo#139269

X-original-commit: 73a5e322f6e250569ee1942d678f8a4f87616bd7
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-20 11:22:20 +00:00
william-andre b405bc41fb [IMP] base: restrict currency rates to main companies only
The interraction between currency rates owned by branches can not be
defined clearly.
It would also make the currency rates tables a lot bigger.

task-3371677

Part-of: odoo/odoo#125642
2023-07-20 11:49:04 +02:00
Yannick Tivisse b1f7e56f79 [IMP] base: Remove private res.partner type
- Improve performances, as the ir.rule restricting private partners
  visibility is also applied on res.users by inheritance, on each
  prefetch.
- Solve the issue of partners set as followers on records (eg: application
  form) and then made private, making them impossible to contact via the
  chatter.
- Solve the multiple access issues when trying to access the bank
  account, or the private address for non HR people like the accountants
  forcing the usage of sudo in the business code.

TaskID: 3101400
2023-07-05 14:21:28 +02:00
Florian Charlier 77f9ff50db [REF] *: use onboarding module
* = account{_payment}, base, onboarding, payment{_stripe},
sale{_management}, web, website_sale

Use the dedicated onboarding module introduced in 16.0 instead of
the res.company model to store onboarding progress.

It allows
 * onboarding steps to be reused across panels
 * to support steps that should be completed per-database or per-company
 * to clean the res.company model from many fields and methods,
 * to remove many views, controllers, actions

Module-specific notes:
* account: We also clean the remaining two steps that are not
part of an accounting panel but make the most sense to be kept here.
* account_payment: Following 8e4e8eb8, the payment provider step is
added to the invoicing onboarding panel. We apply this change here too.
Also impacts the website_sale_dashboard panel (see related ENT PR).
(The "sale tax" one is currently used for to the website sale dashboard).
* payment: Note that the step was already not part of an onboarding
panel within this module.
* website_sale: We clean
  * a field not used (The website_sale dashboard onboarding panel used
  the payment_provider_onboarding_state field).
  * a method that was only called from website_sale_dashboard, so it is
  moved there. See related ENT PR.

Includes a few tests.

Moving views/templates/styling, as well as cleaning residual onboarding-related fields and methods in base, including populate.

This also includes restoring the "onboarding_complete" overlay panel
animating it to disappear after a few seconds so that it doesn't hide
text and block buttons to re-open steps.

Task-3025136

Part-of: odoo/odoo#104223
2023-06-30 23:37:50 +02:00
Julien Carion (juca) 085d7d484d [REF] base: Remove res.company favicon field
This commit simply removes the res.company favicon field and every
related code because the feature is obsolete

closes odoo/odoo#116367

Related: odoo/upgrade#4469
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-03-28 13:43:28 +02:00
Denis Ledoux e2ffff1e42 [IMP] base: faster search on filters by re-ordering unique constraint
The domain used in `get_filters`, used in `get_views` is

```python
[('action_id', 'in', [action_id, False]), ('model_id', '=', model), ('user_id', 'in', [self._uid, False])]
```

Therefore filtering the filters on `action_id`, `model_id` and
`user_id`.

An index on `(action_id, model_id, user_id)` would therefore be welcome
in order to search quicker on filters.

The unique constraint `name_model_uid_unique` almost does it,
but it puts the name in first, and therefore the index is not used
when searching on the above domain.

By moving `name` to the end of the unique constraint,
the index created for this unique constraint becomes
usable for the above domain,
and it makes the SQL statement to search on filters way quicker.

Before:
```sql
EXPLAIN ANALYZE SELECT "ir_filters".id FROM "ir_filters" LEFT JOIN "ir_translation" AS "ir_filters__name" ON ("ir_filters"."id" = "ir_filters__name"."res_id" AND "ir_filters__name"."type" = 'model' AND "ir_filters__name"."name" = 'ir.filters,name' AND "ir_filters__name"."lang" = 'en_US' AND "ir_filters__name"."value" != '') WHERE (((("ir_filters"."active" = true) AND (("ir_filters"."action_id" in (225)) OR "ir_filters"."action_id" IS NULL)) AND ("ir_filters"."model_id" = 'account.move')) AND (("ir_filters"."user_id" in (2)) OR "ir_filters"."user_id" IS NULL)) AND TRUE ORDER BY  "ir_filters"."model_id" ,COALESCE("ir_filters__name"."value", "ir_filters"."name") ,"ir_filters"."id" DESC;
                                                                              QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Sort  (cost=3500.58..3500.59 rows=1 width=56) (actual time=12.940..12.942 rows=0 loops=1)
   Sort Key: (COALESCE(ir_filters__name.value, (ir_filters.name)::text)), ir_filters.id DESC
   Sort Method: quicksort  Memory: 25kB
   ->  Nested Loop Left Join  (cost=0.00..3500.57 rows=1 width=56) (actual time=12.933..12.934 rows=0 loops=1)
         Join Filter: (ir_filters.id = ir_filters__name.res_id)
         ->  Seq Scan on ir_filters  (cost=0.00..3499.02 rows=1 width=36) (actual time=12.932..12.932 rows=0 loops=1)
               Filter: (active AND ((action_id = 225) OR (action_id IS NULL)) AND ((user_id = 2) OR (user_id IS NULL)) AND ((model_id)::text = 'account.move'::text))
               Rows Removed by Filter: 100001
         ->  Seq Scan on ir_translation ir_filters__name  (cost=0.00..1.54 rows=1 width=36) (never executed)
               Filter: ((value <> ''::text) AND ((type)::text = 'model'::text) AND ((name)::text = 'ir.filters,name'::text) AND ((lang)::text = 'en_US'::text))
 Planning Time: 0.311 ms
 Execution Time: 12.972 ms
```

After:
```sql
EXPLAIN ANALYZE SELECT "ir_filters".id FROM "ir_filters" LEFT JOIN "ir_translation" AS "ir_filters__name" ON ("ir_filters"."id" = "ir_filters__name"."res_id" AND "ir_filters__name"."type" = 'model' AND "ir_filters__name"."name" = 'ir.filters,name' AND "ir_filters__name"."lang" = 'en_US' AND "ir_filters__name"."value" != '') WHERE (((("ir_filters"."active" = true) AND (("ir_filters"."action_id" in (225)) OR "ir_filters"."action_id" IS NULL)) AND ("ir_filters"."model_id" = 'account.move')) AND (("ir_filters"."user_id" in (2)) OR "ir_filters"."user_id" IS NULL)) AND TRUE ORDER BY  "ir_filters"."model_id" ,COALESCE("ir_filters__name"."value", "ir_filters"."name") ,"ir_filters"."id" DESC;
                                                                            QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Sort  (cost=14.44..14.44 rows=1 width=56) (actual time=0.086..0.087 rows=0 loops=1)
   Sort Key: (COALESCE(ir_filters__name.value, (ir_filters.name)::text)), ir_filters.id DESC
   Sort Method: quicksort  Memory: 25kB
   ->  Nested Loop Left Join  (cost=8.86..14.43 rows=1 width=56) (actual time=0.080..0.081 rows=0 loops=1)
         Join Filter: (ir_filters.id = ir_filters__name.res_id)
         ->  Bitmap Heap Scan on ir_filters  (cost=8.86..12.87 rows=1 width=36) (actual time=0.079..0.080 rows=0 loops=1)
               Recheck Cond: ((((model_id)::text = 'account.move'::text) AND (user_id = 2)) OR (((model_id)::text = 'account.move'::text) AND (user_id IS NULL)))
               Filter: (active AND ((action_id = 225) OR (action_id IS NULL)))
               ->  BitmapOr  (cost=8.86..8.86 rows=1 width=0) (actual time=0.078..0.079 rows=0 loops=1)
                     ->  Bitmap Index Scan on ir_filters_name_model_uid_unique  (cost=0.00..4.43 rows=1 width=0) (actual time=0.075..0.075 rows=0 loops=1)
                           Index Cond: (((model_id)::text = 'account.move'::text) AND (user_id = 2))
                     ->  Bitmap Index Scan on ir_filters_name_model_uid_unique  (cost=0.00..4.43 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=1)
                           Index Cond: (((model_id)::text = 'account.move'::text) AND (user_id IS NULL))
         ->  Seq Scan on ir_translation ir_filters__name  (cost=0.00..1.54 rows=1 width=36) (never executed)
               Filter: ((value <> ''::text) AND ((type)::text = 'model'::text) AND ((name)::text = 'ir.filters,name'::text) AND ((lang)::text = 'en_US'::text))
 Planning Time: 1.000 ms
 Execution Time: 0.121 ms
```

I take the opportunity to add the populate for `ir.filters`,
which helped me for the above analysis.

closes odoo/odoo#99657

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-09-07 11:25:52 +02:00
John Laterre (jol) ff0275be6b [IMP] account: credit limit by partners
The basic idea of this functionality is for users
to be able to put limits on Partners that would
trigger non-blocking warnings when trying to confirm new:

- Sales Orders
- Invoices

when that partner has too many open invoices.

task-2722165

Part-of: odoo/odoo#83205
2022-04-01 18:49:46 +02:00
Rémy Voet (ryv) d2f4cad653 [IMP] stock: improve the populate
- Add the `stock.quant` populate script
- Create more valid default location for picking type populate
- Fix currency populate

Part-of: odoo/odoo#77092
2021-09-24 14:00:20 +00:00
wan 3afbd1f58d [IMP] base: populate currency rates 2021-01-22 08:50:34 +00:00
william 8daee18848 [IMP] base: populate currency order on res company
The CHF currency was duplicated. Instead of using an hard coded list,
select from all the active currencies.
These are USD and EUR on a clean DB but it is easy to change if we want
to populate with another currency in some use case, without changing the
code.
2021-01-22 08:50:34 +00:00
william 0fa464e8e3 [FIX] base: populate company_id and user do not consume partner
* When setting company_id on the res.partner, the parent might have had
a different company_id

* We should not consume res.partner's when creating res.user's but
creating new ones instead.
2021-01-22 08:50:34 +00:00
Rémy Voet (ryv) 7d3c334948 [IMP] stock: add populate script 2020-11-30 12:50:09 +00:00
Julien Castiaux 90b52d144a [REF] base: Use Command helper for x2many
Task: 2366606
2020-11-30 10:16:09 +00:00
Victor Feyens 1eabd8e60a [FIX] base/populate: do not empty populated list during population.
The population of res users was emptying the list of populated partner
ids.

The lunch.supplier population was crashing because no partner id was
present in the partner population registry to use as `partner_id` for
the generated lunch suppliers.

closes odoo/odoo#50266

X-original-commit: a2adc346906ee753df6d8e49caa4ee5381629695
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-04-28 06:36:59 +00:00
Christophe Monniez 748cc7e501 [IMP] base, lunch: populate res.users and lunch models
closes odoo/odoo#48636

X-original-commit: f3f2a1e4723240b6396cea943fc86291c16f4c9d
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2020-03-30 21:30:15 +00:00
Xavier-Do 9d1a92548e [IMP] base: populate res.partner and res.company
X-original-commit: f360cc8d80bacf66923e45a98669959133806ff8
2020-03-30 21:30:15 +00:00