Commit Graph
12 Commits
Author SHA1 Message Date
Surabhi Varma bbfd5aa614 [IMP] stock_delivery: route based on shipping method
In this commit, we added a new field in the shipping methods this field can be
used select rules. These rules can only be used when the corresponding SO has
one of the selected shipping methods.

task-3236149

closes odoo/odoo#119320

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-07-03 12:20:58 +02:00
Victor Feyens 17bece3e79 [REF] sale,*: remove locked (done) SO state
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
2023-06-22 15:40:51 +02:00
Walid 56227b9049 [FIX] delivery: Backorder shipping cost with invoice policy in real
port of this fix
https://github.com/odoo/odoo/pull/70454

Steps to reproduce the bug:

- Let's consider a delivery carrier DC with invoice policy = 'real'
- Let's consider a consumable product P with a weight = 1kg and sales price = 10€
- Create a sale order SO with 2 P and add DC as shipping cost
- Process the shipment for 1 P and create a backorder
- Process the second shipment with the last P

Bug:

Two lines L1, L2 with DC were created on SO but only L1 as a price unit and a description.
L2 had a price unit = 0€ and no description.

opw-3219711

closes odoo/odoo#125573

X-original-commit: 79dad0a7599584f14e4ab3e96c393983e95aa519
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
2023-06-19 16:40:04 +02:00
Valentin Vallaeys (vava) 129618ae41 [FIX] (stock_)delivery: no stock.picking in delivery
In this commit
https://github.com/odoo/odoo/pull/121354/commits/7d1092ba0e970170ce66e77e6ddc4cab0e09563d
the forward-port automatically moved the test to `stock_delivery` but
the code change remained in `delivery`. Since it handles `stock.picking`
on a `sale.order`, and that `delivery` does not depend on `stock`
anymore, it should move to `stock_delivery` as well.

closes odoo/odoo#123993

X-original-commit: d5b64650d043f94f8e244c993eff36ed26a93a32
Signed-off-by: Vallaeys Valentin (vava) <vava@odoo.com>
2023-06-06 20:27:41 +02:00
Ahmad Khanalizadeh 3d21e61e4b [FIX] delivery: exclude service lines from commodities
Steps to reproduce:
configure easypost for international shipping (e.g. using USPS)
Make a sale order for a customer in another country
Add a discount program (e.g. 10% off)
Attempt to add shipping and get the rates
Get traceback:
`Easypost returned an error: Wrong parameter type.
- value: must be greater than or equal to 0`

To fix this we need to exclude service type products when creating
commodities from order lines (similar to creating commodities from
stock move lines)

opw-3269467

closes odoo/odoo#122869

X-original-commit: c4904454d46036374ea5e9ae7047f1546e9cab44
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Khanalizadeh Ahmad (khah) <khah@odoo.com>
2023-05-31 13:08:06 +02:00
Eteil Djoumatchoua (etdj) 171aa0ec25 [FIX] delivery_carrier,sale_giftcard: get the right shipping price even with gift card
Step:
- Create a product with sale price 120 USD
- Create a giftcard with balance 40 uSD
- Create a free Shipping cost of 40 USD fixed price and freeing above 100 USD
- Go to website->shop, select the product and checkout the cart(the shipping is free because price exceeds 100)
- Add the gift card to payment

Issue:
The shipping price gets from free to 40

Cause:
When computing the cost of the shipping the fact of the presence of a giftcard is not considered.

Solution:
Create a method to returns the amount of giftcard from a sale order and add to total price to check if the shipping is free

opw-3107284

closes odoo/odoo#120174

X-original-commit: c57184fd1c3d2846df4f618dee0027364eb62596
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
Signed-off-by: Djoumatchoua Eteil Junior (etdj) <etdj@odoo.com>
2023-05-16 13:36:59 +02:00
Rémy Voet (ryv) 234db70d86 [IMP] *: Use the new API of _read_group for backend use
Part-of: odoo/odoo#110737
2023-04-19 21:58:27 +02:00
Martin Trigaux 69f911d994 [IMP] *: enforce usage of Markup in mail
When using message_post, the body format must be explicitly specified.
If html is expected, a Markup object should be used.
If text is given, the content will be escaped.

Before this PR:
message_post was unaware if the content of a message was HTML or
text. This lead to multiple situation where the content was
incorrectly considered as HTML and led to display errors.
In
  self.message_post(body="Hello %s!" % self.name)
if the name contained HTML, it would be evaluated.

In
  self.message_post(body="Contact Raoul <raoul@caramail.be>")
the email would not be displayed as considered as unknown HTML and
discarded by the sanitizer

Now each call must explict the type of content.
Use the escape() helper to properly combine Markup and translations.
It would also be acceptable to use Markup() to wrap a static
translation but escape is better as one can not guarantee the content
of a translation.

closes odoo/odoo#111850

Related: odoo/documentation#3612
Related: odoo/enterprise#36728
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-04-13 16:39:48 +02:00
Ahmad Khanalizadeh 861db8a5a7 [FIX] delivery: use correct unit price for commodities
Steps to reproduce:
Make a sale order with a product and quantity > 1, add
FedEx international shipping and validate the delivery
In the document you will see that the unit cost is equal
to subtotal which is wrong.

There is a discrepancy between `_get_commodities_from_order` and
`_get_commodities_from_stock_move_lines`, that the former makes
commodities with `monetary_value` equal to the unit price, while
the latter uses subtotal. in the method `commodities` in
`delivery_fedex`, `monetary_value` is treated as unit price, so
the right way to fix it is to do it in
`_get_commodities_from_stock_move_lines`.

Note that when rating a delivery, commodities are made in
`_get_commodities_from_order` and then passed to `commodities`,
while for sending the shipping, commodities are made in
`_get_commodities_from_stock_move_lines`.

opw-3233369

closes odoo/odoo#117521

X-original-commit: 3beddbdd18937e1c69ec4fa6f523296c7c55528b
Related: odoo/enterprise#39234
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Khanalizadeh Ahmad (khah) <khah@odoo.com>
2023-04-03 22:55:48 +02:00
Ahmad Khanalizadeh 10c90e3515 [FIX] delivery: group by products when creating commodities
Before this commit, if you made a product to be tracked by unique
serial number and then make a sale order with hundreds of units
of the same product, each unit will make a separate line with qty = 1.

The issue is each serial makes a different `stock.move.line` and
`_get_commodities_from_stock_move_lines` groups by move lines, which
leads to the issue.

To solve the problem we need to group the move lines by product.

opw-3212809

closes odoo/odoo#116882

X-original-commit: 3c4a12bac1302c8e39dc2a1c617e6536c2d07d3d
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Khanalizadeh Ahmad (khah) <khah@odoo.com>
2023-03-29 10:37:22 +02:00
Gaetan Vanden Bergh (gavb) ffbc3ee4af [FIX] delivery: Fix renaming of field
Fix a forgotten field after a renaming after a forward conflict:
[REF] *{stock,mrp}*: rename reserved fields
This commit rename product_uom_qty into reserved_uom_qty and product_qty
into reserved_qty on stock move line to stop mistake them with the stock
move quantities fields.

Task: 2648449
Part-of: #80434

opw-3225854

closes odoo/odoo#115501

X-original-commit: 022de9edabb9993bfab6dd4e45feed788b7e1c38
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-03-16 13:08:00 +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