Skip to content

Commit

Permalink
[MIG] Migrate module pos_loyalty to v13.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsolanki-initos committed Jan 19, 2022
1 parent e023a00 commit 21abcca
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 25 deletions.
1 change: 1 addition & 0 deletions pos_loyalty/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Contributors
* RGB Consulting SL (http://www.rgbconsulting.com)
* Forward-port from Odoo SA saas-6 branch
* Kiril Vangelovski <kiril@lambda-is.com>
* Dhara Solanki <dhara.solanki@initos.com>

Maintainers
~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion pos_loyalty/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, "
Expand Down
3 changes: 0 additions & 3 deletions pos_loyalty/models/loyalty_reward.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions pos_loyalty/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* RGB Consulting SL (http://www.rgbconsulting.com)
* Forward-port from Odoo SA saas-6 branch
* Kiril Vangelovski <kiril@lambda-is.com>
* Dhara Solanki <dhara.solanki@initos.com>
1 change: 0 additions & 1 deletion pos_loyalty/static/src/js/pos.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
34 changes: 16 additions & 18 deletions pos_loyalty/static/src/js/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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() {},
},
];
}
Expand All @@ -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() {},
},
];
}
Expand All @@ -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() {},
},
];
}
Expand Down Expand Up @@ -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() {},
},
];
}
Expand All @@ -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",
Expand All @@ -149,16 +147,16 @@ 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() {},
},
];

steps = steps.concat(add_customer("Agrolait"));
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"));
Expand All @@ -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() {},
},
]);

Expand All @@ -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"));
Expand All @@ -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());
Expand Down
1 change: 0 additions & 1 deletion pos_loyalty/views/loyalty_program_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
<field name="name">Loyalty Programs</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">loyalty.program</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Expand Down
3 changes: 2 additions & 1 deletion pos_loyalty/views/res_partner_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
>
<field name="loyalty_points" widget="statinfo" />
<field name="customer_rank" invisible="1" />
</button>
</button>
</field>
Expand Down

0 comments on commit 21abcca

Please sign in to comment.