diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py
index 24dc0967403..9374d3f0274 100644
--- a/addons/point_of_sale/models/pos_config.py
+++ b/addons/point_of_sale/models/pos_config.py
@@ -527,20 +527,6 @@ class PosConfig(models.Model):
self._check_before_creating_new_session()
self._validate_fields(self._fields)
- # check if there's any product for this PoS
- domain = [('available_in_pos', '=', True)]
- if self.limit_categories and self.iface_available_categ_ids:
- domain.append(('pos_categ_id', 'in', self.iface_available_categ_ids.ids))
- if not self.env['product.product'].search(domain):
- return {
- 'name': _("There is no product linked to your PoS"),
- 'type': 'ir.actions.act_window',
- 'view_mode': 'form',
- 'res_model': 'pos.session.check_product_wizard',
- 'target': 'new',
- 'context': {'config_id': self.id}
- }
-
return self._action_to_open_ui()
def open_existing_session_cb(self):
diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py
index 0136357e4cb..47a63f965de 100644
--- a/addons/point_of_sale/models/pos_session.py
+++ b/addons/point_of_sale/models/pos_session.py
@@ -8,7 +8,7 @@ from markupsafe import Markup, escape
from odoo import api, fields, models, _, Command
from odoo.exceptions import AccessError, UserError, ValidationError
-from odoo.tools import float_is_zero, float_compare
+from odoo.tools import float_is_zero, float_compare, convert
from odoo.osv.expression import AND, OR
from odoo.service.common import exp_version
@@ -2125,6 +2125,12 @@ class PosSession(models.Model):
return fps
+ def load_product_frontend(self):
+ convert.convert_file(self.env, 'point_of_sale', 'data/point_of_sale_onboarding.xml', None, mode='init',
+ kind='data')
+ return self.get_onboarding_data()
+
+
class ProcurementGroup(models.Model):
_inherit = 'procurement.group'
diff --git a/addons/point_of_sale/security/ir.model.access.csv b/addons/point_of_sale/security/ir.model.access.csv
index 78d331cc471..5716eababfa 100644
--- a/addons/point_of_sale/security/ir.model.access.csv
+++ b/addons/point_of_sale/security/ir.model.access.csv
@@ -52,5 +52,4 @@ access_pos_make_payment,access.pos.make.payment,model_pos_make_payment,point_of_
access_pos_close_session_wizard,access.pos.close.session.wizard,model_pos_close_session_wizard,point_of_sale.group_pos_user,1,1,1,0
access_account_cash_rounding_pos_user,account.cash.rounding pos_user,account.model_account_cash_rounding,group_pos_user,1,0,0,0
access_pos_bill,pos.bill pos_user,model_pos_bill,group_pos_user,1,1,1,1
-access_pos_session_check_product_wizard,access.pos.session.check.product.wizard,model_pos_session_check_product_wizard,group_pos_user,1,1,1,0
access_pos_daily_sales_reports_wizard,access.pos.daily.sales.reports.wizard,model_pos_daily_sales_reports_wizard,group_pos_manager,1,1,1,0
diff --git a/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductsWidget.js b/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductsWidget.js
index 047dc2e8923..a2257e9f470 100644
--- a/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductsWidget.js
+++ b/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductsWidget.js
@@ -21,12 +21,19 @@ export class ProductsWidget extends Component {
*/
setup() {
super.setup();
- this.state = useState({ previousSearchWord: "", currentOffset: 0 });
+ this.state = useState({
+ previousSearchWord: "",
+ currentOffset: 0,
+ showReloadMessage: false,
+ });
this.pos = usePos();
this.popup = useService("popup");
this.notification = useService("pos_notification");
this.orm = useService("orm");
}
+ get hasProducts() {
+ return Object.keys(this.pos.globalState.db.product_by_id).length > 0;
+ }
get selectedCategoryId() {
return this.env.pos.selectedCategoryId;
}
@@ -161,4 +168,18 @@ export class ProductsWidget extends Component {
}
}
}
+ async loadDemoDataProducts() {
+ const { products, categories } = await this.orm.call(
+ "pos.session",
+ "load_product_frontend",
+ [this.pos.globalState.pos_session.id]
+ );
+ this.pos.globalState.db.add_categories(categories);
+ this.pos.globalState._loadProductProduct(products);
+ }
+
+ createNewProducts() {
+ window.open("/web#action=point_of_sale.action_client_product_menu", "_blank");
+ this.state.showReloadMessage = true;
+ }
}
diff --git a/addons/point_of_sale/static/src/scss/pos.scss b/addons/point_of_sale/static/src/scss/pos.scss
index fbcf0f12857..9570a513359 100644
--- a/addons/point_of_sale/static/src/scss/pos.scss
+++ b/addons/point_of_sale/static/src/scss/pos.scss
@@ -3600,6 +3600,23 @@ td {
background: rgba(104,69,95, 0.7);
}
+.pos .no-results-message .button-no-demo {
+ margin: 3px;
+ width: 180px;
+ padding: 10px 0;
+ cursor: pointer;
+ font-size: large;
+}
+
+.info-load-product-message {
+ background: lightblue;
+ color: #017e84;
+ padding: 8px;
+ width: fit-content;
+ display: block;
+ margin : 3px auto 0 auto;
+}
+
@media screen and (max-width: 768px) {
.pos .search-bar-container.sb-product {
max-width: none;
diff --git a/addons/point_of_sale/static/src/xml/Screens/ProductScreen/ProductsWidget.xml b/addons/point_of_sale/static/src/xml/Screens/ProductScreen/ProductsWidget.xml
index 152484eca82..8328a336065 100644
--- a/addons/point_of_sale/static/src/xml/Screens/ProductScreen/ProductsWidget.xml
+++ b/addons/point_of_sale/static/src/xml/Screens/ProductScreen/ProductsWidget.xml
@@ -26,6 +26,13 @@
There are no products in this category.
+
+
+
+
+ Please reload this page once products have been created
+
+