diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2019-04-24 08:12:08 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2019-04-24 09:25:42 +0000 |
| commit | a2d71ce0eacfc90706e55ef09e34e0426ff5fd0b (patch) | |
| tree | d9efd47b97f29854c793d3cd23268a9b1bb5a66c /addons | |
| parent | c1f354beb881a47fb8d54f21034850ee16d4cdb9 (diff) | |
[FIX] point_of_sale: product valuation at invoice
- Create 2 companies A & B
- Set the superuser in company A
- Create a POS and a user in company B
- Create a product P. The 'Inventory Valuation' must be different in
both companies:
Company A: Periodic (manual)
Company B: Perpetual (automated)
- Connect with the user in company B
- Sell the product P, select a customer and print the invoice
The COGS journal entry is not posted.
This is because `action_invoice_open` is called as `sudo()`, but
ultimately `product.valuation` is called in:
https://github.com/odoo/odoo/blob/0cce154794c8de945805d9b9acc4c33e5258191a/addons/stock_account/models/product.py#L325
`product.valuation` is computed based on the property field
`property_valuation`, which is therefore company-dependant.
Closes #32803
opw-1961861
closes odoo/odoo#32903
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/point_of_sale/models/pos_order.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 156000df998..f38e19becaa 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -728,7 +728,7 @@ class PosOrder(models.Model): if to_invoice: pos_order.action_pos_order_invoice() - pos_order.invoice_id.sudo().action_invoice_open() + pos_order.invoice_id.sudo().with_context(force_company=self.env.user.company_id.id).action_invoice_open() pos_order.account_move = pos_order.invoice_id.move_id return order_ids |
