having PO
Step to reproduct:
-User A with Admin Project Access Right and no Pucharse Acesss Right
-PO and Project have same analytic_account_id, with PO analytic_account
will place in 'analytic_distribution'
-User A then go to Project Update -> Access Error happen
=> Expected behaviour is to let Project Admin access it
Solutions is to let he/she see it by adding sudo() only
closesodoo/odoo#136045
X-original-commit: 249aaac7bd1a13d62c947cddb1835772659aabff
Signed-off-by: Audric Onockx (auon) <auon@odoo.com>
This commit adds alias table to be sure the `analytic_distribution`
column will not be ambiguous because another table could have the
same column name.
closes#121611closes#110291closesodoo/odoo#131991
X-original-commit: 253479633b32383e141fe2ca2ca7395f22651485
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit's purpose is to allow the user to set the company_id of a project to False, meaning the project is no longer restricted for the user who does not have access to the company of the project. This change induces a lot of other small behavior changes/approximation. Since some fields (currency_id, resource_calendar_id, etc) were company dependent, we had to updates some use cases.
task-3084819
closesodoo/odoo#122144
Related: odoo/enterprise#41363
Related: odoo/upgrade#4947
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
In the multi-company context, it is possible to create
an analytic account without a defined company.
The result is that the analytic account
will not have a currency.
A traceback will be triggered when calculating the
profitability of a project
(for example by changing its status when
the 'sale_timesheet' module is installed).
Solution:
Use the currency of the project.
Introduced by:
68b4ea69c173dd5894bcb42b99e6818f241f9734
opw-3292417
closesodoo/odoo#121143
X-original-commit: 90512da68f776459a8a65bed285f5a178f9dd77d
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
project_profitability + change the name displayed in portal
This commit's purpose is to
- add the computation of the AAL for the project profitabity. If a the
analytic account of a project contains AAL that were manually added (
and thus not linked to any sol/purchase/etc ) those lines are not
computed in the 'other costs/other revenues section.
- to display the title of the ticket/task/project in the name of the page My ticket/My task/My project of the portal
task-2960753
closesodoo/odoo#106438
Related: odoo/enterprise#34344
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
The first problem when multiple analytics accounts exist is the
sql query, it is generated with less placeholders than the actual
parameters.
The second problem is the getter from the collected data dict, it
is assuming there is only a single account.
closesodoo/odoo#115189
X-original-commit: 8da76614c58ea1989694a5af3ee623640db126dd
Related: odoo/enterprise#38146
Signed-off-by: William André (wan) <wan@odoo.com>
Current behaviour:
The project profitability panel doesn't take into account the AA
distribution of the project's AA for solo invoices and bills.
Expected behaviour:
It should take the distribution set into account.
Steps to reproduce:
- Install Accounting, Sales, Project, Purchase
- Settings > Activate AA
- Create a new project with a new AA for it.
- Create a new bill or invoice, on the line set the 2 AA, one with
the project's AA with some X%, and the other AA is irrelevant (the
sum of all AA on the line should be 100%)
- Confirm the invoice/bill
- Go to the project profitability report (project updates), see that
we have 100% of the line value that contributed, when it should have.
Reason for the problem:
The contribution of the AA was not taken into account when computing
the project profitability for solo invoices/bills (invoices/bills
w/o SO/PO respectively)
Fix:
Additionally get the analytic_distribution when fetch the
account_move_lines to compute the project's profitability.
Affected versions:
- 16.0
- saas-16.1
- saas-16.2
- master
opw-3246199
closesodoo/odoo#117163
X-original-commit: c3c66d05d039514c9dd02ebdede20a3dff757728
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
In this commit, we just copy/move the files.
In next commit, delete the part of each file
that is not related to its model.
task-3244226
Part-of: odoo/odoo#116165
This simplifies the use of subqueries by avoiding some costly default
order on the model or the idiotic order='id'. Method _flush_search()
has been adapted accordingly.
Part-of: odoo/odoo#112126
Steps to reproduce:
- create a project with an analytic account;
- create sale orders/invoices and purchase order/bills for a project;
- use other currencies;
- go to the "Project Updates".
Issue:
The amounts are used without being converted
into the currency of the analytic account.
Solution:
Convert amounts used in the currency of the analytic account.
Note:
For performance reasons, it is acceptable to fetch all currency
on the same date to get the conversion rate.
In this case, today's date is the most appropriate
(as the project is in progress).
opw-3193676
closesodoo/odoo#113684
X-original-commit: 68b4ea69c173dd5894bcb42b99e6818f241f9734
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Rework of the hr.expense workflow so that:
- expenses paid by employee generate purchase.order
- expenses paid by company generate entry that look like payments
Main reason being that purchase.receipt are not active by default.
That makes the entry hard to find, holes in sequences, inconsitency
with payment states.
It also remove the refusal of expenses as this was dead / inaccessible code, only reports can be refused.
task-id: 3126550
[community](https://github.com/odoo/odoo/pull/110518)
[enterprise](https://github.com/odoo/enterprise/pull/36090)
closesodoo/odoo#110518
Related: odoo/upgrade#4266
Related: odoo/enterprise#36090
Signed-off-by: Laurent Smet <las@odoo.com>
Current behaviour:
Project Update doesn't take into consideration the `analytic_distribution`
percentage of the analytic_account on the line of the purchase orders.
Expected behaviour:
Account correctly for the % of the analytic account for the project,
just like in the Accounting app.
Steps to reproduce:
- Install Accounting, Sales, Purchase, Timesheet, Inventory, Project
- Activate "Analytic accounts" in Settings
- Create a product service which is creating a project at sales
- Create a new SO, add the service, confirm the SO and invoice
- Create a new PO, add some random product, on that same line add 2
analytic account, 50% of the SO project we just created, and 50% from any other.
- Confirm the PO
- Go to the SO's project update section, observe the cost is 100% of the line cost, not 50%
Reason for the problem:
`analytic_distribution` ratios are not taken into account when calculation the costs
of the project.
Fix:
Get the ratio of the `analytic_distribution` and multiply by it when processing the costs
Affected versions:
- 16.0
- master
opw-3079537
closesodoo/odoo#108222
X-original-commit: b676222c129863c154efb48e454e144b77157617
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Current behaviour:
In the project update dashboard, invoices and bills that are created
directly (without sales order or purchase order) are not taken into account
in the calculations for profits/costs.
Expected behaviour:
They should be taken into account, as long as the line on them has the
analytic account line on it.
Steps to reproduce:
- Install Project, Sales, Purchase, Accounting
- Activate "Analytic Accounting" in Settings
- Create a new Project and create a new analytic account for the project
- Create a Bill with a product (storable/consumable) and the analytic account
on the line
- Post the bill
- Go to your project update dashboard and notice the cost of the bill
is not taken into account, but we do have a smart button that goes to the bills
Reason for the problem:
Profits/Costs calculations are done based on the sales/purchase orders,
missing the "orphaned" invoices and bills. A side effect of this problem,
storable products on sales are also not taken into account, since Sales Orders
don't have an analytic account per line before version 16, unless that product
is a service (all services intrinsically have an analytic account)
Fix:
Get all invoices/bills that have lines with the project's analytic account,
and removing from those the lines that were already accounted for.
Affected versions:
- saas-15.3
- 16.0
- master
opw-3058198
closesodoo/odoo#108176
X-original-commit: 3d3f4109a06445b6ce9606770085c763ea206b35
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
We could do the Group By directly with sql instead of doing the computations by hand afterwards.
As we're already doing a sql query, we can include it here.
closesodoo/odoo#104933
X-original-commit: 3cec95d0a18f3c343db36bb0700936833e98f7fc
Related: odoo/enterprise#33594
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
In `_compute_analytic_distribution`, we're dealing with recordset and so, should iterate on it.
Also, the distribution expects an id, not the record.
closesodoo/odoo#104458
X-original-commit: d41d5ef7aebc9f65066ecf86939e3f60aa515539
Related: odoo/enterprise#33378
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
The `analytic_distribution` field is a Json.
It was stored temporarily as a char.
Search is not available yet, so we do queries by hand when we need to search on keys.
Also added a constraint on account_analytic_distribution_model,
so we don't have models with accounts specific to a company when the model has no company or another company.
It would cause an issue when looking at the models from another company.
X-original-commit: 7064c95aa04e5138bb12ae97acfee04ebb67cc0e
Part-of: odoo/odoo#103097
The goal of this commit is to get rid of the analytic tags as they were confusing, serving tag purposes as well as distribution on analytic accounts.
Everywhere analytic tags were used as a distribution have been replaced with a new widget that will dispatch distribution on analytic accounts. If there was an analytic account field next to the tags, it has been included in the distribution.
Analytic tags that were used simply as information tags have been removed.
To fill the new widget, there are now 2 kind of rules that will help fill and prefill it.
The first are applicability: previous groups have been removed, and have by replaced by plans. Each account is required to have a plan. These plans define when they are available in the widget: a default applicability per plan and applicability lines that can specify rules following the context of the widget.
The second one are distribution models, that will replace previous default rules but follow the same principles. The accounts (and so the plans) that will be given by the distribution model can override the applicability rules from before.
closesodoo/odoo#98914
Related: odoo/upgrade#3885
Related: odoo/enterprise#30743
Signed-off-by: William André (wan) <wan@odoo.com>
Co-authored-by: Habib (ayh) <ayh@odoo.com>
This commit (and its enterprise equivalent) purpose is to smooth the
user experience and remove unnecessary steps.
The commits:
- Remove all stat buttons except the status and collaborators one from
the project edit form.
- Add multiple small changes to string/name fo fields in views
- Change the custom O2M widget for a standard M2M for the management of
child tasks
- Add the milestone field to the portal page of shared project.
- Remove the wizard 'marked_as_reached_milestone'
- Add the automatic generation of milestone when a SO is confirmed if
some SOL need it
task-2941835
closesodoo/odoo#98546
Related: odoo/enterprise#30628
Related: odoo/upgrade#3798
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Before this commit, all the custom code for the widgets, form, list and
kanban views are always in OWL and have to be migrate to the new JS
framework.
This commit converts all the widgets, list, kanban and form views used
in the project app in OWL. Some JS tours has been adapted according to
the OWL views, the project right side panel has been reviewed since it
was LegacyComponent (in old component in OWL)
task-2944742
Part-of: odoo/odoo#98380
Before this commit, when the user is in the project update kanban view
and click on Purchase Order row shown in Project Profitability section
in the right side panel, the user cannot create or edit a purchase order
because the AA on each purchase order line is used to link those
purchase orders to the project.
This commit adds the project and also `project_update` key in the
context to use them keys to set the AA on new Purchase Order Line by
default.
task-2861207
closesodoo/odoo#95721
Related: odoo/enterprise#29304
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Remove most values uselessly specified because giving the same value as
the default one (see _DEFAULT_MANIFEST in odoo/modules/module.py)
* auto_install is Falsy by default
* author is Odoo SA by default
* summary & description are empty strings by default
* application is False by default
* test, demo, depends and data are empty lists by default
This will reduce noise/inconsistencies between manifests specifications,
simplify analysis of manifests content, ...
closesodoo/odoo#90209
Related: odoo/enterprise#26807
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Before this commit, when the user clicks on the Purchase Order row in
costs of project profitability section displayed in right side panel,
the action redirects the user to the list view of `Purchase Order Line`
even if there is only one record.
This commit fixes the issue to display the form view when there is only
one record to display.
task-2814466
closesodoo/odoo#88219
Related: odoo/enterprise#26004
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Before this commit, the PO is only taken into account in the project
profitability if the quantity to invoice or the quantity invoiced is
greater than 0 in its lines. However, we could take into account the PO
when it is confirmed and the products ordered are not delivered to have
an idea on the costs impacted by this PO.
This commit computes the costs impacted by the PO linked to the AA from
the project if the PO is confirmed and there is a quantity ordered or
invoiced or to invoice in its lines. If no quantity to invoice is found
then the amount to invoice will be the price unit of the product
multiplied by the difference between the quantity ordered and the quantity
invoiced.
task-2814466
Part-of: odoo/odoo#88219
Before this commit, the order of rows shown in costs and revenues is not
fixed and depends on the order of the modules.
This commit adds a sequence on each row and then sort the rows to fix
the order of those rows.
task-2710808
Before this commit, the label is giving with the data computed for the
project profitability.
This commit separes the label with the data to avoid translating many
times the same things.
task-2710808
Before this commit, the project profitability shows the total due to the
purchase orders linked to the project. However, the user cannot easily
sees which purchase orders impact the project profitability.
This commit adds an action to see all purchase orders related to the
project. However, the 'Purchase Orders' section in the costs will be
clickable only if the user has access to the purchase orders
task-2710808
Before this commit, when the `purchase_orders_count` field is computed,
we do a search in `purchase.order.line` to get the purchase order linked
to the projects in `self` of the `_compute_purchase_orders_count`
method. However, if no project has AA set this search is useless, we can
directly set `purchase_orders_count` to 0 for all projects because the
linked between the POs and the projects is made with AA of the project.
This commit changes the method to search the PO linked to the projects
only when at least one project has AA set, otherwise we directly set the
`purchase_orders_count` to 0 for all projects contained in `self`.
task-2710808
Before this commit, the translation is not done in lazy, so for each
stat button shown in the right side panel of the project update, a query
is done to find the correct translation based on the language of the
user. It means, the translation is costly and need to be done in lazy to
reduce the time for the translation of those stat buttons.
This commit uses the `_lt` to translate in lazy mode those stat
buttons. By doing that, the execution time is reduced from 750 ms to 250 ms.
X-original-commit: 95fe018
Part-of: odoo/odoo#85660
Co-authored-by: Yannick Tivisse <yti@odoo.com>
Co-authored-by: Laurent Stukkens (LTU) <ltu@odoo.com>
This commit modifies most of the usages of read_group and uses
_read_group instead. _read_group doesn't join automatically on the
many2one fields when no order_by is specified, making it more performant
when the "name" of the many2one is not relevant, which is the case for
most back-end cases
closesodoo/odoo#84908
Task-id: 2479334
Related: odoo/enterprise#24877
Signed-off-by: Raphael Collet <rco@odoo.com>
This commit adds plenty of new demo data showcasing some features that weren't before, and also reworks existing demo data to make is more consistent.
Closes#80102
Task 2669762
The project overview is a significant technical debt
as it is a custom qweb view. It is quite limited:
It is not possible to group the data, to filter on dates,
SOs or Field Service projects.
Improving this is very difficult and would require weeks
of development that are not worth it.
In any case, all the information provided by the project overview
can be found elsewhere. The stat buttons of the report are basically
duplicates of the ones from the project form view.
Therefore, we are removing this report and its twin,
the Project Costs and Revenues.
In addition, analytic items lack context for the user to understand
what generated a certain cost or revenue:
there is no link to the source document;
the entries are not categorized (e.g. it is not easy to understand
if a cost comes from a timesheet cost, a purchase order or an expense);
the billable type group by works fine for timesheets but then all
the other entries are flagged as Undefined, which is not very helpful;
there is no option to easily isolate costs from revenues.
task-2646234
See odoo/enterprise#20936closesodoo/odoo#76553
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
*: account_sale_timesheet,
project_hr_expense,
project_mrp,
project_purchase,
sale_project_account
This commit fixes issue regarding fields in project form stat buttons.
Those fields are evaluated in any cases, and should rather be computed
only when the user has the right group.
Steps to reproduce :
1) Install project with one of this bridge
2) Connect with a user with only the group_project_admin right
3) Go to the form view
4) Issue:
An internal user with the group "Project Administrator" is unable to
access the form view of a project because of missing rights on the
X model.
Desired Behavior
================
The stat button should not be shown and the field not computed.
opw-2675514
closesodoo/odoo#78981
X-original-commit: 981bbf59d624c3a7bd22d6d7bf26c09e14835862
Related: odoo/enterprise#21889
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
We are copying 3 stats buttons from the project
view form (manufacturing orders, work orders and bills of materials)
and we add them to the project update page.
See task-2638359
closesodoo/odoo#76421
X-original-commit: 4572e710a5e755c0c75c95a6d033e44f0a2799f8
Related: odoo/enterprise#20811
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
This commit extends project form and panel in order to add buttons
which allow user to view documents linked to the project analytic
account.
This commit adds bridge modules in order to handle those extensions.
PR : #72736
See odoo/upgrade#2706
task-2545084