From 453f957d8d15d925009830d9d5f4f83bf688b604 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Sun, 19 Aug 2018 19:26:46 +0000 Subject: [PATCH] [ADD] point_of_sale: js test for 2m fp --- addons/point_of_sale/static/src/js/tests.js | 20 ++++++++++++++++++++ addons/point_of_sale/static/src/xml/pos.xml | 2 +- addons/point_of_sale/tests/test_frontend.py | 15 +++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/tests.js b/addons/point_of_sale/static/src/js/tests.js index 2048d3d8271..59738e08179 100644 --- a/addons/point_of_sale/static/src/js/tests.js +++ b/addons/point_of_sale/static/src/js/tests.js @@ -230,6 +230,20 @@ odoo.define('point_of_sale.tour.acceptance', function (require) { }]; } + function set_fiscal_position_on_order(fp_name) { + return [{ + content: 'set fiscal position', + trigger: '.control-button.o_fiscal_position_button', + }, { + content: 'choose fiscal position ' + fp_name + ' to add to the order', + trigger: '.popups .popup .selection .selection-item:contains("' + fp_name + '")', + }, { + content: 'the fiscal position ' + fp_name + ' has been set to the order', + trigger: '.control-button.o_fiscal_position_button:contains("' + fp_name + '")', + run: function () {}, // it's a check + }]; + } + function generate_keypad_steps(amount_str, keypad_selector) { var i, steps = [], current_char; for (i = 0; i < amount_str.length; ++i) { @@ -321,6 +335,12 @@ odoo.define('point_of_sale.tour.acceptance', function (require) { steps = steps.concat(generate_payment_screen_keypad_steps("10")); steps = steps.concat(finish_order()); + // Test fiscal position one2many map (align with backend) + steps = steps.concat(add_product_to_order('Letter Tray')); + steps = steps.concat(verify_order_total('5.28')); + steps = steps.concat(set_fiscal_position_on_order('FP-POS-2M')); + steps = steps.concat(verify_order_total('5.52')); + steps = steps.concat([{ content: "close the Point of Sale frontend", trigger: ".header-button", diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index fcfc7981155..d427f310b7f 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -124,7 +124,7 @@ -
+
diff --git a/addons/point_of_sale/tests/test_frontend.py b/addons/point_of_sale/tests/test_frontend.py index 4cbb3e79996..6e178919ed3 100644 --- a/addons/point_of_sale/tests/test_frontend.py +++ b/addons/point_of_sale/tests/test_frontend.py @@ -265,7 +265,22 @@ class TestUi(odoo.tests.HttpCase): all_pricelists = env['product.pricelist'].search([('id', '!=', excluded_pricelist.id)]) all_pricelists.write(dict(currency_id=main_company.currency_id.id)) + src_tax = env['account.tax'].create({'name': "SRC", 'amount': 10}) + dst_tax = env['account.tax'].create({'name': "DST", 'amount': 5}) + + env.ref('point_of_sale.letter_tray').taxes_id = [(6, 0, [src_tax.id])] + + main_pos_config.write({ + 'tax_regime_selection': True, + 'fiscal_position_ids': [(0, 0, { + 'name': "FP-POS-2M", + 'tax_ids': [ + (0,0,{'tax_src_id': src_tax.id, + 'tax_dest_id': src_tax.id}), + (0,0,{'tax_src_id': src_tax.id, + 'tax_dest_id': dst_tax.id})] + })], 'journal_id': test_sale_journal.id, 'invoice_journal_id': test_sale_journal.id, 'journal_ids': [(0, 0, {'name': 'Cash Journal - Test',