sbel-odoo f83ce46fa2 [FIX] purchase, purchase_stock: add supplier discount on purchase order
Currently, when replenishing a product using a supplier that has a discount, the purchase order created didn't take the discount into account. It was set to zero.
Fix in `purchase` module, test in `purchase_stock` module.

Steps to reproduce:
-------------------
* Go to ´Inventory´ > ´Products´
* Select any product
* Configure the product:
* - Product type: storable
* - Enable ´can be purchased´
* - Under the ´Purchase´ tab, add a vendor with a discount price
* - Save
* Select ´Replenish´
* Select the vendor previously added
* Confirm
* Check the PO created

Why the fix:
------------
After debugging, I discovered that
```python
po_line_values.append(self.env['purchase.order.line']._prepare_purchase_order_line_from_procurement(
    procurement.product_id, procurement.product_qty,
    procurement.product_uom, procurement.company_id,
    procurement.values, po))
```
in `/home/odoo/odoo/addons/purchase_stock/models/stock_rule.py` would loose the discount value.

Discount can be found in `procurement.values.supplier.discount`.

Further investigation revealed that function `_prepare_purchase_order_line(self, product_id, product_qty, product_uom, company_id, supplier, po)` in `/home/odoo/odoo/addons/purchase/models/purchase_order_line.py` would not make use of the discount value.

In this function, we use the discount value from the seller instead of the supplier as the seller is computed in order to use the smallest discounted_price.

opw-3640396

closes odoo/odoo#147555

Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
2023-12-28 14:22:29 +00:00
2023-11-02 21:02:44 +00:00
2023-12-26 08:36:45 +00:00
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%