[FIX] point_of_sale,pos_*: launch test with demo user

Before the PoS tours were mainly run with the `accountman` user, which
did not allow us to have a clear view of the permissions required for
each function of the Point of Sale.

Now, two users have been created for the PoS:
- `pos_user`
- `pos_admin`

The first one has no particular permission, he is a normal user of the
Point of Sale and Odoo, the second one is an administrator of the Odoo
application.

If the user `pos_user` is used and some permissions are missing in a
tour, these are added to the user with starting the test.

closes odoo/odoo#120380

Related: odoo/enterprise#40656
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
David Monnom (moda)
2023-05-15 13:59:09 +02:00
parent 96669c74f8
commit cd81cc64ed
5 changed files with 160 additions and 72 deletions
+64 -31
View File
@@ -31,6 +31,28 @@ class TestPointOfSaleHttpCommon(AccountTestInvoicingHttpCommon):
# Pricelists are set below, do not take demo data into account
env['ir.property'].sudo().search([('name', '=', 'property_product_pricelist')]).unlink()
# Create user.
cls.pos_user = cls.env['res.users'].create({
'name': 'A simple PoS man!',
'login': 'pos_user',
'password': 'pos_user',
'groups_id': [
(4, cls.env.ref('base.group_user').id),
(4, cls.env.ref('point_of_sale.group_pos_user').id),
],
})
cls.pos_admin = cls.env['res.users'].create({
'name': 'A powerfull PoS man!',
'login': 'pos_admin',
'password': 'pos_admin',
'groups_id': [
(4, cls.env.ref('point_of_sale.group_pos_manager').id),
],
})
cls.pos_user.partner_id.email = 'pos_user@test.com'
cls.pos_admin.partner_id.email = 'pos_admin@test.com'
cls.bank_journal = journal_obj.create({
'name': 'Bank Test',
'type': 'bank',
@@ -487,7 +509,7 @@ class TestUi(TestPointOfSaleHttpCommon):
})
# open a session, the /pos/ui controller will redirect to it
self.main_pos_config.open_ui()
self.main_pos_config.with_user(self.pos_user).open_ui()
# needed because tests are run before the module is marked as
# installed. In js web will only load qweb coming from modules
@@ -495,11 +517,11 @@ class TestUi(TestPointOfSaleHttpCommon):
# this you end up with js, css but no qweb.
self.env['ir.module.module'].search([('name', '=', 'point_of_sale')], limit=1).state = 'installed'
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'pos_pricelist', login="accountman")
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'pos_basic_order', login="accountman")
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'ProductScreenTour', login="accountman")
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenTour', login="accountman")
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'ReceiptScreenTour', login="accountman")
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'pos_pricelist', login="pos_user")
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'pos_basic_order', login="pos_user")
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'ProductScreenTour', login="pos_user")
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenTour', login="pos_user")
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'ReceiptScreenTour', login="pos_user")
for order in self.env['pos.order'].search([]):
self.assertEqual(order.state, 'paid', "Validated order has payment of " + str(order.amount_paid) + " and total of " + str(order.amount_total))
@@ -509,8 +531,14 @@ class TestUi(TestPointOfSaleHttpCommon):
self.assertEqual(email_count, 1)
def test_02_pos_with_invoiced(self):
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'ChromeTour', login="accountman")
self.pos_user.write({
'groups_id': [
(4, self.env.ref('account.group_account_invoice').id),
]
})
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'ChromeTour', login="pos_user")
n_invoiced = self.env['pos.order'].search_count([('state', '=', 'invoiced')])
n_paid = self.env['pos.order'].search_count([('state', '=', 'paid')])
self.assertEqual(n_invoiced, 1, 'There should be 1 invoiced order.')
@@ -518,12 +546,17 @@ class TestUi(TestPointOfSaleHttpCommon):
def test_04_product_configurator(self):
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config, 'ProductConfiguratorTour', login="accountman")
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config, 'ProductConfiguratorTour', login="pos_user")
def test_05_ticket_screen(self):
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'TicketScreenTour', login="accountman")
self.pos_user.write({
'groups_id': [
(4, self.env.ref('account.group_account_invoice').id),
]
})
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'TicketScreenTour', login="pos_user")
def test_fixed_tax_negative_qty(self):
""" Assert the negative amount of a negative-quantity orderline
@@ -559,8 +592,8 @@ class TestUi(TestPointOfSaleHttpCommon):
# Make an order with the zero-amount product from the frontend.
# We need to do this because of the fix in the "compute_all" port.
self.main_pos_config.write({'iface_tax_included': 'total'})
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'FixedTaxNegativeQty', login="accountman")
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'FixedTaxNegativeQty', login="pos_user")
pos_session = self.main_pos_config.current_session_id
# Close the session and check the session journal entry.
@@ -588,8 +621,8 @@ class TestUi(TestPointOfSaleHttpCommon):
'company_id': self.env.company.id,
})
self.main_pos_config.write({'payment_method_ids': [(6, 0, bank_pm.ids)]})
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenTour2', login="accountman")
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenTour2', login="pos_user")
def test_rounding_up(self):
rouding_method = self.env['account.cash.rounding'].create({
@@ -610,8 +643,8 @@ class TestUi(TestPointOfSaleHttpCommon):
'cash_rounding': True,
})
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenRoundingUp', login="accountman")
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenRoundingUp', login="pos_user")
def test_rounding_down(self):
rouding_method = self.env['account.cash.rounding'].create({
@@ -632,9 +665,9 @@ class TestUi(TestPointOfSaleHttpCommon):
'cash_rounding': True,
})
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenRoundingDown', login="accountman")
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenTotalDueWithOverPayment', login="accountman")
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenRoundingDown', login="pos_user")
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenTotalDueWithOverPayment', login="pos_user")
def test_rounding_half_up(self):
rouding_method = self.env['account.cash.rounding'].create({
@@ -669,8 +702,8 @@ class TestUi(TestPointOfSaleHttpCommon):
'cash_rounding': True,
})
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenRoundingHalfUp', login="accountman")
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PaymentScreenRoundingHalfUp', login="pos_user")
def test_pos_closing_cash_details(self):
"""Test if the cash closing details correctly show the cash difference
@@ -684,16 +717,16 @@ class TestUi(TestPointOfSaleHttpCommon):
current_session.post_closing_cash_details(100)
current_session.close_session_from_ui()
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'CashClosingDetails', login="accountman")
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'CashClosingDetails', login="pos_user")
#check accounting move for the pos opening cash difference
pos_session = self.main_pos_config.current_session_id
self.assertEqual(len(pos_session.statement_line_ids), 1)
self.assertEqual(pos_session.statement_line_ids[0].amount, -10)
def test_cash_payments_should_reflect_on_next_opening(self):
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'OrderPaidInCash', login="accountman")
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'OrderPaidInCash', login="pos_user")
def test_fiscal_position_no_tax(self):
#create a tax of 15% with price included
@@ -733,8 +766,8 @@ class TestUi(TestPointOfSaleHttpCommon):
'available_pricelist_ids': [(6, 0, [pricelist.id])],
'pricelist_id': pricelist.id,
})
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'FiscalPositionNoTax', login="accountman")
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'FiscalPositionNoTax', login="pos_user")
def test_06_pos_discount_display_with_multiple_pricelist(self):
""" Test the discount display on the POS screen when multiple pricelists are used."""
@@ -776,8 +809,8 @@ class TestUi(TestPointOfSaleHttpCommon):
'available_pricelist_ids': [(6, 0, [base_pricelist.id, special_pricelist.id])],
})
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'ReceiptScreenDiscountWithPricelistTour', login="accountman")
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'ReceiptScreenDiscountWithPricelistTour', login="pos_user")
# This class just runs the same tests as above but with mobile emulation
class MobileTestUi(TestUi):
+3 -3
View File
@@ -18,7 +18,7 @@ class TestPosHrHttpCommon(TestPointOfSaleHttpCommon):
# Admin employee
admin = cls.env.ref("hr.employee_admin").sudo().copy({
"company_id": cls.env.company.id,
"user_id": cls.env.user.id,
"user_id": cls.pos_admin.id,
"name": "Mitchell Admin",
"pin": False,
})
@@ -52,10 +52,10 @@ class TestPosHrHttpCommon(TestPointOfSaleHttpCommon):
class TestUi(TestPosHrHttpCommon):
def test_01_pos_hr_tour(self):
# open a session, the /pos/ui controller will redirect to it
self.main_pos_config.open_ui()
self.main_pos_config.with_user(self.pos_admin).open_ui()
self.start_tour(
"/pos/ui?config_id=%d" % self.main_pos_config.id,
"PosHrTour",
login="accountman",
login="pos_admin",
)
+72 -23
View File
@@ -17,7 +17,6 @@ class TestUi(TestPointOfSaleHttpCommon):
# Disable any programs during the test
cls.env['loyalty.program'].search([]).write({'active': False})
cls.promo_programs = cls.env["loyalty.program"]
# code promo program -> discount on specific products
@@ -115,7 +114,7 @@ class TestUi(TestPointOfSaleHttpCommon):
'tax_regime_selection': False,
'use_pricelist': False,
})
self.main_pos_config.open_ui()
self.main_pos_config.with_user(self.pos_user).open_ui()
def create_programs(self, details):
"""
@@ -138,11 +137,15 @@ class TestUi(TestPointOfSaleHttpCommon):
# This part will generate coupons for `auto_promo_program_next`
# that will be used in the second part of the tour.
#
self.pos_user.write({
'groups_id': [
(4, self.env.ref('stock.group_stock_user').id),
]
})
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"PosLoyaltyTour1",
login="accountman",
login="pos_user"
)
# check coupon usage
@@ -187,7 +190,7 @@ class TestUi(TestPointOfSaleHttpCommon):
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"PosLoyaltyTour2",
login="accountman",
login="pos_user",
)
# check pos_order_count in each program
self.assertEqual(self.auto_promo_program_current.pos_order_count, 6)
@@ -202,11 +205,18 @@ class TestUi(TestPointOfSaleHttpCommon):
'limit_usage': True,
'max_usage': 1,
})
self.pos_user.write({
'groups_id': [
(4, self.env.ref('stock.group_stock_user').id),
]
})
# First tour check that the promotion is not applied
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"PosLoyaltyValidity1",
login="accountman",
login="pos_user",
)
self.auto_promo_program_current.write({
@@ -217,7 +227,7 @@ class TestUi(TestPointOfSaleHttpCommon):
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"PosLoyaltyValidity2",
login="accountman",
login="pos_user",
)
def test_loyalty_free_product_rewards(self):
@@ -278,10 +288,15 @@ class TestUi(TestPointOfSaleHttpCommon):
(self.promo_programs | self.coupon_program).write({'active': False})
self.pos_user.write({
'groups_id': [
(4, self.env.ref('stock.group_stock_user').id),
]
})
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"PosLoyaltyFreeProductTour",
login="accountman",
login="pos_user",
)
# Keep the tour to generate 4 orders for the free_product and free_other_product programs.
@@ -301,6 +316,12 @@ class TestUi(TestPointOfSaleHttpCommon):
def test_loyalty_free_product_loyalty_program(self):
# In this program, each whiteboard pen gives 1 point.
# 4 points can be used to get a free whiteboard pen.
self.pos_user.write({
'groups_id': [
(4, self.env.ref('stock.group_stock_user').id),
]
})
loyalty_program = self.env['loyalty.program'].create({
'name': 'Buy 4 whiteboard_pen, Take 1 whiteboard_pen',
'program_type': 'loyalty',
@@ -329,7 +350,7 @@ class TestUi(TestPointOfSaleHttpCommon):
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"PosLoyaltyLoyaltyProgram1",
login="accountman",
login="pos_user",
)
aaa_loyalty_card = loyalty_program.coupon_ids.filtered(lambda coupon: coupon.partner_id.id == partner_aaa.id)
@@ -341,7 +362,7 @@ class TestUi(TestPointOfSaleHttpCommon):
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"PosLoyaltyLoyaltyProgram2",
login="accountman",
login="pos_user",
)
self.assertEqual(loyalty_program.pos_order_count, 2, msg='Only 2 orders should have reward lines.')
@@ -424,13 +445,18 @@ class TestUi(TestPointOfSaleHttpCommon):
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"PosLoyaltyTour3",
login="accountman",
login="pos_user",
)
def test_gift_card_program_create_set(self):
"""
Test for gift card program when pos.config.gift_card_settings == 'create_set'.
"""
self.pos_user.write({
'groups_id': [
(4, self.env.ref('stock.group_stock_user').id),
]
})
LoyaltyProgram = self.env['loyalty.program']
# Deactivate all other programs to avoid interference
(LoyaltyProgram.search([])).write({'pos_ok': False})
@@ -444,7 +470,7 @@ class TestUi(TestPointOfSaleHttpCommon):
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"GiftCardProgramCreateSetTour1",
login="accountman",
login="pos_user",
)
# Check that gift cards are created
self.assertEqual(len(gift_card_program.coupon_ids), 1)
@@ -455,7 +481,7 @@ class TestUi(TestPointOfSaleHttpCommon):
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"GiftCardProgramCreateSetTour2",
login="accountman",
login="pos_user",
)
# Check that gift cards are used
self.assertEqual(gift_card_program.coupon_ids.points, 46.8)
@@ -468,6 +494,12 @@ class TestUi(TestPointOfSaleHttpCommon):
- Meaning, it's paid.
- Then it will be scanned for usage.
"""
self.pos_user.write({
'groups_id': [
(4, self.env.ref('stock.group_stock_user').id),
]
})
LoyaltyProgram = self.env['loyalty.program']
# Deactivate all other programs to avoid interference
(LoyaltyProgram.search([])).write({'pos_ok': False})
@@ -487,7 +519,7 @@ class TestUi(TestPointOfSaleHttpCommon):
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"GiftCardProgramScanUseTour",
login="accountman",
login="pos_user",
)
# Check that gift cards are used
self.assertAlmostEqual(gift_card_program.coupon_ids.points, 0, places=2)
@@ -510,11 +542,17 @@ class TestUi(TestPointOfSaleHttpCommon):
# Create test partners
partner_aaa = self.env['res.partner'].create({'name': 'AAAAAAA'})
partner_bbb = self.env['res.partner'].create({'name': 'BBBBBBB'})
self.pos_user.write({
'groups_id': [
(4, self.env.ref('stock.group_stock_user').id),
]
})
# Run the tour to topup ewallets.
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"EWalletProgramTour1",
login="accountman",
login="pos_user",
)
# Check that ewallets are created for partner_aaa.
ewallet_aaa = self.env['loyalty.card'].search([('partner_id', '=', partner_aaa.id), ('program_id', '=', ewallet_program.id)])
@@ -528,7 +566,7 @@ class TestUi(TestPointOfSaleHttpCommon):
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"EWalletProgramTour2",
login="accountman",
login="pos_user",
)
# Check that ewallets are consumed for partner_aaa.
self.assertAlmostEqual(ewallet_aaa.points, 0, places=2)
@@ -557,11 +595,16 @@ class TestUi(TestPointOfSaleHttpCommon):
# Create test partners
partner_aaa = self.env['res.partner'].create({'name': 'AAAAAAA'})
partner_bbb = self.env['res.partner'].create({'name': 'BBBBBBB'})
self.pos_user.write({
'groups_id': [
(4, self.env.ref('stock.group_stock_user').id),
]
})
# Run the tour to topup ewallets.
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"MultipleGiftWalletProgramsTour",
login="accountman",
login="pos_user",
)
# Check the created gift cards.
self.assertEqual(len(programs['gift_card_1'].coupon_ids), 1)
@@ -674,11 +717,17 @@ class TestUi(TestPointOfSaleHttpCommon):
'pricelist_id': pricelist.id,
})
self.main_pos_config2.open_ui()
self.pos_user.write({
'groups_id': [
(4, self.env.ref('stock.group_stock_user').id),
]
})
self.main_pos_config2.with_user(self.pos_user).open_ui()
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config2.id,
"PosLoyaltyTour4",
login="accountman",
login="pos_user",
)
def test_promotion_program_with_global_discount(self):
@@ -758,12 +807,12 @@ class TestUi(TestPointOfSaleHttpCommon):
}
)
self.main_pos_config2.open_ui()
self.main_pos_config2.with_user(self.pos_user).open_ui()
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config2.id,
"PosCouponTour5",
login="accountman",
login="pos_user",
)
def test_loyalty_program_using_same_product(self):
@@ -813,7 +862,7 @@ class TestUi(TestPointOfSaleHttpCommon):
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"PosLoyaltyFreeProductTour2",
login="accountman",
login="pos_user",
)
def test_refund_with_gift_card(self):
@@ -831,5 +880,5 @@ class TestUi(TestPointOfSaleHttpCommon):
self.start_tour(
"/pos/web?config_id=%d" % self.main_pos_config.id,
"GiftCardWithRefundtTour",
login="accountman"
login="pos_user",
)
+13 -13
View File
@@ -168,33 +168,33 @@ class TestFrontend(odoo.tests.HttpCase):
def test_01_pos_restaurant(self):
self.pos_config.with_user(self.env.ref('base.user_admin')).open_ui()
self.pos_config.with_user(self.env.ref('base.user_demo')).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'pos_restaurant_sync', login="admin")
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'pos_restaurant_sync', login="demo")
self.assertEqual(1, self.env['pos.order'].search_count([('amount_total', '=', 4.4), ('state', '=', 'draft')]))
self.assertEqual(1, self.env['pos.order'].search_count([('amount_total', '=', 4.4), ('state', '=', 'paid')]))
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'pos_restaurant_sync_second_login', login="admin")
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'pos_restaurant_sync_second_login', login="demo")
self.assertEqual(0, self.env['pos.order'].search_count([('amount_total', '=', 4.4), ('state', '=', 'draft')]))
self.assertEqual(1, self.env['pos.order'].search_count([('amount_total', '=', 2.2), ('state', '=', 'draft')]))
self.assertEqual(2, self.env['pos.order'].search_count([('amount_total', '=', 4.4), ('state', '=', 'paid')]))
def test_02_others(self):
self.pos_config.with_user(self.env.ref('base.user_admin')).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'SplitBillScreenTour', login="admin")
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'ControlButtonsTour', login="admin")
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'FloorScreenTour', login="admin")
self.pos_config.with_user(self.env.ref('base.user_demo')).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'SplitBillScreenTour', login="demo")
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'ControlButtonsTour', login="demo")
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'FloorScreenTour', login="demo")
def test_04_ticket_screen(self):
self.pos_config.with_user(self.env.ref('base.user_admin')).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'PosResTicketScreenTour', login="admin")
self.pos_config.with_user(self.env.ref('base.user_demo')).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'PosResTicketScreenTour', login="demo")
def test_05_tip_screen(self):
self.pos_config.write({'set_tip_after_payment': True, 'iface_tipproduct': True, 'tip_product_id': self.env.ref('point_of_sale.product_product_tip')})
self.pos_config.with_user(self.env.ref('base.user_admin')).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'PosResTipScreenTour', login="admin")
self.pos_config.with_user(self.env.ref('base.user_demo')).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'PosResTipScreenTour', login="demo")
order1 = self.env['pos.order'].search([('pos_reference', 'ilike', '%-0001')])
order2 = self.env['pos.order'].search([('pos_reference', 'ilike', '%-0002')])
@@ -209,5 +209,5 @@ class TestFrontend(odoo.tests.HttpCase):
self.assertTrue(order5.is_tipped and order5.tip_amount == 0.00)
def test_06_split_bill_screen(self):
self.pos_config.with_user(self.env.ref('base.user_admin')).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'SplitBillScreenTour2', login="admin")
self.pos_config.with_user(self.env.ref('base.user_demo')).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'SplitBillScreenTour2', login="demo")
+8 -2
View File
@@ -61,8 +61,14 @@ class TestPoSSale(TestPointOfSaleHttpCommon):
self.assertEqual(sale_order.order_line.qty_delivered, 1)
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PosSettleOrder', login="accountman")
self.pos_user.write({
'groups_id': [
(4, self.env.ref('stock.group_stock_user').id),
(4, self.env.ref('sales_team.group_sale_salesman_all_leads').id),
]
})
self.main_pos_config.with_user(self.pos_user).open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PosSettleOrder', login="pos_user")
#assert that sales order qty are correctly updated
self.assertEqual(sale_order.order_line.qty_delivered, 3)