Commit Graph
230 Commits
Author SHA1 Message Date
Nasreddin Boulif (bon) c40aadb42b [FIX] sale,website_sale: Display extra prices with taxes included
Steps to reproduce the issue:

  - Install eCommerce module
  - Go to Settings
  - Ensure `Product Prices` is set to 'Tax included'
  - Create a new Product as storable
  - Set `Sales Price` to $1.0 and `Customer Taxes` to 10.00 %
  - Under `Variants` tab add an Attribute with 2 values
  - Set "Price Extra" to $2.0 to one of the variants
  - Go to the Shop and select the product

Issue:

  The extra price badge does not include the taxes
  ($2.0 instead of $2.2), however the final price does.

Cause:

  The price_extra field from ptav (used in the badge) does not include
  the taxes.
  However, when calculating the final price, we do first the sum of all
  prices (including the extra prices) and then apply the taxes.

Solution:

  In the template, for each 'variants', we call `_get_combination_info`
  to get the variant.price_extra with taxes included/excluded
  depending the `Product Prices` setting.

opw-2669871

closes odoo/odoo#81949

X-original-commit: 6f04935d14d595faa3bb8dd6ba9e0dcf1d694886
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
2022-01-12 10:17:43 +00:00
Laurent Stukkens (LTU) 04f8b7dfa9 [FIX] sales: set invoice company to so one in sale.advance.payment.inv
Prior to this commit, the company of the invoices generated through the use
of the `sale.advance.payment.inv` wizzard were not forced to the one of the
related sales orders. From the compute method on account.move the company would
then be either the one of the journal or the current company.

It seems that context_keys were used 'at least in industry_fsm_sale' in order
to ensure that the company was correctly set (although the one of the task
was used instead of the one of the SO).

This commit ensures that invoices created through the wizzard now takes the company
of the SO they are generated from.

Finaly this commit adds a multicompany test in the sale module in order to ensure
that the `sale.advance.payment.inv` wizzard is not impacted by the multicompany.

task-2608812
Closes: #79926
2022-01-03 18:11:00 +00:00
Victor Feyens 0acd96c340 [IMP] sale: Use a 'cached' pricelist rule mechanism
Cache the pricelist rule used for price computation in a dedicated non
stored field, since it is used both for the price_unit and the discount
computation.

This divides by 2 the number of pricelist requests/queries when
discounts computation is enabled.
2021-12-23 15:30:23 +01:00
Victor Feyens bb1cf7d7ce [IMP] sale: delegate update_prices logic to the computes
Remove duplicated price & discount computation and trigger
the necessary computes.
2021-12-23 15:30:23 +01:00
Yolann Sabaux fcd6610bcc [FIX] sale: fix rounded discount
Steps to reproduce:
- Install and launch sales
- In settings: activate price lists and discount; price list based on advanced rules
- Create a new price list; based on percentage (54%)*; applicable on all products; show discount
- Make sure the Public Price List has show discount activated
- Create a new quotation
- Select the Test pricelist
- Select a product (price 0.03 eur/$/other)*
- Change the price list to Public price list
- update the prices
- change the price list to Test price list
- update the prices
-> The Discount shown is not the one defined in the price list (66.67%)*
*(values for my example)

Solution:
Use the real price and not the a posteriori-rounded price for the computation of the discount  in the `update_prices` method.

opw-2677884

closes odoo/odoo#81395

X-original-commit: 986dbc20952caae9d5a1b4b7ee34cfb994dea077
Signed-off-by: yosa-odoo <yosa@odoo.com>
2021-12-16 09:51:50 +00:00
Yannick TivisseandVictor Feyens 18952cdc76 [IMP] *: Convert single create method into multi
Taskid: 2703085
Part-of: odoo/odoo#80824
Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-12-14 19:13:18 +00:00
Victor Feyens f36334d97a [IMP] sale: onchange tests can now be triggered post_install 2021-12-02 12:12:04 +01:00
Victor Feyens 69dc4bba42 [IMP] core,sale: enforce batch creation support for sale order (lines) 2021-12-02 12:12:04 +01:00
Yannick Tivisse 5863070066 [IMP] sale: Remove useless SO line values on creation
Purpose
=======

Those are now the default values that are computed from the field
definition.
2021-12-02 12:12:03 +01:00
Yannick Tivisse 3c07a3fecd [IMP] sale: Apply misc styling improvements + remove dead context keys 2021-12-02 12:12:03 +01:00
Victor Feyens 47f6416d8c [IMP] sale: test improvements
* Verify the pre-compute logic, from the SO side (recurisvely) and from 
the SOL side.
2021-12-02 12:12:03 +01:00
Victor Feyens 52a0f2cc6a [IMP] sale: keep only onchange tests in test_onchange file 2021-12-02 12:12:03 +01:00
Victor Feyens 1d3b9f6be6 [IMP] sale: minor perf improvement & cleanup 2021-12-02 12:12:02 +01:00
Yannick Tivisse fecff7119f [IMP] sale: Don't recompute taxes on tax configuration change
This should be done manually
2021-12-02 12:12:02 +01:00
Yannick Tivisse 01557bf36e [FIX] sale: Split _compute_order_info_from_partner into several methods 2021-12-02 12:12:02 +01:00
Yannick Tivisse 1003ef0e70 [IMP] sale: Convert _onchange_discount into compute method 2021-12-02 12:12:02 +01:00
Yannick Tivisse 916e92aa30 [FIX] sale: Split product_id_change into several compute methods 2021-12-02 12:12:02 +01:00
Yannick Tivisse 836f463c97 [IMP] sale: Convert product_uom_change into compute method 2021-12-02 12:12:02 +01:00
Yannick Tivisse d626f348fe [FIX] sale: Fix bad float comparison in tests 2021-12-02 12:12:02 +01:00
Yannick Tivisse f9f68adb2c [IMP] sale: Convert onchange_user_id into a compute method 2021-12-02 12:12:01 +01:00
Yannick Tivisse c10db4492e [IMP] sale: Convert _compute_tax_id into real compute method 2021-12-02 12:12:01 +01:00
Yannick Tivisse 2806c5fd9f [IMP] sale: Convert onchange_partner_id into compute method 2021-12-02 12:12:01 +01:00
Pierrot (prro) 709f43f153 [FIX] sale: update downpayment SOL after refund
How to reproduce the problem:
- Install the Sales and Invoicing apps
- Create a simple SO with a product
- Create Invoice -> Down Payment (percentage) 30% -> confirm
- On the SO -> Create Invoice -> with Deduct down Payment -> confirm
- On that invoice -> Add Credit Note -> Reverse -> confirm
On the SO, the Down payment is not counted as invoiced, even tough it
was already paid and not refunded. If the user wants to create a new
invoice, the system will create one with the full price (not taking the
already invoiced Down Payment into account).

Cause of the problem : when computing the quantity to invoice for
the SO, a condition was avoiding preventing the down payment invoice
line to be taken into account in a way that it was just ignored.
I don't really understand the reason for this condition, as
it specifically ignores the down payments, while it should not be
ignored.
When creating the draft for the refund invoice, the down payment's SOL
is correctly updated as `line.untaxed_amount_to_invoice == 0` is true.
But when confirming the invoice, the values changed and the condition
is thus not met anymore.

opw-2491225

closes odoo/odoo#79572

X-original-commit: 99e8d4ad33bcdb27f7632a9ba5a5a2886d074ed5
Signed-off-by: Roose Pierre-Rodéric ( prro) <prro@odoo.com>
2021-11-09 16:25:18 +00:00
jbw 5ab17ff395 [FIX] account,purchase,sale: fix typo and test for accrued orders
- Fix typo in accrued_orders.py
- Remove fields.Date.today() from purchase test
- Make more use of common resources

closes odoo/odoo#79159

X-original-commit: 31570e185dcb36145e28e42cda765284dc373294
Signed-off-by: Laurent Smet <las@openerp.com>
2021-10-29 08:43:31 +00:00
William Henrotin f3fe2d50d9 [REF] *: rename name into partner_id on supplierinfo
Task: 2673000
Part-of: odoo/odoo#78732
2021-10-27 15:48:51 +00:00
Goffin Simon 33cd7305c0 [FIX] sale: Invoicing target on sales team
The invoicing target on sales team do not have to take the vendor bills into account.
When we click on Sales analysis, we only see sales details.

