Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] pos_stock_available_online: FIX For After refund of 1 qty, POS qty display increased by 2 qty #1041

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
26 changes: 26 additions & 0 deletions pos_stock_available_online/models/pos_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from odoo import api, 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 23 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#L23

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