Commit Graph
2291 Commits
Author SHA1 Message Date
Brieuc-brd 418413e499 [IMP] web, *: directional icons
This commit adapts the directional icons to improve the usability and
maintain consistency with the ui icons library.

task-2818586

Part-of: odoo/odoo#116641
2023-05-12 22:59:22 +02:00
Brieuc-brd 8a2875bb38 [IMP] delivery, sale_loyalty, project: adapt for milk
This commit adapts the spacing between the buttons in the
sale_order_views to fit with Milk.

project: layout fixes:
- Fixed kog displaying on top of the project status button
- Fixed the flickering in project updates when selecting rows in list
view

task-2818586

Part-of: odoo/odoo#116641
2023-05-12 22:59:21 +02:00
Elisabeth Dickinson b2ef35a431 [IMP] *: replace .bg-color by .text-bg-color on ribbons
Also remove unnecessary CSS on ribbons.

Part-of: odoo/odoo#116641
2023-05-12 22:59:16 +02:00
Horacio Tellezandchevalierv 216fa84fbe [ADD] sale: add a products catalog view on the sale order
Currently, Fields Sales are struggling to create quotations or sale
orders directly from the customer place. One of the issues is that it
is not easy to quickly add products to the SO. Products must be added
one by one and, in mobile, it requires completing a form with
quantities, ... for each new line.  

This commit introduces a catalog view that allows users to select
products in a faster and easier way than before, both in desktop and
mobile view.

Task - 3062080

closes odoo/odoo#106382

Related: odoo/enterprise#37915
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Co-authored-by: chevalierv <vcr@odoo.com>
2023-05-12 20:51:51 +02:00
prye-odoo c4dc4735c4 [FIX] delivery: prevent trace back while partner has no zip
In delivery address, `country name` and in shipping method, `country name`
will be same and no zip in delivery address.  While creating new sale order
along with product and clicking on "Add shipping",  error will be generated.

