Skip to content
Snippets Groups Projects
Commit d59fc6c9 authored by Andrea Grazioso (agr-odoo)'s avatar Andrea Grazioso (agr-odoo)
Browse files

[FIX] point_of_sale: perform stock operation only when necessary

Fine tuning of
https://github.com/odoo/odoo/commit/bdd36f7ce68999576dfc30298f4ddf2572b4c7ec


to perform the assignment and related operation only when 'consignment' is
enabled

opw-2508371

closes odoo/odoo#71396

Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
parent 05b6dfa0
No related branches found
No related tags found
No related merge requests found
......@@ -149,14 +149,15 @@ class StockPicking(models.Model):
self.env['stock.move.line'].create(ml_vals)
else:
move._action_assign()
for move_line in move.move_line_ids:
move_line.qty_done = move_line.product_uom_qty
if float_compare(move.product_uom_qty, move.quantity_done, precision_rounding=move.product_uom.rounding) > 0:
remaining_qty = move.product_uom_qty - move.quantity_done
ml_vals = move._prepare_move_line_vals()
ml_vals.update({'qty_done':remaining_qty})
self.env['stock.move.line'].create(ml_vals)
if self.user_has_groups('stock.group_tracking_owner'):
move._action_assign()
for move_line in move.move_line_ids:
move_line.qty_done = move_line.product_uom_qty
if float_compare(move.product_uom_qty, move.quantity_done, precision_rounding=move.product_uom.rounding) > 0:
remaining_qty = move.product_uom_qty - move.quantity_done
ml_vals = move._prepare_move_line_vals()
ml_vals.update({'qty_done':remaining_qty})
self.env['stock.move.line'].create(ml_vals)
move.quantity_done = move.product_uom_qty
def _send_confirmation_email(self):
......
......@@ -207,6 +207,8 @@ class TestPoSStock(TestPoSCommon):
Test order via POS a product having stock owner.
"""
group_owner = self.env.ref('stock.group_tracking_owner')
self.env.user.write({'groups_id': [(4, group_owner.id)]})
self.product4 = self.create_product('Product 3', self.categ_basic, 30.0, 15.0)
inventory = self.env['stock.inventory'].create({
'name': 'Inventory adjustment'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment