odoo/odoo#193630

Created by fw-bot
Merged at da5289d4935195f1b31c36f00e6071cee2fbe3a7

Statuses:

label
odoo-dev:saas-17.4-17.0-opw-4359435-pos_lot_number_move_line-sbel-NlGv-fw
head
65e736a286d5aa16d33f55cd4d0769f0365b405d
merged
5 months ago by Bugfix, Sarah Bellefroid (sbel)
odoo/odoo
17.0 #193450
saas-17.2 #193612
saas-17.4 #193630
18.0 #193649
saas-18.1 #193663
saas-18.2
saas-18.3
master #193671

[FW][FIX] point_of_sale: assign lot_id on quants when applicable

Currently, when buying a product in pos and using a new lot id, the quantities do not reflect this lot id.

Steps to reproduce:

  • Create a product:
  • Storable
  • Available in POS
  • Tracked by lots
  • Open shop session
  • Select the product just created
  • Enter anything as the lot number
  • Finalize order
  • Close session
  • In the back-end, navigate to the product page
  • Select the smart button On hand
    > Observation: The lot is not reflected

Why the fix:

When the session in closed, stock.lot are created but not reflected on the inventory quantity updates.

We can add the lot_id when creating move lines as where we mention it, it will always have a related existing lot as per: https://github.com/odoo/odoo/blob/ba21b59d1234d13b5d4460facd60c586648048b8/addons/point_of_sale/models/stock_picking.py#L290

opw-4359435

Forward-Port-Of: #193450