From 21abcca97e26de8b93ba64d7f524fa80f5b98e38 Mon Sep 17 00:00:00 2001 From: dsolanki Date: Fri, 16 Apr 2021 12:20:17 +0530 Subject: [PATCH] [MIG] Migrate module pos_loyalty to v13. --- pos_loyalty/README.rst | 1 + pos_loyalty/__manifest__.py | 2 +- pos_loyalty/models/loyalty_reward.py | 3 -- pos_loyalty/readme/CONTRIBUTORS.rst | 1 + pos_loyalty/static/src/js/pos.js | 1 - pos_loyalty/static/src/js/tests.js | 34 ++++++++++------------ pos_loyalty/views/loyalty_program_view.xml | 1 - pos_loyalty/views/res_partner_view.xml | 3 +- 8 files changed, 21 insertions(+), 25 deletions(-) diff --git a/pos_loyalty/README.rst b/pos_loyalty/README.rst index f3441df6fb..2df75287a4 100644 --- a/pos_loyalty/README.rst +++ b/pos_loyalty/README.rst @@ -86,6 +86,7 @@ Contributors * RGB Consulting SL (http://www.rgbconsulting.com) * Forward-port from Odoo SA saas-6 branch * Kiril Vangelovski +* Dhara Solanki Maintainers ~~~~~~~~~~~ diff --git a/pos_loyalty/__manifest__.py b/pos_loyalty/__manifest__.py index 15d57723fe..4631b1a623 100644 --- a/pos_loyalty/__manifest__.py +++ b/pos_loyalty/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Loyalty Program", - "version": "12.0.1.0.0", + "version": "13.0.1.0.0", "category": "Point of Sale", "license": "AGPL-3", "author": "OpenERP SA, " diff --git a/pos_loyalty/models/loyalty_reward.py b/pos_loyalty/models/loyalty_reward.py index 48ea59ad80..28df6075c6 100644 --- a/pos_loyalty/models/loyalty_reward.py +++ b/pos_loyalty/models/loyalty_reward.py @@ -54,7 +54,6 @@ class LoyaltyReward(models.Model): help="Product that represents a point " "that is sold by the customer", ) - @api.multi @api.constrains("type", "gift_product_id") def _check_gift_product(self): for reward in self: @@ -63,7 +62,6 @@ def _check_gift_product(self): _("Gift product field is mandatory for gift rewards") ) - @api.multi @api.constrains("type", "discount_product_id") def _check_discount_product(self): for reward in self: @@ -72,7 +70,6 @@ def _check_discount_product(self): _("Discount product field is " "mandatory for discount rewards") ) - @api.multi @api.constrains("type", "point_product_id") def _check_point_product(self): for reward in self: diff --git a/pos_loyalty/readme/CONTRIBUTORS.rst b/pos_loyalty/readme/CONTRIBUTORS.rst index 4ec3dbcc78..2e6aa4cf00 100644 --- a/pos_loyalty/readme/CONTRIBUTORS.rst +++ b/pos_loyalty/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * RGB Consulting SL (http://www.rgbconsulting.com) * Forward-port from Odoo SA saas-6 branch * Kiril Vangelovski +* Dhara Solanki diff --git a/pos_loyalty/static/src/js/pos.js b/pos_loyalty/static/src/js/pos.js index 09c44947b4..82b5d77970 100644 --- a/pos_loyalty/static/src/js/pos.js +++ b/pos_loyalty/static/src/js/pos.js @@ -454,7 +454,6 @@ odoo.define("pos_loyalty.loyalty_program", function(require) { var LoyaltyButton = screens.ActionButtonWidget.extend({ template: "LoyaltyButton", button_click: function() { - var self = this; var order = this.pos.get_order(); var client = order.get_client(); if (!client) { diff --git a/pos_loyalty/static/src/js/tests.js b/pos_loyalty/static/src/js/tests.js index 492930f994..edcb0980d9 100644 --- a/pos_loyalty/static/src/js/tests.js +++ b/pos_loyalty/static/src/js/tests.js @@ -5,6 +5,8 @@ odoo.define("pos_loyalty.tour.test_pos_loyalty", function(require) { "use strict"; + /* eslint-disable init-declarations, no-empty-function */ + // Some of the steps are taken from the pos_basic_order tour in point_of_sale. // Added additional ones necessary for testing the rewards. @@ -30,7 +32,7 @@ odoo.define("pos_loyalty.tour.test_pos_loyalty", function(require) { { content: "Check if customer " + customer_name + " is added", trigger: '.button.set-customer:contains("' + customer_name + '")', - run: function() {}, // It's a check + run: function() {}, }, ]; } @@ -57,7 +59,7 @@ odoo.define("pos_loyalty.tour.test_pos_loyalty", function(require) { { content: "the " + product_name + " have been added to the order", trigger: '.order .product-name:contains("' + product_name + '")', - run: function() {}, // It's a check + run: function() {}, }, ]; } @@ -67,7 +69,7 @@ odoo.define("pos_loyalty.tour.test_pos_loyalty", function(require) { { content: "check if " + product_name + " is in order", trigger: '.orderline .product-name:contains("' + product_name + '")', - run: function() {}, // It's a check + run: function() {}, }, ]; } @@ -95,16 +97,12 @@ odoo.define("pos_loyalty.tour.test_pos_loyalty", function(require) { return generate_keypad_steps(amount_str, ".payment-numpad"); } - function generate_product_screen_keypad_steps(amount_str) { - return generate_keypad_steps(amount_str, ".numpad"); - } - function verify_order_total(total_str) { return [ { content: "order total contains " + total_str, trigger: '.order .total .value:contains("' + total_str + '")', - run: function() {}, // It's a check + run: function() {}, }, ]; } @@ -131,13 +129,13 @@ odoo.define("pos_loyalty.tour.test_pos_loyalty", function(require) { { content: "verify that the order is being sent to the backend", trigger: ".js_connecting:visible", - run: function() {}, // It's a check + run: function() {}, }, { content: "verify that the order has been succesfully sent to the backend", trigger: ".js_connected:visible", - run: function() {}, // It's a check + run: function() {}, }, { content: "next order", @@ -149,8 +147,8 @@ odoo.define("pos_loyalty.tour.test_pos_loyalty", function(require) { var steps = [ { content: "waiting for loading to finish", - trigger: ".o_main_content:has(.loader:hidden)", - run: function() {}, // It's a check + trigger: ".loader:hidden", + run: function() {}, }, ]; @@ -158,7 +156,7 @@ odoo.define("pos_loyalty.tour.test_pos_loyalty", function(require) { steps = steps.concat(add_product_to_order("Peaches")); steps = steps.concat(verify_order_total("5.10")); - steps = steps.concat(add_product_to_order("Peaches")); // Buy another kg of peaches + steps = steps.concat(add_product_to_order("Peaches")); steps = steps.concat(verify_order_total("10.20")); steps = steps.concat(goto_payment_screen_and_select_payment_method()); steps = steps.concat(generate_payment_screen_keypad_steps("12.20")); @@ -167,12 +165,12 @@ odoo.define("pos_loyalty.tour.test_pos_loyalty", function(require) { { content: "verify tendered", trigger: '.col-tendered:contains("12.20")', - run: function() {}, // It's a check + run: function() {}, }, { content: "verify change", trigger: '.col-change:contains("2.00")', - run: function() {}, // It's a check + run: function() {}, }, ]); @@ -190,8 +188,8 @@ odoo.define("pos_loyalty.tour.test_pos_loyalty", function(require) { steps = [ { content: "waiting for loading to finish", - trigger: ".o_main_content:has(.loader:hidden)", - run: function() {}, // It's a check + trigger: ".loader:hidden", + run: function() {}, }, ]; steps = steps.concat(add_customer("Agrolait")); @@ -203,7 +201,7 @@ odoo.define("pos_loyalty.tour.test_pos_loyalty", function(require) { { content: "verify tendered", trigger: '.col-tendered:contains("0.00")', - run: function() {}, // It's a check + run: function() {}, }, ]); steps = steps.concat(finish_order()); diff --git a/pos_loyalty/views/loyalty_program_view.xml b/pos_loyalty/views/loyalty_program_view.xml index 447557756d..48cb88af4c 100644 --- a/pos_loyalty/views/loyalty_program_view.xml +++ b/pos_loyalty/views/loyalty_program_view.xml @@ -59,7 +59,6 @@ Loyalty Programs ir.actions.act_window loyalty.program - form tree,form

diff --git a/pos_loyalty/views/res_partner_view.xml b/pos_loyalty/views/res_partner_view.xml index e1f025d66a..6a1004fe6b 100644 --- a/pos_loyalty/views/res_partner_view.xml +++ b/pos_loyalty/views/res_partner_view.xml @@ -11,10 +11,11 @@ type="action" name="%(point_of_sale.action_pos_pos_form)d" context="{'search_default_partner_id': active_id,'default_partner_id': active_id}" - attrs="{'invisible': ['|', ('customer', '=', False), ('pos_order_count', '=', 0)]}" + attrs="{'invisible': ['|', ('customer_rank', '=', 0), ('pos_order_count', '=', 0)]}" icon="fa-star" > +