Steps to Reproduce
-Install `sale_management' and 'delivery' modules
-Go to the settings and enable the 'Customer Address'.
-Go to the settings and enable 'Shipping Methods' and configure it.
-Select a shipping method and  go to the 'Destination Availability' tab and
 set to the 'Countries' and set to 'Zip Prefixes'.
-Create a new customer and add the delivery address of the customer in
 res.partner.
-The delivery address and shipping method of the 'Countries" or 'Country'
 name should be the same.
-Set the  'Zip Prefixes'
-Set the delivery address of zip code null.
-Create a new quotation and add to the customer and delivery address
-Add to the product in the sale order line.
-Click on the 'Add Shipping' or 'Update Shipping Cost' button.

A trace back will be generated.

Applying this commit will resolve this issue.

sentry-4147077852

closes odoo/odoo#120968

X-original-commit: 60d5c7d5668da542e251d7d6fb8774043cfddea8
Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-05-10 20:15:38 +02:00
althaf shaik 77f7cc2eb1 [FIX] delivery: price rule name not formatted if no delivery product
This trace back raises when we try to create delivery price rule,
while delivery product is not selected in the delivery carrier.

Steps to produce:
 * Install delivery,sales modules
 * Open Sales/Configuration/Shipping Methods
 * Create a new shipping method keep provider as 'Based on Rules'
 * Try to add a line for pricing
 * At this moment trace back raises ('Expected singleton: res.currency')

We resolve this issue by not formatting the name if the currency does
not exist yet, as the currency is related to the one of the product.

Sentry :- 4067992652

closes odoo/odoo#119958

X-original-commit: d20431758c0c4943394a63250ad0a83894b795c8
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-04-27 18:25:23 +02:00
Victor Feyens f4ea6d3226 [FIX] *: strict api for main orm methods
Enforce strict types for returned values for
* create
* write
* unlink
* default_get

to make those methods more consistent and reliable.
Also make sure they can be called with empty self/values,
i.e. that they follow the same behavior as the base methods
defined in the main orm Model.

closes odoo/odoo#116809

Related: odoo/enterprise#38880
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-04-25 15:20:43 +02:00
kir-odoo 71a2c5a551 [FIX] delivery: exclude neg qtys from shipping weight
This commit prevents inclusion of negative qty SO products from
the calculation of its estimated shipping weight. Negative qtys can
indicate a return, which would be a separate picking from the delivery
 => we shouldn't subtract their weight from the delivery. This
subtraction, may have resulted in shipping rates being calculated as
lower than they should have been within the SO.

Additionally fixes the following use case (requires Fedex connector):
- create a SO with 2 products with the same weight
- set 1st product qty = 1
- set 2nd product qty = -1
- add shipping => Shipping Method = Fedex US
- click on "Get Rate"

An error will occur because the SO._get_estimated_weight() = 0, and
you cannot have a rate for weight = 0

TaskId - 3028023

closes odoo/odoo#118348

X-original-commit: ecf0262e3ef746c33a29c4f2de7868e3ab61cce2
Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-04-13 05:07:36 +02:00
Martin Trigaux 1be5eae8ef [I18N] *: remove nl_BE files
They dates from < 2027 and are quite outdated. Favour the nl
translation instead.
n_BE is not on Transifex so it was not possible to correct bad
translations.

closes odoo/odoo#115845

X-original-commit: d04c8b7e484db8306d858c891a7a2b11885fdcd9
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-03-20 16:51:30 +01:00
Victor Feyens 6023c02380 [CLN] delivery: split delivery_view.xml (2)
Part-of: odoo/odoo#115811
2023-03-20 15:31:46 +01:00
Victor Feyens e9b6dae8e6 [CLN] delivery: split delivery_view.xml (1)
Part-of: odoo/odoo#115811
2023-03-20 15:31:46 +01:00
Victor Feyens f203b1e730 [CLN] delivery: clean files organization
Part-of: odoo/odoo#115811
2023-03-20 15:31:46 +01:00
Victor Feyens a80f32bbe5 [FIX] delivery: translate warning title
Part-of: odoo/odoo#115811
2023-03-20 15:31:46 +01:00
Valentin Vallaeys (vava) d3cddbe89a [FIX] delivery, website_sale: fix UX issues in views
In ecommerce, the form vue of shipping methods should be improved to
easily set up fixed delivery costs. This commit improves the
user-experience and solves bugs on the fields displayed.

task-3203210

Part-of: odoo/odoo#110686
2023-03-14 12:23:45 +01:00
Valentin Vallaeys (vava) a54c304487 [REF] (stock_)delivery: split delivery from stock
Extract the Inventory logic from the `delivery` module into a new
`stock_delivery` module. This will allow to integrate the basic delivery
features into the website_sale app in a one-app free database.

task-3074497

Part-of: odoo/odoo#110686
2023-03-14 12:23:44 +01:00
Victor Feyens 24ccf7d9b0 [CLN] *: useless type info for actions
The type fields of actions already defaults to
the model name in the base model definition.

Therefore, specifying `ir.actions.server`, `ir.actions.act_window`
& so on as type is useless (and adds noise since it's the same as
the action model).

closes odoo/odoo#114539

Related: odoo/enterprise#37855
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-03-08 17:33:37 +01:00
Martin Maes 2b907e9f95 [IMP] deliver: add fixed margin
Removed the margin on rate when the provider is Fixed Price

Removed the margin on rate, free, amount when the provider is Based on Rules

Added a fixed margin for all the other providers

task-3043063

closes odoo/odoo#108794

Signed-off-by: Steve Van Essche <svs@odoo.com>
2023-03-06 18:52:41 +01:00
Arnold Moyaux 52413adae6 [FIX] delivery,stock: missing hs code in delivery slip pre done
The delivery should provide the same feature before and after
validation of the picking (however lot/package need a validation)

So the HS code should be available direclty since it's a static value

closes odoo/odoo#113390

X-original-commit: 350015088d3822cde84b5dcf83d053350beafa66
Signed-off-by: Steve Van Essche <svs@odoo.com>
2023-02-22 20:25:43 +01:00
LSE ef3bbc9293 [FIX] delivery: add commodities for packages from order
Before this commit:
1. Set up an EasyPost shipment setup, using
"Canada Post" as the Carrier Type and
"XpresspostUSA" as the Default Service Level.
2. Create a SO with a US customer (like Deco Addict)
3. "Add Shipping" using the button and choose the one created in 1.
4. When you try to "Get Rate" using the EasyPost shipment,
the API does always return the same error:
```
Easypost returned an error:
Unable to proceed, 'customs_info' is required for
international shipments, shipments bound for US
military bases, or US territories. Please see
https://www.easypost.com/docs/api#customs for more information.
```

After this commit:
As no commodities were set, `_customs_info` will return
an empty dictionary.
To solve that, we set the `DeliveryPackage` commodity
value on its initialisation to compute the customs
information the way it should.

opw-3104305

closes odoo/odoo#112988

X-original-commit: 06beca4373743787ae629b2c7ea623bf0583727a
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-02-21 15:53:11 +01:00
Touati Djamel (otd) f8cac8d384 [FIX] delivery: wrong delivery price for real cost in so
Steps to reproduce the bug:
- Install FedEx delivery
- Go to the shipping method > FedEx:
    - Select Real cost and margin on rate 10%
- Create a storable Product “P1” and update its qty
- Create a SO:
    - Add the product “P1”
    - Click on add shipping
    - Select FedEx and get the rate
    - Imagine the price is $10 and with margin it's $11

- Confirm the SO and process the delivery

Probelm:
The shipping price will be $12 instead of $11 in the SO

Because the estimated price is calculated the first time with margin
and added in the picking when sending to the shipper:
https://github.com/odoo/odoo/blob/afed7db30042e2ea91cdae292dadb7b6f742e33d/addons/delivery/models/stock_picking.py#L226

Then, the delivery cost is added to the SO, but the margin is applied a
second time:

https://github.com/odoo/odoo/blob/afed7db30042e2ea91cdae292dadb7b6f742e33d/addons/delivery/models/stock_picking.py#L246

https://github.com/odoo/odoo/blob/afed7db30042e2ea91cdae292dadb7b6f742e33d/addons/delivery/models/stock_picking.py#L262

so this commit is useless:
https://github.com/odoo/odoo/commit/632767d83e0f42acc5b486bde02dd1d9c2533911
because the `_add_delivery_cost_to_so` function is called only when
sending to the shipper

opw-3184482

closes odoo/odoo#113064

X-original-commit: b8c4fcbc1cba369dce8296b800565dfd181957a4
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2023-02-20 10:29:57 +01:00
Eteil Djoumatchoua (etdj) 67677a91a3 [FIX] delivery: add test for delivery w/carrier when no linked sale order flow
This commit adds a test to a fix done in https://github.com/odoo/odoo/commit/afed7db30042e2ea91cdae292dadb7b6f742e33d

bug introduced during: odoo/odoo#109298
opw-3162826

closes odoo/odoo#112451

X-original-commit: 7bbae5f8673c3ea8dfb428a1a7c1eb808f9139fc
Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-02-13 09:17:19 +01:00
Stefan-Calin Crainiciuc (stcc) 383efd3d22 [I18N] delivery_grid: improved translation
Steps to reproduce:
- Install eCommerce, delivery
- Shpping methods > Create > Name = TEST, Product = Acoustic Bloc Screen,
Provider = Based on rules, Add a line > Condition = "Weight <= 0",
Delivery Cost = "50 + 0 * Weight" > Publish shipping method
- Go to the website > Add acoustic Bloc Screen to cart > Proceed to checkout

In the delivery section, the TEST shipping method will display the
warning message `No price rule matching this order; delivery cost
cannot be computed.` This message can be confusing to the customer.

opw-3110715

closes odoo/odoo#112002

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-02-08 14:30:50 +01:00
Pierre Masereel 44994bf419 [FIX] delivery: view references a field not in the parent
In the view 'view_order_form_with_carrier' we have an xpath to
'picking_policy' which is not in the parent view 'sale.view_order_form'.

The field 'picking policy' is set on the sale order view in the override
of sale_stock in view 'sale_stock.view_order_form_inherit_sale_stock'

So we've adapted the inherit_id to match the correct view.

closes odoo/odoo#111897

X-original-commit: 1e805aa773926f4ad8c9705cffdc433f5ca23621
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Masereel Pierre <pim@odoo.com>
2023-02-03 21:49:41 +01:00
Valentin Vallaeys (vava) a7c0172727 [CLN] delivery: remove unused variables in tests
Part-of: odoo/odoo#111748
2023-02-03 11:45:43 +01:00
Valentin Vallaeys (vava) 45c210bb85 [FIX] delivery: add missing xml headers
Part-of: odoo/odoo#111748
2023-02-03 11:45:43 +01:00
Valentin Vallaeys (vava) f7c033eff7 [MOV] delivery: rename and split files by model names
Part-of: odoo/odoo#111748
2023-02-03 11:45:42 +01:00
Valentin Vallaeys (vava) ce35703ca3 [CLN] delivery: super(class, self) is not needed
Part-of: odoo/odoo#111748
2023-02-03 11:45:42 +01:00
Valentin Vallaeys (vava) 29060f3e06 [CLN] delivery: alphabetical order and guidelines for imports
Part-of: odoo/odoo#111748
2023-02-03 11:45:42 +01:00
Valentin Vallaeys (vava) c4d232668c [FIX] delivery: add missing odoo license header
Part-of: odoo/odoo#111748
2023-02-03 11:45:41 +01:00
Valentin Vallaeys (vava) fcfcc1b190 [CLN] delivery: remove utf-8 header in python scripts
Part-of: odoo/odoo#111748
2023-02-03 11:45:41 +01:00
Wolfgang Taferner ed8b0cb1dc [FIX] delivery: update_prices does ignore shipping rate
As sale does not know about special lines it will always update
the price based on product and price list instead of applying the correct
shipping rate, so we do skip those lines by using a newly introduced hook method

closes odoo/odoo#110782

X-original-commit: f1265b7fdce6bbe3fea97fc4b275dc2dca18103d
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-01-24 10:20:38 +01:00
Martin Trigaux 776689b0f4 [I18N] *: export saas-16.1 source terms
closes odoo/odoo#110752

X-original-commit: 56b2b52287a8f2192d80ea417c7efac80a87c0a9
Related: odoo/enterprise#36173
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-01-24 10:20:30 +01:00
Demesmaeker 83c52575d0 [REF] product,repair,(*_)sale(_*): unrequired pricelist
Removes the constraint of using a pricelist and makes all sales flows
rely on the currency of the sale order (or repair order)

task-2735672

closes odoo/odoo#84920

Related: odoo/enterprise#24716
Related: odoo/upgrade#3642
Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
2023-01-18 21:08:52 +01:00
PNO 9807aa9186 [FIX] delivery: speedup compute bulk weight
On the PR https://github.com/odoo/odoo/pull/107558 some performance improvements were made when computing the weights.
Unfortunately, this caused some slowdown on other cases.
This PR keeps the read_group introduced on https://github.com/odoo/odoo/pull/107558 but reduces the number of 'get' by taking all the information needed only once before entering the for loop.

For comparison, these are the differences on _compute_bulk_weight when going to Inventory/Receipts:

| Before PR 107558  | After PR 107558 | After this PR
| -------------     | -------------   | ------------- |
| 550 ms            | 10.30 s         | 560ms  |

And these when removing the filter by default (leading it to fetch heavier records):

| Before PR 107558  | After PR 107558 | After this PR
| -------------     | -------------   | ------------- |
| 2.27 s            | 24.48 s         | 1.89 s |

OPW-3107540

closes odoo/odoo#109481

X-original-commit: 4bbf782505e72761c7c77abfe4fbd53e151e5bf0
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-01-11 09:38:49 +01:00
Arnold Moyaux c0a6246390 [FIX] delivery, stock: no propagation of carrier on MTO products
Usecase to reproduce:
- Create a product with replenish on order route
- Create a SO for this product and add a shipping method
- Confirm the SO

The shipping method is not on the product.

It's due to the MTO delivery rule that miss the propagation of carrier
option. It's not set by default while it's is on the classic delivery
rule on the warehouse.

To avoid confusion we add it by default on both rules

opw-3112455
opw-3113180

closes odoo/odoo#109328

X-original-commit: c02df957d9f04c911f330aaaadd80fe97a601509
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-01-06 15:33:03 +01:00
ノウラ 64780b824b [FIX] delivery: speed up delivery costs installation
Due to hefty data the RAM limit gets exhausted.
The process gets killed due to the computed field weight on
- stock.move
- stock.picking
When installing the delivery costs module.

To solve the problem:

We add the column weight to the DB schema.

Ticket ids:
- 3013955
- 2628251
- 3028081

closes odoo/odoo#109164

Signed-off-by: Tiffany Chang <tic@odoo.com>
2023-01-05 13:09:17 +01:00
Denis Roussel ca17c97920 [FIX] delivery: Really use propagate_carrier option on stock rules
closes odoo/odoo#108501

X-original-commit: c41d64507cd08c6e6cb033e8802d537acce5aaab
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2022-12-22 14:49:26 +01:00
Ahmed Khalaf (ahkh) be58a41cbb [IMP] delivery: set weight for shipping rate
Previously, when adding shipment to sale order, the user did not know
the total weight of the order when getting rate of shipping method.
This commit shows the total order weight to the user with the ability to
set it to any value to get the rate with.

Taskid: 2797613
Part-of: odoo/odoo#96660
2022-12-15 10:31:12 +01:00
Aurelien van Delft (avd) 81773cd70f [FIX] delivery: read_group fest speeding up weights compute
Currently _compute_bulk_weight and _compute_weight are
going through each picking in self and each stock_move_line
in picking.move_line_ids to compute the pickings' weight.

This can be slow when there are lots of move_lines by pickings
as the field cache will be filled by the move_lines records
and uom._compute_quantity will be called once by move_line.

This is especially true for pickings with SN-tracked products.
For SN tracked products there will be one move_line by product_qty
(so a picking with 1 SN tracked product with a qty of 100 will have
 100 move_lines). In this case doing a read_group yields the highest
speedup.

Following the same reasoning a search_count is done in _compute_packages
before retrieving package.move_line_ids.
When package.move_line_ids.result_package_id is empty doing a count
is much faster as it avoids calling _in_cache_without for the package
move_line_ids. The search_count overhead is negligeable in the other
case so adding it leads to an overall speedup on average.

opw-3017013

closes odoo/odoo#107994

X-original-commit: c95abbe8fa09decca2f94a035934e8d6ae7903e1
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Van Delft Aurélien (avd) <avd@odoo.com>
2022-12-14 22:04:20 +01:00
Achraf 0801d1a92e [FIX] delivery: Fix ZeroDivisionError in shipping cost calculation
A `ZeroDivisionError` traceback  that occurs in `delivery/DeliveryCarrier:_get_packages_from_order` was caught by Sentry

Because in this part of the function

https://github.com/odoo/odoo/blob/c18064d717312287f5acba2fabeb77b2e1c01fb9/addons/delivery/models/delivery_carrier.py#L326-L335

if `total_weight === 0.0` then `total_full_packages` and `last_package_weight` will be null too.
And that will cause a `ZeroDivisionError` because of `total / len([])`

opw-3086602

closes odoo/odoo#107820

X-original-commit: a362e14ee62a5d9d2bcb08c4431994a96796ce1e
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-12-14 11:41:57 +01:00
Denis Ledoux 3752b3166e [REF] base: set USD as default currency for the main company
There are three rationales behind this change to set USD as default
currency and to enable it in the demo data, from the beginning.
With a demo database, before this revision:
1. On runbot, with all modules installed, it's already USD the default
   company currency. It's only when you install a module not depending
   on account that it's EUR the company currency by default (e.g. CRM)
2. in the base demo data,
   the company is set in the United States but with the currency EUR,
3. before installing account, the company currency is EUR,
   after installing account, the company currency is USD,
   this is due to the fact as the company is in the United States,
   the US Chart Of Account is installed, switching the company currency
   to USD.
4. when you install a demo database with a module not depending on
   account, you are left with a database without any active currency,
   and the monetary fields therefore do not show any currency.
   For instance, install only CRM with demo,
   you have no currency symbol before or after the expected revenue,
   which is not the best user friendly experience.
   On runbot you do not feel it because all modules are installed,
   therefore with account installed, which activated the USD currency.

Additional weird thing with point 2.:
- Unit tests in modules not dependent on account with the
  post-install tag had to handle this sudden change of currency change
  before and after installing account.
  For instance, when running their unit tests with only their module,
  but not account, the company currency is EUR,
  but when executing the same unit test with all modules installed,
  the company currency is USD.
  The unit tests had to handle this sudden change within the unit test,
  for instance by setting a 1.0 rate for their own company currency,
  which shouldn't be the case: the rate of your own currency should
  always be 1.0.

closes odoo/odoo#107113

Related: odoo/enterprise#34613
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-12-13 11:47:49 +01:00
pedrambiria ccaecba252 [FIX] delivery: accept regex in the zip prefixes field
In the country of Bahrain, they have 3 and 4-digit zip codes. With the
current implementation of the delivery module, they can not add 3-digit
zip codes because they will be matched with some 4-digit zip codes,
which is incorrect.

For example, consider '101' and '1011' as two different zip codes related to
two separate zones. If you add '101' to a delivery method, it would also
accept '1011'.

The solution is to accept regular expression to allow them to use $ to
define the end of the zip code.

opw-3072592

closes odoo/odoo#107636

X-original-commit: 0a68d171af2645d3047d561acb354730aebfa753
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-12-09 18:37:50 +01:00
Goffin Simon 76199fd956 [FIX] delivery: Multi currencies with free shipping above amount
Steps to reproduce the issue:

- Let's consider two currencies C1, C2
- Let's consider two pricelists P1 in C1 and P2 in C2
- Let's consider that the current company CY has the default currency C1
- Let's consider that the current rate of C1 = 1.0 and C2 = 5.0
- Create a shipping method SM with fixed price = 50 and free shipping is above 100 (expressed in company currency)
- Create a SO with P2 and add a line with a product of 200 C2 (equal to 40 C1)
- Add shipping method SM

Bug:

The shipping was considered as free but the total of the SO was not above 100 in the currency of the company

opw:3010266

closes odoo/odoo#107456

X-original-commit: c93ab6615f0370963b152cc0320478fe4ceed164
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-12-08 13:38:06 +01:00
Jorge Pinna PuissantandMichael Mattiello (mcm) c7c2959449 [IMP] web, *: simplification and standardization of the settings arch
The aim of this commit is to simplify and standardize the settings archs.

To do this, a small DSL exclusively for the settings was created. This
new DSL introduces 3 tags: `app`, `block` and `setting`.

The `app` tag is used to declare the application on the settings view.
It creates an entry with its logo on the sidebar of the view. It also
acts as delimiter when searching.

```xml
    <app string="CRM" name="crm">
    ...
    </app>
