| 1 |
|
| 2 |
|
| 3 |
from odoo.addons.account.tests.common import AccountTestInvoicingHttpCommon |
| 4 |
|
| 5 |
|
| 6 |
class TestPosQrCommon(AccountTestInvoicingHttpCommon): |
| 7 |
|
| 8 |
@classmethod |
| 9 |
def setUpClass(cls): |
| 10 |
super().setUpClass() |
| 11 |
cls.company_data['company'].qr_code = True |
| 12 |
|
| 13 |
cls.env['product.combo.item'].search([]).unlink() |
| 14 |
cls.env['product.product'].search([]).write({'available_in_pos': False}) |
| 15 |
|
| 16 |
cls.product_1 = cls.env['product.product'].create({ |
| 17 |
'name': 'Hand Bag', |
| 18 |
'available_in_pos': True, |
| 19 |
'list_price': 4.8, |
| 20 |
'taxes_id': False, |
| 21 |
}) |
| 22 |
|
| 23 |
|
| 24 |
cls.pos_user = cls.env['res.users'].create({ |
| 25 |
'name': 'A simple PoS man!', |
| 26 |
'login': 'pos_user', |
| 27 |
'password': 'pos_user', |
| 28 |
'group_ids': [ |
| 29 |
(4, cls.env.ref('base.group_user').id), |
| 30 |
(4, cls.env.ref('point_of_sale.group_pos_user').id), |
| 31 |
(4, cls.env.ref('account.group_account_invoice').id), |
| 32 |
], |
| 33 |
}) |
| 34 |
|
| 35 |
cls.company = cls.company_data['company'] |
| 36 |
cls.pos_receivable_bank = cls.copy_account(cls.company.account_default_pos_receivable_account_id, {'name': 'POS Receivable Bank'}) |
| 37 |
cls.outstanding_bank = cls.copy_account(cls.inbound_payment_method_line.payment_account_id, {'name': 'Outstanding Bank'}) |
| 38 |
cls.bank_pm = cls.env['pos.payment.method'].sudo().create({ |
| 39 |
'name': 'Bank', |
| 40 |
'journal_id': cls.company_data['default_journal_bank'].id, |
| 41 |
'receivable_account_id': cls.pos_receivable_bank.id, |
| 42 |
'outstanding_account_id': cls.outstanding_bank.id, |
| 43 |
'company_id': cls.company.id, |
| 44 |
}) |
| 45 |
|
| 46 |
cls.main_pos_config = cls.env['pos.config'].sudo().create({ |
| 47 |
'name': 'Shop', |
| 48 |
'module_pos_restaurant': False, |
| 49 |
'journal_id': cls.company_data['default_journal_sale'].id, |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
'payment_method_ids': [(4, cls.bank_pm.id)] |
| 54 |
}) |