diff --git a/beesdoo_pos/models/beesdoo_pos.py b/beesdoo_pos/models/beesdoo_pos.py index 5f6e839f1..1f1e58aac 100644 --- a/beesdoo_pos/models/beesdoo_pos.py +++ b/beesdoo_pos/models/beesdoo_pos.py @@ -4,13 +4,8 @@ class BeescoopPosPartner(models.Model): _inherit = "res.partner" - def _get_eater(self): - eaters = [False, False, False] - for i, eater in enumerate(self.child_eater_ids): - eaters[i] = eater.name - return tuple(eaters) - @api.multi def get_eater(self): - eater1, eater2, eater3 = self._get_eater() - return eater1, eater2, eater3 + self.ensure_one() + # todo check for max eater + return [eater.name for eater in self.child_eater_ids] diff --git a/beesdoo_pos/static/src/js/beesdoo.js b/beesdoo_pos/static/src/js/beesdoo.js index 20bee2f21..3944da752 100644 --- a/beesdoo_pos/static/src/js/beesdoo.js +++ b/beesdoo_pos/static/src/js/beesdoo.js @@ -5,14 +5,12 @@ odoo.define("beesdoo_pos.screens", function (require) { models.load_fields("res.partner", "is_company"); - var set_customer_info = function (el_class, value, prefix) { - var el = this.$(el_class); - el.empty(); - if (prefix && value) { - value = prefix + value; - } + var set_customer_info = function (parent_class, value) { + var parent = this.$(parent_class); + var info_div = document.createElement("div"); + info_div.textContent = value; if (value) { - el.append(value); + parent.append(info_div); } }; @@ -39,23 +37,12 @@ odoo.define("beesdoo_pos.screens", function (require) { } ) .then(function (result) { - set_customer_info.call( - self, - ".customer-delegate1", - result[0], - "Eater 1: " - ); - set_customer_info.call( - self, - ".customer-delegate2", - result[1], - "Eater 2: " - ); - set_customer_info.call( - self, - ".customer-delegate3", - result[2], - "Eater 3: " + result.forEach((client_name) => + set_customer_info.call( + self, + ".customer-information-pay", + client_name + ) ); }) .fail(function (type, error) { @@ -91,23 +78,8 @@ odoo.define("beesdoo_pos.screens", function (require) { ".customer-name", self.pos.get_client().name ); - set_customer_info.call( - self, - ".customer-delegate1", - result[0], - "Eater 1: " - ); - set_customer_info.call( - self, - ".customer-delegate2", - result[1], - "Eater 2: " - ); - set_customer_info.call( - self, - ".customer-delegate3", - result[2], - "Eater 3: " + result.forEach((client_name) => + set_customer_info.call(self, ".customer-delegates", client_name) ); }) .fail(function (type, error) { diff --git a/beesdoo_pos/static/src/xml/templates.xml b/beesdoo_pos/static/src/xml/templates.xml index 02317c03f..b447c139b 100644 --- a/beesdoo_pos/static/src/xml/templates.xml +++ b/beesdoo_pos/static/src/xml/templates.xml @@ -3,13 +3,7 @@ -
- -
- -
- -
+
@@ -17,16 +11,8 @@ -
- -
- -
- -
- -
-
+
+