Each order does necessarily have the same confirmation template.
And `_get_confirmation_template` is `ensure_one` so it raises when self holds multiple records.
closesodoo/odoo#128743
Forward-port-of: odoo/odoo#128551
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Previously, customers were not allowed to sign a draft quotation.
We consider that if the customer has access to the quote, he should be able to sign/pay it (instead of getting some strange feedback that the order is not in a state requiring signature/payment)
task-3340541
closesodoo/odoo#124486
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
When creating a Vendor Bill, the default Sales Team & Person of the company is
assigned to the Vendor Bill. The field isn't even displayed, it's hidden, you
can only display it with Studio and can't even change it.
The fact is : purchases and sales are two completely different roles and
business in companies. This has the indirect consequence that any user that
follows the default Sales Team will get notified of any new Vendor Bill created
in Accounting, which he very likely does not need/want to see.
This PR correct that by adding a condition on the filling of these fields. These
fields will be filled when the move is a sale document.
closesodoo/odoo#120628
Task-id: 3279233
Related: odoo/enterprise#44034
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Since 7bd93cc64b, we add the amounts to
invoice from sales order to the credit limit warning. When looking at
the credit amount on a partner from an accounting perspective, it is
not correct though that sales orders to invoice are considered as well.
In this change we split the credit amount from invoices and from sales
orders to invoice. On the partner we only show the credit amount from
invoices. In other places we add both.
task-3375260
closesodoo/odoo#128158
X-original-commit: 94eae9b73995dbf2175ecee65548ace5a382f5f8
Signed-off-by: John Laterre (jol) <jol@odoo.com>
Signed-off-by: Dylan Kiss (dyki) <dyki@odoo.com>
Issue:
The `_compute_amount_to_invoice` computation wasn't taking
into account the fact that invoices have a direction (i.e. either
going outbound(+) or coming inbound(-) (cf. `_compute_direction_sign`)).
This, in turn, makes the value of `amount_to_invoice` incorrect
for sales order with a credit note.
Solution:
In `_compute_amount_to_invoice`, multiply the value of
`invoice_amount_currency` with the opposite of the
`direction_sign` of the invoice, to account for the invoice direction.
opw-3360439
X-original-commit: 06ef17f2eefe89abfca64721185ac053fa8de820
[FIX] sale: fix amount to invoice for credit notes
Issue:
The `_compute_amount_to_invoice` computation wasn't taking
into account the fact that invoices have a direction (i.e. either
going outbound(+) or coming inbound(-) (cf. `_compute_direction_sign`)).
This, in turn, makes the value of `amount_to_invoice` incorrect
for sales order with a credit note.
Solution:
In `_compute_amount_to_invoice`, multiply the value of
`invoice_amount_currency` with the opposite of the
`direction_sign` of the invoice, to account for the invoice direction.
opw-3360439
closesodoo/odoo#127914
X-original-commit: d258774f120fb470d969e68c05cf0d8da0c4557a
Signed-off-by: John Laterre (jol) <jol@odoo.com>
Since odoo/odoo@2b1e2abda3 user need at least 'Account / Billing'
access to read payment.transaction, that not the case for most salesman.
So for user that don't have 'Account / Billing', this commit do:
- compute the 'amount_paid' as superuser
(fixing "Generate Payment Link" wizard access errors)
- hide "Payment Transaction" smart-button on invoice
closesodoo/odoo#127835
X-original-commit: ad2c3a873a926ac8c94d014af24ed400b493493e
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Xavier Alt (xal) <xal@odoo.com>
- The private addresses have been removed from the "res.partner" model.
- The employees' private address information has been moved to the "hr.employee" model, preserving the old records but emptying the private information fields.
- The applicant's private address information has been moved to the "hr.applicant" model, following the same approach.
- More generally, some efforts have been done to ensure we only create and use the same partner from the application form, to the employee creation and also the user creation.
- The salary configurator offer mechanism has been improved to provide stability (no more arguments in URL), traceability (track changes and responsibles) and reporting.
closesodoo/odoo#120586
Taskid: 3101400
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Prior to this commit, the patches done by `account_portal.js` and
`sale_portal.js` were done without any import.
This means that the widget it modifies (PortalHomeCounters) might not
already be loaded in the registry. This could lead to some issue later.
This commit uses an "import" statement on the module that defines
PortalHomeCounters to ensure that it is present in the registry.
task-3249625
closesodoo/odoo#127371
X-original-commit: 7937dbec9699e7d0f68450c469c9b742446303eb
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
- 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
The `sol_product_many2one` field is a sub many2one field that should
open the proper configuration system, such as the product configurator.
Before this commit, when inputting some data, then clicking on another
notebook tab, we would often see a crash, because the field has been
destroyed (since it is no longer in the current tab) and it tries to
open the configurator, which requires rpcs.
It is usually a problem when a destroyed component tries to perform some
work. Note that it happens at creation and update. Also, the field
overrides some many2one methods that display confirmation dialog. To fix
this, this commit simplifies the field by only calling the configuration
methods when its value has changed. This is a different strategy that
does not interfere with the many2one basic features. Also, it does not
crash since it will only call the configuration methods on patched, so
it is guaranteed to be alive.
It is certainly not a complete solution, since we should probably move the
code somewhere else not in a field widget, but this would require a
redesign of the code, so it is not appropriate in a bug fix anyway.
Note that the tour had to be adapted, since now the methods
_onProductUpdate/_onProductTemplateUpdate are now called in an effect
(so after a render), which is slightly later than before. But the tour
would click on confirm even before the product update code was executed,
which means that the product was not properly configurated.
This is clearly a concurrency problem: the product configuration code
should be properly coordinated with the basic model, but doing so is a
significative change. Also, in practice, it is not worse than before
this commit.
opw 3178297
closesodoo/odoo#127048
X-original-commit: de7a6f5f3d83356eb02f8fc25b4a0b8aabb946b3
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Géry Debongnie <ged@odoo.com>
* = 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
Brazilians don't expect to see tax-related info on quotations. This
modifies the quotation PDF and online quotation views. Adding t-ifs
with position="attributes" was considered but doesn't play well with
other modules who would want to modify the same elements in some way.
Therefore a similar approach to account.report_invoice was
taken. Small functions on sale.order will determine what views will be
used. This allows l10n_br_sale to dynamically return its own
primary=True views when Brazilian records are shown.
task-3325740
closesodoo/odoo#122987
Signed-off-by: Josse Colpaert <jco@odoo.com>
The previous commit introduced an optimization to reduce the number of
queries and fields fetched when we call `name_search`. But it works much
better when the dependencies of `display_name` contain field names used
in the calculation (on the same record/model).
Then, to improve the performance and the cache coherency, add `depends`
and `depends_context` depending on the custom `_compute_display_name`.
Add only the first level of dependencies (never traverse relational
field) because only these have a positive impact on the previous
optimization and the cost is very low (see `modified`).
About `depends_context`, we don't include `lang` because (when `_` is
used by example) it is unlikely to get the same display_name in the same
request with two different lang.
closesodoo/odoo#122085
Related: odoo/documentation#4639
Related: odoo/enterprise#42599
Related: odoo/upgrade#4780
Signed-off-by: Raphael Collet <rco@odoo.com>
Rationale
=========
Since v8, the `display_name` field is present on all models. By default,
`display_name` uses `name_get` which has pretty much the same purpose
(return record name used by the web client). Gradually, many (backend)
developers (and the ORM: https://github.com/odoo/odoo/commit/6da1c3ac4c036eac289597602976538e243cb939)
started using `display_name` (more convenient than
`record.name_get()[0][1]`) but it still had the `name_get` override.
It becomes more complex than necessary and poeple start to misunderstand
the two (and sometimes override both, leading to inconstiencies between
`display_name`/`name_get`).
To simplify the ORM and the API, we decided to keep only one of them,
the `display_name` field:
- It is much more convenient from a backend point of view
(`record.name_get()[0][1]` vs `record.display_name`)
- It is cached during the same transaction (and invalidated if
its dependencies change)
- It can be overridden like any other compute field (override
`_compute_display_name` with any extra dependencies)
- `name_get` is replaced by `read(['display_name'])`
(API perceptive), which can actually be more efficient
(if `display_name`'s depends are correct, the ORM will only fetch the
fields it needs instead of every prefetchable field)
Changes
=======
- Deprecates `name_get` for the v17 and based the method on
`display_name` (the opposite of before)
- Converts all usage of `name_get`
- Overrides of `name_get` are now overrides of `_compute_display_name`
- For `res.partner`, rename the field store `display_name` into
`complete_name` because `display_name` context-dependent and it makes
no sense to have a compute store that is context-dependent.
- Previously, it was possible to return multiple names for the same
record with `name_get`, but it was tricky and most of the usage of
this `name_get` didn't take this into account. The only example of
this is the `name_get` of `product.product`
(now use `", ".join(<names>)`).
Part-of: odoo/odoo#122085
It's not a specific state, it should be considered separately,
as a boolean.
This allows to reduce code complexity (flows should not rely (much) on
the locked logic) and to have a clearer flow.
Task-3163931
Part-of: odoo/odoo#115871
Before this commit the reports in sales and associated app suffered from a confusion between
multiplicative and divisive rates for currency conversion. After this commit this will no longer be
the case.
There are several models with their own currencies that are involved in computing the amount of a
sale order:
- the order's company currency `order.company_id.currency_id`
- the order's pricelist currency `order.pricelist_id.currency_id`
- the product's currency for each product in the sale order `product.currency_id`
In the case of a report we need also to take into account the current user's company currency:
`self.env.company.currency_id`.
The `sale_order.currency_rate` is the **multiplicative <u>rate</u>** to convert from the company
currency into the SO currency.
Any product added to a sale order follow the next conversion. Let `conversion_rate` be the conversion
rate between the product's currency and the order's company currency, then:
```python
product_amount_converted = product.list_price / conversion_rate
order.amount_total += product_amount_converted * order.currency_rate
```
The rates returned by `_get_query_currency_table()`, on the other hand, are computed as the
**multiplicative <u>ratio</u>** to convert from each company currency into the current user's
company currency.
Any order that is to be analysed on a *report* follow the next conversion. Let `current_company_currency_rate`
be the conversion rate between the order's company currency and the current user's company, then:
```python
order_amount_in_cmp_currency = order.amount_total / order.currency_rate
report.order_id.price_total = order_amount_in_cmp_currency * current_company_currency_rate
```
What follow is a numerical example. Suppose you have the following multi-company and
multi-currency environment.
|order.id|order.company |line.subtotal|order.currency|order.currency_rate|
| ------ | ----------- | ----------- | ------------ | ----------------- |
|1 |BE Company (EUR)|1000 |INR |89.46 |
|2 |BE Company (EUR)|2000 |USD |1.09 |
|3 |BE Company (EUR)|3000 |EUR |1.0 |
|4 |US Company (USD)|4000 |USD |1.0 |
If we try to convert all of this for reporting in the US company, the currency table returned by
`_get_query_currency_table()` will give this (company currencies vs USD):
|currency_table.company|currency_table.rate|
| -------------------- | ------------------ |
|BE Company (EUR) |1.09 |
|US Company (USD) |1.0 |
Finally, in order to convert each amount into USD, applying the formulae listed above should give
the following result:
|order.id|order.company|display_price_usd |
| ------ | ----------- | -------------------------- |
|1 |BE Company |1000 / 89.46 * 1.09 = 12.18 |
|2 |BE Company |2000 / 1.09 * 1.09 = 2000.00|
|3 |BE Company |3000 / 1.0 * 1.09 = 3270.00 |
|4 |US Company |4000 / 1.0 * 1.0 = 4000.00 |
|Total (USD): 9282.18|
Task - 3277006
closesodoo/odoo#125402
X-original-commit: e8f7a692eaf6b87ccf4a8d95b7a46146b1199bf2
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Horacio Tellez Perez (hote) <hote@odoo.com>
The whole contextual price of products relies on multiple context keys:
* uom
* pricelist
* quantity
* date
The related logic has already been partly removed/deprecated on products,
but the computation of discounts for events/event booths are still relying
on that logic, though imperfectly.
This commit makes sure this hacky logic (relying on those contextual keys)
is as clear and reliable as possible.
We factorize and harmonize the remaining use cases, with a dedicated constant
and specific methods, making sure:
* currency conversion
* price & discount computations
are coherent, while clearly explaining that it should not be used for
any new feature/logic/code.
We also restrict context updates as much as possible (there won't be
any discount when the pricelist is configured to hide the discount from the customer)
closesodoo/odoo#123848
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
When a SO has several downpayment, they all have the exact same
description "Down payment" which does not provide much information.
This commit adds the invoice reference and the date.
task-3299805
Part-of: odoo/odoo#120972
An error occurs because to convert the amount in sale order line company is
required.
when user remove the company and tries to add a new product in sale order line
error occur.
applying these changes will resolve this issue.
sentry-4090085761
closesodoo/odoo#125575
X-original-commit: c04bc8026eae79c01fb9315d8063b12d3a1e2fa8
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Smit Nagar (smna) <smna@odoo.com>
*: account, crm, crm_iap_mine, event, hr_expense, hr_holidays,
hr_recruitment, lunch, mail, mass_mailing, point_of_sale, project,
purchase, purchase_stock, sale, survey, web, website, website_blog,
website_event, website_forum, website_sale, website_slides,
test_main_flows
In odoo/odoo#111103 the tour system was rewritten. The previous tour
system used to depend on the `root.widget` js module, and this module
was an async module that indirectly depended on `session_bind` which
would load the translations, meaning that the js module definition code
of the tours would only run after the translations were loaded. This is
no longer the case with the new tour system, this means that the module
definition code is executed as soon as the dependencies of that module
are fulfilled, which is generally befoe the translations are loaded,
causing most tour tips to not be translated.
This commit adds a hacky workaround for this problem: it creates a new
module that has a default export which is a promise, and has a legacy
alias, this creates an async module that waits for the translations to
be loaded. This module is then imported for its side-effect in all
onboarding tours, causing them to be translated correctly once again.
This commit also needs to convert the steps key in the tours internal
registry to a getter. In previous versions, the steps were directly
added as is to the internal state of the tour service, but since
odoo/odoo#122834 the steps are now mapped, and without a getter, any
edits to the steps occurring after registration will not be taken into
account. This causes issues in some modules that change original
behaviour of other modules (eg accounting makes invoices into a menu in
the accounting app instead of a top-level app in the home menu) as they
need to edit the steps of existing tours to make them work.
In a separate PR, we will implement a more proper fix by changing the
API of the tour manager so that we no longer need this workaround.
closesodoo/odoo#125284
X-original-commit: d130699ba82dc9919c9116f4b64a5e461ebb6319
Related: odoo/enterprise#42655
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
Since d88409e8e5ce77ff3ec3b24fcdc108d8df380994, taxes from different companies
are forbidden on sale.order.line records (which is the expected behavior).
Nonetheless, this highlighted some flows where the taxes were not properly
set/recomputed, especially re-invoicing, which is fixed by the current commit.
Fixes#123675closesodoo/odoo#125434
X-original-commit: 6ce4019968bd0a1a11475910d35aa2ccfc2c6a9a
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Issue:
------
When a cart is created via ecommerce, an email is sent to the salesperson
(defined in Settings/Website/Assignment).
This email contains a subtitle with the amount of the sale order.
This price is always 0.00.
Cause:
------
The email is sent during the creation of the sale order
and not after it has been updated with the product information.
Solution:
---------
Use a key in the context to prevent sending the price of a sale order.
Remark:
The email sent in this case is an assignment email only.
Mentioning the price in this case would not be relevant
if the customer subsequently updates their cart.
opw-3329722
closesodoo/odoo#125378
X-original-commit: ea883e75343e50a1603b37c5f82f8e620418c883
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
Co-authored-by: Feyensv <vfe@odoo.com>
It's currently not possible to know which `pos.order` is linked to a
`sale.report`
Solution:
Add a field `order_reference` on model `sale.report`. This field refers
to either a "sale.order" or a "pos.order" record.
The field `order_reference` is used to count the number of distinct
orders. We cannot simply use count_distinct on the `order_id` because
there can be multiple sale.report with the same `order_id` but related
to different models (sale or POS order).
Part-of: odoo/odoo#116830
When user change the move_type of account_move to 'entry'. And when user try to
access 'partner_credit' field from the form view using debug mode.
The error will be generated.
Steps to Produce:-
1. Install 'account_accountant' and 'sales' module
2. Change move_type of account_move to 'entry'
3. Go to 'Edit View : Form' of Journal Entries in account_accountant using
debug mode
4. Add field 'partner_credit' to the form or tree view and click on save
5. Click on any Journal Entry
Trace-back will be generated.
Applying these changes will resolve this issue.
Sentry-4222621594
closesodoo/odoo#124515
X-original-commit: 94c1f20aaeb89cc07bb21cab2e19da67fd10f603
Signed-off-by: John Laterre (jol) <jol@odoo.com>
Signed-off-by: Preksha Chouhan (prec) <prec@odoo.com>
Emails on Sale Order, Invoice, Recovery cart. When no sales on sale.order
use "COMPANY" <email of company> as fallback before the current user.
Reason is that odoobot is often used in automatized actions and having
it as email_from is not really user friendly.
Also add company fallback in auth modules email templates (if not already
using it) for the same reason.
Task-3346388
closesodoo/odoo#124472
X-original-commit: 597fc004148bf39e8f56e36e840aa6788872f237
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
So that we can in the future harmonize more easily the discount
computation between sale, point_of_sale, e-commerce, ...
closesodoo/odoo#123849
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
- Flatten the group list in sale's SO for cleaner UI.
- Modify wording to reflect changes in enterprise PR.
related to odoo/enterprise#36968closesodoo/odoo#112433
Task-id: 2877341
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Following 78ae3da902 names were added to improve the view inheritance.
But some names were duplicates. This commit will ensure every name is unique to facilitate
inheritance.
closesodoo/odoo#122270
Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
The value of custom ptavs is store on the sale order line.
Currently, they are ordered by ptav id but they are ordered by the ptav
sequence everywhere in Odoo.
Now, on the sale order line, custom ptav are ordered by ptav sequence.
opw-3234669
closesodoo/odoo#122206
X-original-commit: fa25206634e11ce1fd9030508772a1802ef86fa2
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Valentin Chevalier <vcr@odoo.com>
Having 2 groups one after the other like this caused the labels to have
different sizes.
closesodoo/odoo#122089
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
the color of the lines for quotation(sent) is too noisy and not informative as there is a colored status badge.
Remove the decoration to clear the view and decorate total amount where invoice_status = 'to invoice'.
task-3290317
closesodoo/odoo#119986
Related: odoo/enterprise#40594
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Currently, only stable releases see their translations updated. This has
resulted in master accumulating outdated stuff for years, which can be
confusing for users testing master on runbot.
This one-shot commit resynchronizes master translations based on the
content from 16.0 and removes empty PO files (i.e. no longer containing
translations).
closesodoo/odoo#121629
Related: odoo/enterprise#41171
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Prior to this commit, the SVG's viewBox attribute was missing, which
prevented svgs from being scaled.
This commit fixes this issue.
task-3326633
Part of task-3326263
X-original-commit: 30300c373ad1c63a6cf8b035cae0785a09c6933f
Part-of: odoo/odoo#121886
The introduction of Milk has brought new app icons.
Using the svg format creates a lack of anti-aliasing on the edges of the
shapes, which makes the icons look bad.
Since the png size has been reduced, we can afford to use the png format
to have the best possible quality without having a lack of performance.
task-3326633
Part of task-3326263
X-original-commit: e07cb722f2b11407a3ad093bd688b7d37afd5a88
Part-of: odoo/odoo#121886
Before this revision, when you pass `context` in the arguments
of a JSON routes, this one gets automatically injected
in the environment context.
This is not the case for regular HTTP routes.
It makes sense to propagate the context for the JSONRPC protocol,
JSON routes used by the backend, such as `call_kw`,
but it doesn't make sense to pass this context automatically
for any other kind of routes, such as front-end routes
or routes used by custom Javascript widgets.
This change brings a more unified behavior for routes
of types HTTP and JSON.
In addition, most developers were not aware of this "feautre",
that passing `context` in the arguments of a JSON route leaded
to the injection of this context in the environment context.
This is actually reflected by the diff size this changes required,
only a dozens of routes needed to be adapted, to manually
add the context in their route arguments and to inject it
in their environment context.
closesodoo/odoo#121726
X-original-commit: a7a5655631e6d5b05fd2ba3d0c80617aae6d9cfe
Related: odoo/enterprise#41229
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
Description of the issue/feature this PR addresses:
simplification of the credit note wizard
Current behavior before commit:
First users select reverse option (3 radio buttons):
1) refund
2) cancel
3) modify
The reverse action is triggered when the users clicks on the "reverse" button
After commit:
radio button are removed. There is now two buttons that trigger directly the reverse action with the desired option (refund or modify, cancel is not available anymore)
Also, for refund, posting the draft reverse move will also reconcile with reversed move.
task id: 3244377
closesodoo/odoo#117961
Related: odoo/enterprise#40919
Related: odoo/upgrade#4667
Signed-off-by: John Laterre (jol) <jol@odoo.com>