opw:2557852

closes odoo/odoo#77144

X-original-commit: 26871eabe3f95945c6cf2fc084e3af469ed561f6
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-09-27 13:43:56 +00:00
Goffin Simon d5c64d1353 [FIX] sale: Partial payment link with invoice policy based on deliverd qty
- Configure payment stripe to be available on the web shop
- Let's consider a product with P (sales price = 100€) invoice policy based on delivered qty
- Set in the config parameter sale.automatic_invoice to True
- Create a SO with P and generate a payment link PL for 50€
- Go to PL and pay it

Bug:

An error was raised because there was no invoicable line when computing the
invoice of SO

opw:2635175

closes odoo/odoo#76735

X-original-commit: 846bc047fcd546bf5b8e7fe224b8a98e876eba21
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-09-18 12:52:04 +00:00
qdp-odoo 97026f803d [IMP] account: accrued SO/PO tracability imp
* order lines are now not grouped anymore by account. That allows a more detailed label on the accrual entry line, as it's now directly related to a single order line
* we now create a single accrual entry counterpart, instead of one per order previously. That reduces the 'noise' in the accrual entry, at the cost of not having the sum per ordre anymore easilly but it doesn't seem to be important to audit that account

closes odoo/odoo#76037

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-09-09 13:17:28 +00:00
qdp-odoo 2dcbe92d78 [IMP] sale_stock, sale_timesheet, purchase_stock: accrual wizard now propose an amount taking care of the accrual date
This allows to solve the following use case:
* we are in March
* a SO created during January shows currently a delivered quantity (timesheet on service or delivered goods on storable products): timesheets/pickings were done in February
* creating the accrued entry for January 31 should display accordingly an amount of 0 by default since everything was done in February
Invoices invoice_dates are also taken into account:
* day 0 : delivered 10
* day 2 : 5 invoiced
* accrued entries for 10 if accrual date = day 1, accrued entries for 5 if accrual date = day 3,

followup of task 2255642

closes odoo/odoo#75886

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-09-02 15:36:50 +00:00
oco-odoo d9a3b938fe [IMP] account, sale, purchase, l10n_latam, l10n_ar: add the possibility to use subtotals above tax groups when displaying them
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.

closes odoo/odoo#74138

Task: 2457374
Related: odoo/enterprise#19802
Related: odoo/upgrade#2670
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-09-02 14:15:13 +00:00
jbw 064edb2223 [IMP] account, sale, purchase: accrued entries from purchase & sales orders.
Accrued liabilities, or accrued expenses, occur when you incur an expense that you haven’t been billed for (aka a debt).
For example, you receive a good now and pay for it later (e.g., when you receive the invoice). The same opposite approach for sales.

Why do accountants need such entries ?
- Accounting must give a fair view of the financial situation of a company. The loss/profit must be booked regarding the effective deliveries of goods/services, not on the paperwork only.
- On a fiscal point of view, if you want to be allowed to deduct a loss from your taxable basis, it has to be in the right period. If you didn't announce it on time, the loss might be rejected by fiscal authorities. Same goes for the augmentation of the taxable basis, it has to reflect real deliveries and not only paperwork.

was Task: 2555642
was PR #73707

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-08-26 11:34:14 +00:00
Victor Feyens d8369685f8 [FIX] sale: translate customer warning title
* Also clean the onchange content and rename it accordingly to guidelines.
2021-06-21 16:24:51 +00:00
Adrien Widart 1628ec5a77 [FIX] sale: round untaxed amount to invoice after computations
Suppose such a SO line:
- Unit Price: 541.26
- Qty: 38
- Discount: 2%

The line amount is computed thanks to application of the discount on the
price, then the multiplication of the result with the quantity. The
rounding eventually happens after these steps:
https://github.com/odoo/odoo/blob/254b2a0840d3e817cc6062c483b5213c10088af5/addons/sale/models/sale.py#L1013-L1024
https://github.com/odoo/odoo/blob/b76e9ef658bde0178fa1660b6ad27b880e91632a/addons/account/models/account.py#L1138
Therefore, in the above case, we have:
```
Total = round(541.26 * 0.98 * 38)
      = round(530.4348 * 38)
      = round(20156.5224)
      = 20156.5224
```

