Prior to this commit, the cost of a service product was computed based
on its standard_price.
With this commit, the product cost is computed based on the timesheet
amounts linked to the sale order, if the sale order has a delivering
method of type timesheet.
PR : #70527
See odoo/upgrade#2616
task-2458135
A new field on tax groups makes it now possible for this group to be displayed under a subtotal label. If not set, this defaults instead to "Untaxed Amount", keeping the traditional behavior. This is intended for withholding taxes, which can now be implemented with negative taxes and a tax group with this field set.
To do that, this commit entirely refactors the way amount_by_group worked, and replaces it with a more complete json field called tax_totals_json. It also streamlines the way taxe totals are displayed on invoices, PO and SO and makes it so that a common code is called instead of copy-pasting the same block 3 times as before.
[IMP] purchase: always display tax totals by groups on purchases orders
Before, tax totals on purchase.order's form were not shown by group, and were instead all aggregated in a single "Taxes" category. The same went for the pdf export. The portal view, though, did show the totals by group. We now display the tax groups in the same way all the time.
closesodoo/odoo#74138
Task: 2457374
Related: odoo/enterprise#19802
Related: odoo/upgrade#2670
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
The license is missing in most enterprise manifest so
the decision was taken to make it explicit in all cases.
When not defined, a warning will be triggered starting from
14.0 when falling back on the default LGPL-3.
closesodoo/odoo#74245
Related: odoo/design-themes#48
Related: odoo/enterprise#19862
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
- Create a service product with cost 0
- Create a sales quotation
- Add the service product, change the cost to a positive quantity
- Save and Confirm.
Purchase Price (cost) will be reset to 0
opw-2481564
closesodoo/odoo#70036
X-original-commit: 8a8ff03f6111f377bcd9c2b0f584c450b82a4182
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
Steps to reproduce the bug:
- Activate Margins in Sales > Settings
- Go to the pivot view of quotations
- In Measures, click Margin (%)
Bug:
Margin percentages are aggregated by computing the sum of the margin sub-percentages instead of using the data of the aggregated row (i.e. agg. margin / agg. total).
Explanation:
This is one of the flaws of the pivot view. The best way to solve this would be to create a custom aggregation in PostgreSQL.
This commit is just hiding the measure for now.
opw:2349896
closesodoo/odoo#60354
X-original-commit: 1e3fc6894b13d51a3f6327653afbf8d5a316a21d
Signed-off-by: backspac <backspac@users.noreply.github.com>
When installing sale_margin, the computed fields will be computed on existing
sale.order and sale.order.line in database. On huge databases, the computation
may take a lot of time, depending on the configuration (multi-company, multi-currency, ...)
The current commit improves the computation of the purchase_price
(recently changed to a computed field), by avoiding unnecessary currency
conversions when possible (one less query to get the conversion rates).
In a multi-currency database where the products have no cost defined
(standard_price field), the sale_margin installation takes up to 50% less time.
closesodoo/odoo#52338
X-original-commit: 3c9841d1aa4fc5b10012c8239a31d6e7f8676fc0
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Installing sale_margin module on a db with a lot of sale.order was impossible.
This commit significantly improves performances.
Went from many hours (forecasted) to 15 minutes on a db with 300k orders
For sale.order:
- Duplicating logic between edit mode and non edit mode
- Edit mode logic stays the same as before
- Non edit mode uses read_group to speed up the computation
X-original-commit: 9f1ea7427cdb6984f175f5111e4c9a4c5f013af2
And use "Margin (%)" for the recently added margin_percent field
computing the margin in % and not in money.
closesodoo/odoo#43130
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Onchanges can be triggered after computes and therefore, we could have a line with an uom
but without product, leading to a conversion from "no uom" to the order line uom, which isn't
accepted.
closesodoo/odoo#42691
X-original-commit: 1bc9963cfc19a4bc5896a647423f81274936db00
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
New field to express the profitability percentage of a Sales Order (/SO line).
task-2033253
closesodoo/odoo#39926
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
Without demo data, for the odoo-master transifex project
closesodoo/odoo#41935
X-original-commit: dab7670b73506fb3a835695ee3bd735e0c5e5c2b
Related: odoo/enterprise#7287
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Since the purchase_price is now computed, it may be triggered before an
uom is set on the product line (onchanges may happen after computes).
closesodoo/odoo#41808
X-original-commit: 9ebbdd24752a0ff1c1057fc533074555810ffa39
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Followup of a425695e
The terms were back in 12.0
Courtesy of Juan José Scarafía
closesodoo/odoo#41624
X-original-commit: 85d0c7001a997748d7691205bbb8d066597591a5
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
When creating sale order lines from the matrix (sale_product_matrix),
the purchase_price weren't computed
No cleaner change has been found to ensure the cost is computed.
Triggering all onchanges from the server side is quite tricky and dirty
to do...
closesodoo/odoo#40986
X-original-commit: 5c15b1310729129e390b455b0d1e0ac367f8dd69
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit removes some groups that are now useless since their
only purpose was to allow the user to hide or show some fields
depending on its value, but those fields are optional now.
Task-1902765
closesodoo/odoo#31944
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
The goal is to be coherent with the user property.
Actually, company_id and company_ids on the environment are no fields.
Calling env.company_id returns a browse record, not an id.
* account, hr_contract, hr_expense, point_of_sale, sale_margin,
website_sale_delivery, website_sale_wishlist
digits only works on Float fields, on Monetary fields it has no
effect:
- The column_type of a monetary field is always numeric
- It is not applied in `convert_to_column()` or `convert_to_cache()`
- It is not part of `description_attrs`, so it will not be included in
the output of `fields_get()`
closesodoo/odoo#35336
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Since previous commit moved decimal_precision module's feature into base,
use the new syntax for fields declaration
Remove the imports to the removed module
Remove the module from dependency in manifest
sed -i "s|digits=dp.get_precision('\([A-Z a-z]*\)')|digits='\1'|" **.py
sed -i "/from odoo.tools import decimal_precision as dp/d" **py
Purpose
=======
Allow the user to select the allowed companies for which he wants to see records
on top of selecting his current company.
It is confusing for users to see the records from the company he is connected to
and the records of the children companies.
Instead of using the hierarchy of companies to access records across companies,
the user can now select (from his set of allowed companies) the companies for
which he wants to access records.
/!\ This means that the user will interact with records from company A when in
company B.
Example: a SO has been created and confirmed in A. When in B, I create the
invoice from it.
Specifications
==============
1/ Deprecate the parent/children hierarchy on the res.company model. The fields are
kept on the res.company model to ensure the retro-compatibility, but won't be used
accross the standard code anymore. The only functional usage for this mechanism
was to allow to see records from several companies by creating a virtual parent
company, which will be possible with the new mechanism.
2/ By default, a user will only see the records of the company he is connected
to (or records without a company). (It is still editable by the user if needed).
For that, put this information in the user context, to allow having different
configurations on different browser tabs. Instead of having domains like
['|',
('company_id', '=', False),
('company_id', 'child_of', user.company_id.id)]
you'll have something like
['|',
('company_id', '=', False),
('company_id', 'in', company_ids)]
Note that the 'company_ids' is a value that is passed in the evaluation
context on the record rule, as we already have user, or time.
company_ids is a list of the ids of all the enabled companies in the
user's context.
3/ Out of the generic improvements brought by this task, this will illustrate
issues that could exist since several versions. For example, it should not be
possible to create a scrap order for the company A with a package of the company
B, or it should not be possible to create an invoice on the company A with
payment terms from the company B. Before the version 12.0, it was easy to
encounter this kind of issues as the admin was the SUPERUSER_ID. A positive side
effect of the fact that the SUPERUSER_ID has become an inactive user was to
make it more difficult to introduce mismatch on the records, but haven't solved
the issue, as it was still possible to do it with parent companies
configuration. Some of these issues have been fixed in this commit, but all the
business flows should be re-tested to check if an ir.rule should be introduced
(eg: a multi company rule for stock.quand.package), if the company of a record
is correctly transfered to another record created from the first record (eg:
From a SO, create an invoice and a payment, the company of the sales order
should be transfered on the invoice and the payment, even if the company of the
sales order is A and I'm logged into the company B with the company A enabled.
4/ Currently, if I click on a button on a notification email (example 'View
Task'), I face a traceback if I'm not logged into the company of the record.
Now, if you click on a button and if you have access to the record, the correct
company will be automatically set.
5/ If I display a kanban view with several records from several companies (and
an image), all the images should be displayed.
6/ Currently if you copy paste an url, this will crash if you're not in the
correct company. This won't be fixed because it's quite impossible to do it in
a clean way. This task brings a workaround. Copy/Paste -> Traceback -> Log into
the correct company, re-copy/paste -> Ok.
7/ 2 property methods have been added on the environment to retrieve the company
on which the user is logged in and the companies the user enabled, on a specific
tab.
That way, when creating a record, instead of doing
default=lambda self: self.env.user.company_id
do
default=lambda self: self.env.company_id
On the other hand, to retrieve the enabled companies, do
companies = self.env.company_ids
8/ Modify the Company Switcher widget to allow to log into another company
WITHOUT writing on the res.users (and thus bringing cache invalidation issues
and so on). Also allow to enable several companies and see records from several
companies, and independantly of the other browser's tabs.
9/ When focusing on a tab, save the current company configuration on the local
storage. That way, when doing 'CTRL+T' or a middle click, the context is
propagated to the new tab.
10/ Improve the error message in case of multi company access errors. Now, when
the user is in debug mode, display the related names of the records and the name
of the user who brings the issue.
11/ Remove the context erasing when writing on a res.users
This is probably coming from the migration to new API of the base module.
The context was not propagated at this moment, which was a common mistake at
that time. When migrating the module, probably by using the 'black box' method,
as the context was not propagated, it was erased on the new version. This is
now an issue because the context (i.e. the enabled companies) was erased when
writing on a res.users, leading to tracebacks.
See: https://github.com/odoo/odoo/commit/7eab8e26d3d46c53f4be924d6a34e80a66e74960#diff-4c2e738ee8f64f11806c889ea097b5e7R624
12/ Fix the crash manager on redirect warnings. The issue is the following
- Create an invoice on a company without a configured CoA.
- Set a partner
- On the onchange_partner_id, a redirect warning is raised to propose you
to configure a CoA
- Click on 'Go to the configuration panel'
- A generic warning says something like 'Do you want to discard your changes?'
- Click on yes, the page refreshes, but not on the redirect action.
Now, set correctly the action on the hash, and reload instead. The breadcrumb is
lost for example, but you reach the correct action at least.
13/ Introduce a res.group to enable/disable the multi company per tab
feature.
14/ To help the users to know which tab is in which company, add the
possibility to have a favicon per company. When creating a company,
the classical 'O' icon is colored by default in a random color.
15/ Remove the company switcher on the frontend. This was mainly there
to allow a user to swicth to the company linked to the website.
This behavior is now transparent to the user. If the website A is
activated, then the company set on the context is the company of the
website.
16/ Deprecated the _company_default_get method on the res.company
model. Remove the method _get_company on the res.users model.
17/ Add 'allowed_company_ids' and 'current_company_id' on the pyeval
context. You can now use those variables on domains in the views to
access directly to the activated company.ies on the current tab.
TaskID: 1960971
closesodoo/odoo#32341
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
In a SO without customer:
Before this commit, the _product_margin wasn't working. This because,
as the customer is not defined, the pricelist isn't defined either,
and therefore currency of the pricelist is also undefined.
When you call the round function, in an undefined currency
an error is raised.
Now we take into account if customer is defined.
closesodoo/odoo#30675