Debian Codegraph @

addons/website_event_booth_sale/tests/test_event_booth_sale.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2 # Part of Odoo. See LICENSE file for full copyright and licensing details.
3
4 from datetime import datetime, timedelta
5
6 from odoo import Command, fields
7 from odoo.addons.website_event_sale.tests.common import TestWebsiteEventSaleCommon
8 from odoo.addons.base.tests.common import HttpCaseWithUserPortal
9 from odoo.tests.common import tagged
10
11
12
13 @tagged('post_install', '-at_install')
14 class TestWebsiteEventBoothSale(HttpCaseWithUserPortal, TestWebsiteEventSaleCommon):
15
16 @classmethod
17 def setUpClass(cls):
18 super().setUpClass()
19 cls.env['website'].sudo().search([]).show_line_subtotals_tax_selection = 'tax_included'
20 cls.tax = cls.env['account.tax'].sudo().create({
21 'name': 'Tax 10',
22 'amount': 10,
23 })
24 cls.booth_product = cls.env['product.product'].create({
25 'name': 'Test Booth Product',
26 'description_sale': 'Mighty Booth Description',
27 'list_price': 20,
28 'standard_price': 60.0,
29 'taxes_id': [(6, 0, [cls.tax.id])],
30 'type': 'service',
31 'service_tracking': 'event_booth',
32 })
33 cls.event_booth_category = cls.env['event.booth.category'].create({
34 'name': 'Standard',
35 'description': '<p>Standard</p>',
36 'product_id': cls.booth_product.id,
37 'price': 100.0,
38 })
39 cls.event_type = cls.env['event.type'].create({
40 'name': 'Booth Type',
41 'event_type_booth_ids': [
42 Command.create({
43 'name': 'Standard 1',
44 'booth_category_id': cls.event_booth_category.id,
45 }),
46 Command.create({
47 'name': 'Standard 2',
48 'booth_category_id': cls.event_booth_category.id,
49 }),
50 Command.create({
51 'name': 'Standard 3',
52 'booth_category_id': cls.event_booth_category.id,
53 }),
54 ],
55 })
56 cls.env['event.event'].create({
57 'name': 'Test Event Booths',
58 'event_type_id': cls.event_type.id,
59 'date_begin': fields.Datetime.to_string(datetime.today() + timedelta(days=1)),
60 'date_end': fields.Datetime.to_string(datetime.today() + timedelta(days=15)),
61 'website_published': True,
62 'website_menu': True,
63 'booth_menu': True,
64 })
65
66 def test_tour(self):
67 self.env['product.pricelist'].sudo().search([]).action_archive()
68 self.partner_portal.write({
69 'street': '858 Lynn Street',
70 'city': 'Bayonne',
71 'country_id': self.env.ref('base.state_us_25').id,
72 'zip': '07002',
73 'phone': '(683)-556-5104',
74 })
75 self.start_tour('/event', 'website_event_booth_tour', login='portal')
76
77 def test_booth_pricelists_different_currencies(self):
78 self.env.ref('base.user_admin').partner_id.write({
79 'email': '[email protected]',
80 'name': 'Mitchell Admin',
81 'street': '215 Vine St',
82 'city': 'Scranton',
83 'zip': '18503',
84 'country_id': self.env.ref('base.us').id,
85 'state_id': self.env.ref('base.state_us_39').id,
86 'phone': '+1 555-555-5555',
87 })
88 self.start_tour("/odoo", 'event_booth_sale_pricelists_different_currencies', login='admin')