If you create an applicability and remove the company field,
they are never used.
An applicability like this should be valid for all companies.
We put a 0.5 value for the company field so an applicability
so it has a lesser priority than other fields.
Same idea as the distribution models.
opw-3847415
closesodoo/odoo#162152
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Steps to reproduce:
- Activate "Analytic Accounting" in Accounting settings
- Switch to a mobile view
- Go to any view where there is the analytic distribution widget (e.g. expense form)
- Try to configure the analytic distribution
Issue:
When an analytic account is selected, it is not taken into account.
Cause:
In mobile view, a modal is opened with a kanban view to select the
analytic account.
Any click on this modal is closing the analytic distribution widget.
opw-3734050
closesodoo/odoo#162092
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Currently when we have an Analytic Filter applied on an accounting
report, we lose that filter when we click on any amount to audit the
journal items.
This fix makes sure that when auditing, we only view the journal items
filtered by the Analytic Filter.
In order to do that, we extend the search function in the analytic mixin
to allow searching on analytic account ids.
task-3718751
closesodoo/odoo#161873
X-original-commit: 2e3be9726514f74ea8c0c2314c9cdfeb6ed57915
Related: odoo/enterprise#60742
Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
The fields in analytic have a group which is defined in account.
We hide them in analytic module and show them in account with the right group.
We also show balance now, even if you don't have the group 'readonly',
because it's an information that is independent of credit/debit notion.
Linked to runbot error 59222 (will need to remove the group in the test)
closesodoo/odoo#159085
X-original-commit: e7e3ec8cb5e4f71ce1dbbd24485c3377c694e5eb
Signed-off-by: John Laterre (jol) <jol@odoo.com>
Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
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.
closesodoo/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>
Steps to reproduce issue:
1. Have Sales installed
2. Enable Analytic Accounting and create two Projects
3. Go into both Project Settings and add distinct Analytic Accounts
4. Create a Vendor Bill
5. Add a Product Line and put both accounts in the Analytic Distribution
6. Add an account in another column to one of the existing Analytic Distribution Lines
7. Go to Projects and open the Project Updates of the Project whose account was alone in the Analytic Distribution Line
8. You get the error:
> invalid literal for int() with base 10: '[int],[int]'
Explanation:
With commit odoo@dc696c8ed4850a83b6af721002a90f2944891923, the way IDs are stored changed. They are now computed in a csv string.
A part of the Analytic Accounting pipeline didn't get updated after that change, making a lot of the features not working properly.
Suggested fix:
- We must take into account the multiple analytic plans in any order possible in the ID search.
- Because the amount of `account.move.line` can increase rapidly, the new ID search must be indexable.
- We reworked the counting query to avoid `account.move` being counted multiple times.
opw-3626619
closesodoo/odoo#147664
Related: odoo/enterprise#54311
Signed-off-by: William André (wan) <wan@odoo.com>
Have company A and company B
With company B:
- Create an analytic plan with default applicability 'Mandatory'
- Add an applicability: domain 'Expense', applicability 'Mandatory'
With company A:
- Open the same analytic plan
- Set default applicability 'Optional', no assigned applicability
- Add an analytc account for the plan
- Create an expense, add amount
- Create report > Submit to Mananger > Approve
Issue: Action will be blocked by Warning message
"One or more lines require a 100% analytic distribution."
This occurs because the system checks all applicabilities of the plan
without taking into account the company
opw-3709374
closesodoo/odoo#155195
Signed-off-by: William André (wan) <wan@odoo.com>
On the analytic widget, when putting an Analytic Account, a floppy disk appear
on top of the wizard.
This button is used to create a new analytic distribution template. It is
confusing for users that thinks that the purpose of the button is to save the
analytic distribution.
This PR will replace the button to be a link called "New model".
Also, this pr will fill some field (partner_id, account_prefix and product_id)
if there are populated.
closesodoo/odoo#155611
Task: 3736786
X-original-commit: c44367a2f67f305052d28a3b9e313ad63ff46907
Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com>
Signed-off-by: Maximilien La Barre (malb) <malb@odoo.com>
Steps to reproduce:
- activate analytic
- Create two assets with different analytic distribution
- Open the first asset
- Navigate to the second asset via the arrow
Issue:
The analytic account will not be displayed correctly
Cause:
In `jsonToData` the record used is the previous one.
Solution:
Use the record that will efectively be displayed
opw-3698383
closesodoo/odoo#153681
Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com>
Before this commit, when a salesman user without any access in other
apps (just has the `sales_team.group_sale_salesman` group) creates
an SO and adds a SOL for a product with `expense_policy='sales_price'`
and then confirm the SO, he will got a traceback because he does not
have access to `analytic.account.line` model. The reason is because
an analytic account has to be generated for the SO since there is an
expense product in its SOLs and so during the generated of analytic
account a check is triggered to be sure the company set on that
analytic account is correct.
This commit adds a sudo before calling the search method in
`analytic.account.line` model to do the check without checking
the access right since the user does not really want to read the
analytic account line.
Steps to reproduce
==================
1. Log in as Salesman user (without other access)
2. Create a product and the expense policy to Sales price.
3. Create a SO and add a SOL with that product
4. Confirm the SO
Expected Behavior
=================
The SO should be confirmed without any issue (and an analytic account
should set on that SO)
Actual Behavior
===============
Traceback is occured because the user cannot access to
`analytic.account.line` model.
Follow-up task-3256865
closesodoo/odoo#155238
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
You should be able to create analytic plans with analytic group.
But currently, you need Access Right's group.
We should put a sudo there.
closesodoo/odoo#151328
Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com>
For a first iteration, Russian translations were done using DeepL using
1 large .pot file of all the standard modules to translate (e.g. no
localizations, no test modules, etc). Unfortunately for some reason
doing a msgmerge with the existing ru.po files didn't seem to work, so
old "Translators" metadata at top of files were lost (maybe they will be
re-added during next Transifex sync?)
Part-of: odoo/odoo#152285
The table linked to analytic items can be pretty huge, and searching by
account needs to be fast.
For instance, this index can be used when deleting an account because of
the foreign keys.
closesodoo/odoo#151366
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Deleting an account or a plan shouldn't raise errors or provoke errors
elsewhere.
Since the `analytic_distribution` doesn't have a proper foreign key, an
account might be deleted while still being referenced. Because of this
the code needs to be defensive everywhere: we can't trust the content of
the JSON field.
Also, add tests to ensure that we can't delete a plan while the field is
still referenced in views.
closesodoo/odoo#152494
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
The `sum` function needs to be given a compatible for the `start`
argument.
Instead of using that function for a simple sum of two elements (not
`int`), lets just sum them explicitly instead.
Traceback:
```
TypeError: unsupported operand type(s) for +: 'int' and 'account.analytic.plan'
```
closesodoo/odoo#151738
Signed-off-by: Raphael Collet <rco@odoo.com>
When having an analytic plan with subplans, with analytic
accounts on each, the all accounts count is not well computed
on the subplans.
opw-3677889
closesodoo/odoo#149898
Signed-off-by: William André (wan) <wan@odoo.com>
Issue:
- When you have analytic plans but no analytic accounts you got a
traceback when you tab through the fields on a vendor bill.
Steps to reproduce:
- In accounting app create a vendor bill where analytic plans exist
without associated analytic accounts.
- Use the key 'Tab' to move through the fields on the vendor bill.
- Notice Traceback error.
Solution:
- Checking if the dropdown is not empty before proceeding with the Tab
key logic.
OPW-3648815
closesodoo/odoo#147807
Signed-off-by: William André (wan) <wan@odoo.com>
To reproduce:
- Create a new plan with an account
- Add an analytic item with this account
- Go to the view of this account
- Gross Margin Button has a value
- Click on it
=> List is empty
The reason being that the view should not include account_id,
but auto_account_id
closesodoo/odoo#147080
Signed-off-by: William André (wan) <wan@odoo.com>
To reproduce
============
Users in a newly created database are not able to create new projects
that has timesheet enabled
Problem
=======
when creating a project with timesheet, an analytic account is created
which requires reading `analytic.plan` which leads to the access error
Solution
========
read `analytic.plan` through `sudo`
opw-3642817
closesodoo/odoo#146769
Signed-off-by: William André (wan) <wan@odoo.com>
Anlytic distribution models did not apply to bank recon entries. The corresponding enterprise PR activates the feature, however due to dependencies on non-precomputed fields, the attribute is removed
OPW-3558060
closesodoo/odoo#146235
X-original-commit: b9047febf3c4d67ce409f9f1dba8a9cc7c7165fe
Related: odoo/enterprise#52742
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com>
If we have an analytic plan without analytic accounts, but with
subplans that do have analytic accounts, we do want them to
appear in the widget.
Also changed a search in a loop to a read_group
closesodoo/odoo#142222
Signed-off-by: William André (wan) <wan@odoo.com>
Reproduce:
* create a sub-plan (with parent_id)
* make that plan a main plan (void parent_id)
* open the analytic line view
Result:
Traceback because the dynamic field was not created
closesodoo/odoo#141409
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
1. Order Plans by sequence in the widget and analytic item views
2. Add amount_field to analytic widget in sales and purchase views
3. UI improvements (split plan name and percentage)
Task-3572128
closesodoo/odoo#141030
Signed-off-by: William André (wan) <wan@odoo.com>