```

- `string` : The "display" name of the application.
- `name` : The technical name of the application (the name of the module).
- `logo` *optional* : The relative path to the logo. If not set, the
        logo is created using the `name` parameter :
        `/{name}/static/description/icon.png`.

The `block` tag is used to declare a group of settings. This group can
have a title and a description/help.

```xml
    <block title="Title of group Bar">
    ...
    </block>
```

- `title` *optional* : The title of the block of settings (the old h2),
        you can perform research on its text.
- `help` *optional* : The description/help of the block of settings
        (the old h3), you can perform research on its text.

The `setting` tag is used to declare the setting itself. The first field
in the setting is used as the main field (optional). This field is
placed on the left panel (if it's a boolean field) or on the top of the
right panel (otherwise). The field is also used to create the setting
label if a `string` is not defined. The `setting` tag can also contain
more elements (e.g. html), all of these elements are rendered in the
right panel.

```xml
    <setting string="this is bar">
        <field name="bar"/>
        ...More elements
    </setting>
```

- `type` *optional* : By default, a setting is visually separated on two
        panels (left and right), and is used to edit a given field. By
        defining `type='header'`, a special kind of setting is rendered
        instead. This setting is used to modify the scope of the other
        settings. For example, on the website application, this setting
        is used to indicate to which website the other settings apply.
        The header setting is visually represented as a yellow banner on
        the top of the screen.
- `string` *optional* : The text used as label of the setting. If it's
        not defined, the first field is used as label.
- `title` *optional* : The text used as tooltip.
- `help` *optional* : The help/description of the setting. This text is
        displayed just below the setting label (with classname
        `text-muted`).
- `company_dependent` *optional* : If this attribute is set to "1" an
        icon is displayed next to the setting label to explicit that
        this setting is company-specific.
- `documentation` *optional* :  If this attribute is set, an icon is
        added next to the setting label, this icon is a link to the
        documentation. Note that you can use relative or absolute path.
        The relative path is relative to
        `https://www.odoo.com/documentation/server_version`, so it's not
        necessary to hard-code the server version on the arch anymore.

