Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pos_category_multi/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Maintainers

To get a guaranteed support
you are kindly requested to purchase the module
at `odoo apps store <https://apps.odoo.com/apps/modules/10.0/pos_category_multi/>`__.
at `odoo apps store <https://apps.odoo.com/apps/modules/11.0/pos_category_multi/>`__.

Thank you for understanding!

Expand All @@ -45,7 +45,6 @@ Usage instructions: `<doc/index.rst>`_

Changelog: `<doc/changelog.rst>`_

Notifications on updates: `via Atom <https://github.com/it-projects-llc/pos-addons/commits/10.0/pos_category_multi.atom>`_, `by Email <https://blogtrottr.com/?subscribe=https://github.com/it-projects-llc/pos-addons/commits/10.0/pos_category_multi.atom>`_
Notifications on updates: `via Atom <https://github.com/it-projects-llc/pos-addons/commits/11.0/pos_category_multi.atom>`_, `by Email <https://blogtrottr.com/?subscribe=https://github.com/it-projects-llc/pos-addons/commits/11.0/pos_category_multi.atom>`_

Tested on Odoo 11.0 ee2b9fae3519c2494f34dacf15d0a3b5bd8fbd06

13 changes: 13 additions & 0 deletions pos_category_multi/__init__.py
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)]
})
12 changes: 11 additions & 1 deletion pos_category_multi/__manifest__.py
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]",
Expand All @@ -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,

}
5 changes: 5 additions & 0 deletions pos_category_multi/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Updates
=======

`1.1.1`
-------

**Improvement:** After install updates categories for product if there were any

`1.0.1`
-------

Expand Down
4 changes: 2 additions & 2 deletions pos_debt_notebook/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ Sponsors
Further information
===================

Demo: http://runbot.it-projects.info/demo/pos-addons/9.0
Demo: http://runbot.it-projects.info/demo/pos-addons/11.0

HTML Description: https://apps.odoo.com/apps/modules/9.0/pos_debt_notebook/
HTML Description: https://apps.odoo.com/apps/modules/11.0/pos_debt_notebook/

Usage instructions: `<doc/index.rst>`__

Expand Down
227 changes: 208 additions & 19 deletions pos_debt_notebook/static/src/js/test_pos_debt.js
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"]',
Expand All @@ -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,
Expand All @@ -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',
Expand All @@ -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()
);
}
// 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)
);
}
// 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)
);
}
// 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()
);
}
// 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()
);
}
// 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"),
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Author

Choose a reason for hiding this comment

The 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()
);
}

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);

});
Loading