However, when confirming the SO and setting the delivered quantity, the
Untaxed Amount To Invoice is computed using the unit price with both the
discount and the rounding already applied:
```
Total = round(541.26 * 0.98) * 38
      = round(530.4348) * 38
      = 530.43 * 38
      = 20156.34
```
As a result, the amount is not the same than the first one, this is
incorrect.

OPW-2525975

closes odoo/odoo#74709

X-original-commit: 014a40448ca7854646d929ab369f92c6dede1eb4
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-08-04 13:31:09 +00:00
Andrea Grazioso (agr-odoo) b54c199c88 [FIX] sale: fix section creation for the down payments
After FW-port https://github.com/odoo/odoo/pull/64721
Section for down payment were added multiple times because of a typo

closes odoo/odoo#74025

X-original-commit: 7bbf13d47b122d80fd16cb9db79be86c44be97b6
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2021-07-20 10:49:20 +00:00
jbw 6adaec714a [IMP] account: Reversal on same journal type as original AccountMove
For data quality purposes and bug prevention, when I reverse an entry,
the reversal should always be postable on a journal having the same type
as the initial Journal Entry's journal.

closes odoo/odoo#72431

Task: 2497529
Related: odoo/enterprise#19543
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-07-13 10:00:38 +00:00
Jeremy Kersten 478068c829 [IMP] *: always use Odoo Response
This branch adds request.redirect on all requests.
In case of a front end request, we do an url_for to the location.

We removed redirect_with_hash that was only for retro compatibility

local_redirect has been renamed to redirect_query, and param keep_hash has been
removed and moved.

Default code for redirect is 303 now instead of 302.

Now redirect and redirect_query make local redirect by default, you need to
pass local=False to make external redirect.

All werkeug.utils.redirect has been replaced by request.redirect.

Http.redirect now use an http.Response type, and it become easy to add an
override like 'set_cookies' e.g.

Dispatch of a website.page return an http.response too, so we first need to
check if it is a cached version before to check if it is an Odoo Response.

Migrate your code:

http.redirect -> request.redirect(location, code, local)
http.local_redirect -> request.redirect_query(location, query, code, local)
http.redirect_with_hash -> request.redirect

Courtesy of odony for help and review ;)

closes odoo/odoo#72599

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-07-08 07:00:06 +00:00
dht-odoo bea5790713 [IMP] sale, product: improves field type from text to html
It replace text fields to html fields as we have our own 'OdooEditor'.
Indeed, it gives more options to users in the way they format their
content without weighting too much on the UI
(tools appear on demand and not by default).

Models -> Fields

1) sale.order -> note
2) sale.order.template -> note

Task Id: 2499504

X-original-commit: 6a345c2695129a5cd907e5e23e057871ebf9ebfa
2021-06-07 05:21:40 +00:00
Ivan Yelizariev 4774c58dbe [FIX] sale: fix search "invoices is not set" for sale.order
Previous attempt #70343 of fixing was incorrect. Check code comments for
details.

---

opw-2516124

closes odoo/odoo#71547

X-original-commit: 9b64e523dfdbc82099c1de5b47ed13d6d6f75fe5
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
2021-06-01 12:29:25 +00:00
Victor Feyens 060df1a363 [IMP] sale: improve test coverage
Some flows of the core `sale` code (sale_order & sale_order_line) 
weren't covered at all by tests.

This commit adds some tests to cover those flows, reducing the risks of 
broken features/flows with future sale tasks.

closes odoo/odoo#71402

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-05-28 12:05:48 +00:00
wan 095818d477 [FIX] sale: use correct currency in tests
The main company can have something else than EUR or USD, especialy when
testing localizations.

closes odoo/odoo#71171

