Nicolas Martinelli 4927d4c5ac [FIX] purchase_stock: change PU with discount on invoice
- Create a product P
  Costing Method: FIFO
  Inventory Valuation: Perpetual (automated)
  Price Difference Account set
- Create a PO with P, set a price of 110 (no tax).
- Receive the product

2 journal items are generated:

|                 Account |   Debit|  Credit|
|-------------------------|--------|--------|
| Stock Valuation         |   110.0|     0.0|
| Stock Interim (Received)|     0.0|   110.0|

- Create the corresponding invoice
- Change the:
  Unit Price: 100
  Discount: 10
- Validate the invoice (for a total of 90.0)

3 journal items are generated:

|                 Account |   Debit|  Credit|
|-------------------------|--------|--------|
| Account Payable         |     0.0|   100.0|
| Difference Account      |     0.0|    20.0|
| Stock Interim (Received)|   120.0|     0.0|

This is not correct: the Stock Interim (Received) should have a debit of
110.0, and the Account Payable credit should be 90.0.

This comes from the fact that the difference is subtracted from
`line['price_unit']`, which doesn't contain the discount.

We can use `price_val_dif` to update the price. Moreover, the
`price_unit` seems ultimately useless, since it is not used in:

https://github.com/odoo/odoo/blob/e11bacfe512a3170f44d6d43646af914a9cf3b73/addons/account/models/product.py#L63

We still update it for consistency.

Fixes #32911
Fixes #33201
opw-1974002
2019-05-14 08:19:20 +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, Purchase Management, ...

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.

Then follow 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%