closes odoo/odoo#106425

Task-id: 3081367
Related: odoo/enterprise#34337
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: "Michael Mattiello (mcm)" <mcm@odoo.com>
2022-12-02 14:40:25 +01:00
Touati Djamel (otd) 42f9a2c2da [FIX] delivery: avoid a traceback when calculating the shipping cost
Stpes to reproduce the bug:
- Install delivery_ups
- Go to shipping method > UPS BE > Package type
- Set the max weight to 10 kg
- Create a product “P1”:
    - Go to inventory tab > weight: 10 kg
- Create a SO:
    - Add the product “P1”
    - Add shipping
    - Select UPS Be
    - Click on get rate

 Problem:
Traceback is triggered, because we devise a number by an empty list:
https://github.com/odoo/odoo/blob/6b0ab28791f4a29254d294f8a116545d4c124e8b/addons/delivery/models/delivery_carrier.py#L301

The `last_package_weight` is the result of the modulo of the weight of
all the products by the maximum weight of a package, in this case it is:
0 -> 10% 10

We then use this result to calculate the weight of the package,
but parenthesis have been forgotten and therefore an empty list is
returned in the case where `last_package_weight` is 0

https://github.com/odoo/odoo/blob/6b0ab28791f4a29254d294f8a116545d4c124e8b/addons/delivery/models/delivery_carrier.py#L298-L300