X-original-commit: 91a3dca13c1de637b25810ed7f509dce6e66c908
Signed-off-by: Josse Colpaert <jco@openerp.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-05-21 15:55:00 +00:00
Victor Feyens fbc3102b56 [FIX] sale: update test according to the file moves 2021-05-20 14:27:31 +00:00
Laurent Smet 0c857ef7ac [REVERT] sale: Fix fiscal pos. mapping taxes to price included
This reverts commit d89562e8fe473692296cb209651beb2ce7a715e4.

Since this commit, the taxes mapped by fiscal position wasn't managed by the _fix_tax_included_price_company method anymore.
Otherwise, some customizations exist on this method that are no longer called.
The 2527940 issue is also due to a remaining bug: the total_excluded price should be divided by the quantity but:
- what if the quantity & price_unit are both signed?
- what if the number of digits for price_unit and the currency are different? Should we skip the rounding of taxes?
Since this commit is not perfect and has a lot of dependencies in others modules, we decided to revert it.

Original PR: https://github.com/odoo/odoo/pull/68997
Revert PR: https://github.com/odoo/odoo/pull/70858

closes odoo/odoo#70914

Issue: 2527940
X-original-commit: def7d7bb0231fef38e044803b245c9b990a90216
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-05-17 18:07:40 +00:00
Laurent Smet 8382f192a2 [FIX] sale: Fix fiscal pos. mapping taxes to price included
Using a fiscal position to map a tax to a price-included tax doesn't work.

closes odoo/odoo#70565

X-original-commit: a6fe2de9b9879d918f0315982b51fba345a2addd
Signed-off-by: Antoine Vandevenne (anv) <AntoineVDV@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-05-07 17:27:38 +00:00
yhu-odoo 688d655305 [IMP] {purchase, sale}_stock, product: packaging revamp
1. add packaging to PO lines
2. packaging on PO/SO lines can be propagate to MO
3. add package type to packaging
4. on picking types, we can choose to only reserve full packaging. That
means if you want 1 pallet(100 units) and you have 50 units in stock. It
won't be reserved.
5. suggest suitable packaging for PO/SO/MO line according to the product
qty

Task-2357259
PR #68654
UPG PR odoo/upgrade#2444
2021-05-06 13:36:28 +00:00
wan 002f89bd84 [FIX] account: never set default for invoice_date
For customer invoices:
* do not set default date because if you prepare an invoice (and it gets
  a default date), then validate it the next day, the date will be wrong
* set the date when posting if it wasn't set, because why not?

For vendor bills:
* do not set default date because you rarely encode a bill at the bill
  date. Forcing the user to enter it reduces risks of user error
  (duplicated vendor bill)
* do not set it when posting, same reason.

opw-2492862
Related #68368
Closes #68367

closes odoo/odoo#69639

X-original-commit: 41041d8016d11f017d92d28f32ab2cf42f1349a9
Related: odoo/enterprise#17866
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-22 08:16:08 +00:00
Anh Thao Pham (pta) fbc32db828 [FIX] sale: avoid re-invoicing invoiced SO lines
- Create a product:
  * Invoicing Policy: Delivered quantities
  * Re-invoice Expenses: At cost
- Create a SO with the created product in Order Lines
- Make sure the subtotal of the SO line is equal to 0, by setting an Unit Price to 0
  or by applying a 100% discount
- Confirm SO and create an invoice (Regular invoice)
- Post the invoice
A new line with the same product and the same delivered quantity is added to the SO.

It is not possible to invoice a SO line with a product having an expense policy and
a subtotal equal to 0, without having it reinvoiced to the SO.

This fix will prevent account move lines linked to a SO line from being reinvoiced.

opw-2479560

closes odoo/odoo#69623

X-original-commit: b41cf0077c9a6d1d74cc0c7987c0edcc58e368d1
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-04-21 15:11:17 +00:00
Antoine Vandevenne (anv)andVictor Feyens 573ed74c12 [REF] payment, *: refactor online payments API
This commit replaces the old online payments API of the `payment`
module with the new one and adapts to it all the implementing modules.

See the merge commit for more details.

task-2085989
task-2119838
task-2165982
task-2289255

Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-03-30 09:25:51 +02:00
Andrea Grazioso (agr-odoo) 894717fa2e [FIX] sale: fix order line amount update after downpayment invoice
Create a standard tax included in the product price.
Add that tax to a product and the down payment product.
Create a sales order (i.e. 1 line, 100$ total, 15% tax incl).
Create a percentage down payment invoice, i.e. 50%.
Post the downpayment invoice.
Go back to the sale order

