Skip to content

Commit

Permalink
FIX After refund of 1 qty, POS qty display increased by 2 qty
Browse files Browse the repository at this point in the history
  • Loading branch information
kothiyarajesh committed Aug 13, 2023
1 parent 1b8714c commit a0c18a3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions pos_stock_available_online/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
from . import res_config_settings
from . import stock_quant
from . import stock_warehouse
from . import pos_order
24 changes: 24 additions & 0 deletions pos_stock_available_online/models/pos_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from odoo import api, fields, models, _


class PosOrder(models.Model):
_inherit = 'pos.order'

@api.model
def create_from_ui(self, orders, draft=False):
order_ids = super(PosOrder, self).create_from_ui(orders, draft)
for order in self.sudo().browse([o['id'] for o in order_ids]):
config = order.config_id
# send quantity notification after order
if config and config.display_product_quantity:
products = order.lines.mapped("product_id")
warehouse_info = []
for product in products:
# prepared first main warehouse info
warehouse_info = [config.main_warehouse_id._prepare_vals_for_pos(product)]
# prepared additional warehouses info
for warehouse in config.additional_warehouse_ids:
warehouse_info.append(warehouse._prepare_vals_for_pos(product))

Check warning on line 21 in pos_stock_available_online/models/pos_order.py

View check run for this annotation

Codecov / codecov/patch

pos_stock_available_online/models/pos_order.py#L21

Added line #L21 was not covered by tests
if warehouse_info:
config._notify_available_quantity(warehouse_info)
return order_ids

0 comments on commit a0c18a3

Please sign in to comment.