opw-3075295

closes odoo/odoo#106863

X-original-commit: f173300f4f24d600693ab54c8db0995723a304e9
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-12-01 13:31:02 +01:00
Touati Djamel (otd) c82e9d036c [FIX] delivery: raise a UserError if the total weight is 0
Steps to reproduce the bug:
- Install `delivery_dhl`
- Create a storable product “P1”:
    - make sure the weight of the product is equal to 0
- create a transfert:
    - Type: delivery orders
    - Add the product “P1”
    - Go to “Additional info” tab and select “DHL” in the carrier field
    - Mark as Todo
    - Validate

Problem:
A traceback is triggered, because in order to set the shipment details,
a package should be created, so the `_get_packages_from_picking`
function is called:
https://github.com/odoo/enterprise/blob/aed802ee17dba5ebe12b42594503732a2662be68/delivery_dhl/models/dhl_request.py#L166

But as the total weight of the products is equal to 0, the package is
not created:

https://github.com/odoo/odoo/blob/6b0ab28791f4a29254d294f8a116545d4c124e8b/addons/delivery/models/delivery_carrier.py#L324-L325

then, the result is used without checking if the package has been
created:
https://github.com/odoo/enterprise/blob/aed802ee17dba5ebe12b42594503732a2662be68/delivery_dhl/models/dhl_request.py#L185

Solution:
If the total products weight is equal to 0, raise a UserError

opw-3076826
opw-3075562

closes odoo/odoo#106894

X-original-commit: c18064d717312287f5acba2fabeb77b2e1c01fb9
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-11-30 16:07:56 +01:00
Arnold Moyaux f613ce968d [FIX] base, stock, delivery: replace support datamatrix barcode printing
This reverts commit 3ebe1185a4.

The code ECC200DataMatrix already exist in reportlab (that is already a dependance).
Some differences:
- ECC200DataMatrix only supports a Type 12 (44x44) C40 encoded data matrix.
  (214 alphanumeric characters and 14 to 27% of error correcting rate)
- pylibdmtx support more type and add a default to 24x24. So it means a
  (52 characters and 20 to 35% error correcting rate). It's also smaller
  to display.

We consider the gain too small compare to maintain an extra lib.

It also fix blured datamatrix in stock report if they contains too much
data.

*If you want to test 001234560000000018 is a valid sscc for package

closes odoo/odoo#106620

X-original-commit: 54ef19f41ffc4a6f715474b65a4183a7fa75feea
Related: odoo/enterprise#34422
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2022-11-30 10:05:27 +01:00
Tommy (tong) 81076aa514 [FIX] delivery: unit test
closes odoo/odoo#106717