The sale order line relative to the downpayment was asjusted to remove
the tax amout while this should not occur when dealing with tax included
in price

Added test

opw-2426294

closes odoo/odoo#65911

X-original-commit: 3b58b373e1c6c155f65b88c31cbb47794cb0a554
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2021-02-10 20:33:17 +00:00
Thibault Delavallée e1355dae7a [REF] sales_team: improve crm.team.member model and data
GLOBAL PURPOSE

Ability to have salesmen belonging to several sales team is a core requirement
of CRM. It is therefore moved from website_crm_score to crm along with cleaning
and behavior improvement. Automatic lead assignment is also moved and cleaned.

SPECIFICATIONS: MODEL CLEANING

In this commit we improve team member model to make it more usable and
aligned with current Odoo views and usability.

This commit contains notably
  * add some related fields on the user: phone, mobile, company, email;
  * rename "team_user_domain" to "assignment_domain";
  * rename "maximum_user_leads" to "assignment_max";
  * improve member views globally;

We also introduce dynamic domain computation for users and teams when seeing
team members. This allows to limit selection of users or teams depending
on already existing configuration. Purpose is to avoid having people trying
to create wrong configuration (duplicates, ...) and receiving error messages.

Also
  * clean some data and demo about teams and members;
  * fix some views glitches;
  * improve views: add some fields in search views, improve wording of
    fields or actions, ... globally improve usability and US as well as
    feedback given to users;
  * group sales team members by team by default as it help getting an
    overview of team members distribution;
  * update tests to create team members instead of writing directly on m2m
    towards users;

SPECIFICATIONS: SALE_TEAM_ID FIELD ON RES.USERS

In this commit we also rewrite sale_team_id field of res.users. Previously in
crm it was simply a many2one field linking to a crm.team. It was used to compute
team membership as a standard many2one / one2many relationship. In enterprise
module ``website_crm_score`` this field was set as a related on first user
teams. Indeed scoring changed relationship between users and teams to a
many2many.

This field is now directly a computed many2one field that links to the
"main" team of the user even in multi memberships mode. As memberships can
now be de-activated we changed this field to a computed stored field. It is
based on oldest active membership of user. That way default team of documents
will be the user's oldest team considered as its "main team".

SPECIFICATIONS: LEAD_ALL_ASSIGNED_MONTH_COUNT

Improve crm_team ``lead_all_assigned_month_count`` field computation. It is
now simply the sum of assigned leads of team members. Differences may
happen if a lead in teamA is assigned to an user working in teamB. This should
not happen if team / user is correctly set at lead level which is generally
the case. However if that happens, old field counted it. New field will not
count it as it is not directly linked to a team's member.

SPECIFICATIONS: DEMO DATA

Make crm.lead demo data coherent with user_id / team_id . As demo data should
be using a mono-membership behavior for users and teams, we have to ensure
user_id and team_id effectively matches. It allows to have coherent reporting
and assignment demo flows.

Also avoid having Odoobot responsible of leads. Instead of undefined user_id
and team_id leading to Odoobot being responsible of some leads, force it
to be False. Those demo data allow to test automatic assignment of lead

LINKS

Task ID-2086889 (main task)
Task ID-2357969 (scoring migration task)
Community PR odoo/odoo#48422
Enterprise PR odoo/enterprise#499
Upgrade PR odoo/upgrade#996
2021-01-21 10:56:37 +00:00
Thibault Delavallée a647b816b1 [FIX] sale: fix setupclass user creation
Due to accounting custom setupclass user in environment is not admin but a
custom user having only accountant rights. This is hidden in accounting
override that changes test user and mix data creation and ACLs tests.

Current tests in sale crash when a flush is involved during data creation
as test user (accounting) has no rights to create users.

In this commit we fix locally sale data creation as fixing accounting
test structure is out of scope compared to this task.

Spotted when working on task ID-2086889

closes odoo/odoo#62672

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-12-01 11:18:03 +00:00