-
-
Notifications
You must be signed in to change notification settings - Fork 585
pos_debt_notebook unit-tour-test #1104
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
Open
fedoranvar
wants to merge
3
commits into
itpp-labs:11.0
Choose a base branch
from
fedoranvar:11.0-pos_debt_notebook-tour
base: 11.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
# Copyright 2019 Anvar kildebekov <https://it-projects.info/team/fedoranvar> | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). | ||
|
||
from . import models | ||
|
||
from odoo import SUPERUSER_ID | ||
from odoo import api | ||
|
||
def copy_categories(cr, registry): | ||
env = api.Environment(cr, SUPERUSER_ID, {}) | ||
for product in list(env["product.template"].search([])): | ||
if product.pos_categ_id: | ||
product.write({ | ||
'pos_category_ids': [(4, product.pos_categ_id.id)] | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
# Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> | ||
# Copyright 2019 Anvar Kildebekov <https://it-projects.info/team/fedoranvar> | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
|
||
{ | ||
"name": """Multiple categories per product in POS""", | ||
"summary": """Specify as many categories for a product as you need""", | ||
"category": "Point of Sale", | ||
"version": "11.0.1.0.1", | ||
"version": "11.0.1.1.1", | ||
"images": [], | ||
"author": "IT-Projects LLC, Pavel Romanchenko", | ||
"support": "[email protected]", | ||
|
@@ -22,4 +26,10 @@ | |
"demo": [], | ||
"installable": True, | ||
"auto_install": False, | ||
|
||
"post_load": None, | ||
"pre_init_hook": None, | ||
"post_init_hook": 'copy_categories', | ||
"uninstall_hook": None, | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
odoo.define('pos_debt_notebook.tour', function (require) { | ||
/* Copyright 2019 Anvar Kildebekov <https://it-projects.info/team/fedoranvar> | ||
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). */ | ||
odoo.define('pos_debt_notebook.tour', function (require) { | ||
"use strict"; | ||
|
||
var tour = require("web_tour.tour"); | ||
var core = require('web.core'); | ||
var _t = core._t; | ||
|
||
/* -----Actions----- */ | ||
function open_pos_neworder() { | ||
return [{ | ||
trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"], .oe_menu_toggler[data-menu-xmlid="point_of_sale.menu_point_root"]', | ||
|
@@ -19,12 +22,14 @@ odoo.define('pos_debt_notebook.tour', function (require) { | |
trigger: '.table:not(.oe_invisible .neworder-button), .order-button.selected', | ||
position: "bottom", | ||
timeout: 20000, | ||
}, { | ||
content: 'waiting for loading to finish', | ||
}]; | ||
} | ||
function create_new_order() { | ||
return [{ | ||
content: 'Create new order', | ||
trigger: '.order-button.neworder-button', | ||
}]; | ||
} | ||
|
||
function add_product_to_order(product_name) { | ||
return [{ | ||
content: 'buy ' + product_name, | ||
|
@@ -34,22 +39,36 @@ odoo.define('pos_debt_notebook.tour', function (require) { | |
trigger: '.order .product-name:contains("' + product_name + '")', | ||
}]; | ||
} | ||
|
||
function switch_table() { | ||
return [{ | ||
content: "Switch to table or make dummy action", | ||
trigger: '.table:not(.oe_invisible .neworder-button), .order-button.selected', | ||
position: "bottom", | ||
}]; | ||
} | ||
function set_customer(name) { | ||
return [{ | ||
trigger: '.button.set-customer', | ||
trigger: '.button.js_set_customer', | ||
content: _t("Open the customer screen"), | ||
}, { | ||
trigger: 'td:contains("' + name + '")', | ||
trigger: 'td:contains(' + name + ')', | ||
content: _t("Click the customer"), | ||
}, { | ||
extra_trigger: '.button.next.highlight:contains("Set Customer")', | ||
trigger: '.button.next.highlight:contains("Set Customer")', | ||
content: 'Set Customer', | ||
}]; | ||
} | ||
|
||
function debt_method_paying(pay_method) { | ||
function deselect_customer() { | ||
return [{ | ||
trigger: '.button.js_set_customer', | ||
content: _t("Open the customer screen"), | ||
}, { | ||
trigger: '.button:contains("Deselect")', | ||
content: _t("Deselect the customer"), | ||
}]; | ||
} | ||
function click_to_payment() { | ||
return [{ | ||
content: "Make a dummy action", | ||
trigger: '.order-button.selected', | ||
|
@@ -59,27 +78,197 @@ odoo.define('pos_debt_notebook.tour', function (require) { | |
}, { | ||
content: "Choose Administrator like a cashier or make a dummy action", | ||
trigger: '.modal-dialog.cashier:not(.oe_hidden) .cashier .selection-item:contains("Administrator"), .payment-screen:not(.oe_hidden) h1:contains("Payment")', | ||
}, { | ||
}]; | ||
} | ||
function debt_method_paying(pay_method) { | ||
return [{ | ||
extra_trigger: '.button.paymentmethod:contains("' + pay_method +'")', | ||
trigger: '.button.paymentmethod:contains("' + pay_method +'")', | ||
content: _t("Click the payment method"), | ||
}, { | ||
}]; | ||
} | ||
function validate_order() { | ||
return [{ | ||
extra_trigger: '.button.next.highlight:contains("Validate")', | ||
trigger: '.button.next.highlight:contains("Validate")', | ||
content: 'Validate payment', | ||
}, { | ||
extra_trigger: '.pos-sale-ticket', | ||
trigger: '.button.next.highlight:contains("Next Order")', | ||
content: 'Check proceeded validation', | ||
}]; | ||
} | ||
function close_error_modal_dialog(message) { | ||
return [{ | ||
trigger: '.popup>.body:contains("' + message +'")', | ||
content: _t("check error-message"), | ||
},{ | ||
trigger: '.modal-dialog .button:contains("Ok")', | ||
content: _t("Close alert-dialog"), | ||
}]; | ||
} | ||
function click_numpad_input(char) { | ||
return [{ | ||
trigger: '.input-button:contains("' + char +'")', | ||
content: _t("Click input on numpad"), | ||
}]; | ||
} | ||
function next_order(){ | ||
return [{ | ||
trigger: '.button.next', | ||
content: _t("Next order"), | ||
}]; | ||
} | ||
function set_numpad_value(value) { | ||
var steps = []; | ||
for (var i = 0; i < value.length; i++) { | ||
steps = steps.concat(click_numpad_input(value.charAt(i))); | ||
} | ||
return steps; | ||
} | ||
function remove_paymentline(){ | ||
return [{ | ||
trigger: '.paymentline>.delete-button', | ||
content: _t("delete selected payment-line"), | ||
}]; | ||
} | ||
function click_autopay_button(){ | ||
return [{ | ||
trigger: '.autopay', | ||
content: _t("click autopay-button"), | ||
}]; | ||
} | ||
/* -----Scenarios----- */ | ||
// Initial Test "Pay with all credit-journal" | ||
function initial_scene(steps, client) { | ||
return steps.concat( | ||
create_new_order(), | ||
add_product_to_order('Lemon'), | ||
click_to_payment(), | ||
set_customer(client), | ||
debt_method_paying('Credits (USD)'), | ||
set_numpad_value("1"), | ||
debt_method_paying('Credits (Fruits & Vegetables only) (USD)'), | ||
set_numpad_value("1"), | ||
debt_method_paying('Credits (via discounts) (USD)'), | ||
validate_order(), | ||
next_order(), | ||
switch_table() | ||
); | ||
fedoranvar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
// Error: "You cannot use Debt payment. Select customer first." | ||
function scene_1(steps, client, err_msg) { | ||
return steps.concat( | ||
create_new_order(), | ||
add_product_to_order("Miscellaneous"), | ||
click_to_payment(), | ||
set_customer(client), | ||
debt_method_paying('Credits (USD)'), | ||
deselect_customer(), | ||
validate_order(), | ||
close_error_modal_dialog(err_msg) | ||
); | ||
fedoranvar marked this conversation as resolved.
Show resolved
Hide resolved
fedoranvar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
// Error: "You cannot sell products on credit to the customer because his max debt value will be exceeded." | ||
function scene_2(steps, client, err_msg) { | ||
return steps.concat( | ||
create_new_order(), | ||
add_product_to_order("Miscellaneous"), | ||
click_to_payment(), | ||
set_customer(client), | ||
debt_method_paying('Credits (USD)'), | ||
set_numpad_value("10000"), | ||
validate_order(), | ||
close_error_modal_dialog(err_msg) | ||
); | ||
fedoranvar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
// Scenario: Increase credit amount | ||
function scene_3(steps, client) { | ||
return steps.concat( | ||
create_new_order(), | ||
add_product_to_order("Pay Debt"), | ||
click_to_payment(), | ||
set_customer(client), | ||
debt_method_paying('Cash (USD)'), | ||
set_numpad_value("4"), | ||
debt_method_paying('Credits (USD)'), | ||
validate_order(), | ||
next_order(), | ||
switch_table() | ||
); | ||
fedoranvar marked this conversation as resolved.
Show resolved
Hide resolved
fedoranvar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
// Scenario: Transfer money from Credit to Credit (Fruit&Vegetables only) | ||
function scene_4(steps, client) { | ||
return steps.concat( | ||
create_new_order(), | ||
add_product_to_order("Pay Debt"), | ||
click_to_payment(), | ||
set_customer(client), | ||
debt_method_paying('Credits (USD)'), | ||
set_numpad_value("2"), | ||
debt_method_paying('Credits (Fruits & Vegetables only) (USD)'), | ||
validate_order(), | ||
next_order(), | ||
switch_table() | ||
); | ||
fedoranvar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
// Error: "Please enter the exact or lower debt amount than the cost of the order" | ||
function scene_5(steps, client, err_msg) { | ||
return steps.concat( | ||
create_new_order(), | ||
add_product_to_order("Pay Debt"), | ||
click_to_payment(), | ||
set_customer(client), | ||
debt_method_paying('Credits (Fruits & Vegetables only) (USD)'), | ||
set_numpad_value("1"), | ||
debt_method_paying('Credits (USD)'), | ||
validate_order(), | ||
close_error_modal_dialog(err_msg) | ||
); | ||
} | ||
// Error: "You may only buy Fruits and Vegetables with Credits (Fruits & Vegetables only) (USD)" | ||
function scene_6(steps, client, err_msg) { | ||
return steps.concat( | ||
create_new_order(), | ||
add_product_to_order("Miscellaneous"), | ||
click_to_payment(), | ||
set_customer(client), | ||
remove_paymentline(), | ||
debt_method_paying('Credits (Fruits & Vegetables only) (USD)'), | ||
set_numpad_value("1"), | ||
validate_order(), | ||
close_error_modal_dialog(err_msg) | ||
); | ||
} | ||
// Scenario: Proceed order with autopay-button (bottom-left corner) | ||
function scene_7(steps, client) { | ||
return steps.concat( | ||
create_new_order(), | ||
add_product_to_order("Miscellaneous"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do not do those repetitive steps, you can change prices for some particular products in python before tours start and save some time on it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
click_to_payment(), | ||
set_customer(client), | ||
remove_paymentline(), | ||
debt_method_paying('Credits (via discounts) (USD)'), | ||
set_numpad_value("1"), | ||
click_autopay_button(), | ||
click_autopay_button() | ||
); | ||
fedoranvar marked this conversation as resolved.
Show resolved
Hide resolved
fedoranvar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
var steps = []; | ||
var client = "Agrolait"; | ||
var err_msgs = [ | ||
"You cannot use Debt payment. Select customer first.", | ||
"You cannot sell products on credit journal Credits (USD) to the customer because its max debt value will be exceeded.", | ||
"Please enter the exact or lower debt amount than the cost of the order.", | ||
"You may only buy Fruits and Vegetables with Credits (Fruits & Vegetables only) (USD)", | ||
]; | ||
|
||
steps = steps.concat(open_pos_neworder()); | ||
steps = steps.concat(add_product_to_order('Miscellaneous')); | ||
steps = steps.concat(set_customer('Agrolait')); | ||
steps = steps.concat(debt_method_paying('Credits (USD)')); | ||
steps = initial_scene(steps, client); | ||
steps = scene_1(steps, client, err_msgs[0]); | ||
steps = scene_2(steps, client, err_msgs[1]); | ||
steps = scene_3(steps, client); | ||
steps = scene_4(steps, client); | ||
steps = scene_5(steps, client, err_msgs[2]); | ||
steps = scene_6(steps, client, err_msgs[3]); | ||
steps = scene_7(steps, client); | ||
|
||
tour.register('tour_pos_debt_notebook', { test: true, url: '/web' }, steps); | ||
|
||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.