[ADD] point_of_sale: js test for 2m fp

This commit is contained in:
David Arnold
2018-09-18 21:18:46 +00:00
parent 202ed1bf7d
commit 453f957d8d
3 changed files with 36 additions and 1 deletions
@@ -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",
+1 -1
View File
@@ -124,7 +124,7 @@
</t>
<t t-name="SetFiscalPositionButton">
<div class='control-button'>
<div class='control-button o_fiscal_position_button'>
<i class='fa fa-book' role="img" aria-label="Set fiscal position" title="Set fiscal position"/> <t t-esc='widget.get_current_fiscal_position_name()'/>
</div>
</t>
@@ -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',