X-original-commit: a1afad5a70e57444955223aa5c362d87cae37d6c
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2022-11-30 09:07:52 +01:00
Adrien Widart (awt) b603cde02d [FIX] delivery: hide useless length UoM
The dimensions UoM of the carrier packaging is useless: it is not the
one used in the requests and there is not any conversion

To reproduce the issue
(Need delivery_fedex. Use demo data. Enable debug mode)
1. In Shipping Methods, edit 'Fedex US':
    - Package Weight Unit: KG
    - Debug Requests: True
2. Edit its Fedex Package Type:
    - Height: 1m
    - Width: 1m
    - Length: 1m
    - Package Code: YOUR_PACKAGING
3. Create a SO with a US partner and one product
4. On the SO
    - Add Shipping
    - Select 'Fedex US'
    - Click on 'Get Rate'
5. In Logging, open the request sent

Error: the dimensions of the packaging are expressed with "CM" but they
are not converted:
```xml
<ns0:Dimensions>
	<ns0:Length>1</ns0:Length>
	<ns0:Width>1</ns0:Width>
	<ns0:Height>1</ns0:Height>
	<ns0:Units>CM</ns0:Units>
</ns0:Dimensions>
```

When encoding the packaging in the request, the UoM defined on the
packaging (meter) is ignored. Instead, we define a length UoM depending
on the UoM of the weight and we don't convert any dimension:
https://github.com/odoo/enterprise/blob/e4fd13a0e073b9855864b7fabc26bc05b9a5fd19/delivery_fedex/models/fedex_request.py#L172-L178
There is even a `TODO` about the issue.

It will be the same with the other carriers. For instance, with UPS:
https://github.com/odoo/enterprise/blob/c9899f7860cd19c86f215d6dcea89f73b51433f3/delivery_ups/models/ups_request.py#L98-L102
We use the UoM of `ups_package_dimension_unit` and do not convert the
dimensions.

We can't implement the dimensions conversion on stable versions, since
it will break all existing packagings. So, as temporary solution, we can
simply hide the useless UoM defined on the packagings.

OPW-3053048

closes odoo/odoo#106338

X-original-commit: 3bc2f594395a08515ed362e3d9a816e7cc18c842
Related: odoo/enterprise#34305
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2022-11-24 12:26:06 +01:00
niyasraphy 990ce0331b [FIX] delivery: show only delivery apps and translatable string
closes odoo/odoo#105726

X-original-commit: 9572e0a0410787ac60aeeb3996b4044f7d7eda22
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2022-11-15 10:34:15 +01:00