summaryrefslogtreecommitdiff
path: root/addons/lunch/tests/common.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/lunch/tests/common.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/lunch/tests/common.py')
-rw-r--r--addons/lunch/tests/common.py75
1 files changed, 75 insertions, 0 deletions
diff --git a/addons/lunch/tests/common.py b/addons/lunch/tests/common.py
new file mode 100644
index 00000000..61e75d3d
--- /dev/null
+++ b/addons/lunch/tests/common.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo.tests import common
+
+
+class TestsCommon(common.TransactionCase):
+
+ def setUp(self):
+ super(TestsCommon, self).setUp()
+
+ self.location_office_1 = self.env['lunch.location'].create({
+ 'name' : 'Farm 1',
+ })
+
+ self.location_office_2 = self.env['lunch.location'].create({
+ 'name': 'Farm 2',
+ })
+
+ self.partner_pizza_inn = self.env['res.partner'].create({
+ 'name': 'Pizza Inn',
+ })
+
+ self.supplier_pizza_inn = self.env['lunch.supplier'].create({
+ 'partner_id': self.partner_pizza_inn.id,
+ 'send_by': 'mail',
+ 'automatic_email_time': 11,
+ 'available_location_ids': [
+ (6, 0, [self.location_office_1.id, self.location_office_2.id])
+ ],
+ })
+
+ self.partner_coin_gourmand = self.env['res.partner'].create({
+ 'name': 'Coin Gourmand',
+ })
+
+ self.supplier_coin_gourmand = self.env['lunch.supplier'].create({
+ 'partner_id': self.partner_coin_gourmand.id,
+ 'send_by': 'phone',
+ 'available_location_ids': [
+ (6, 0, [self.location_office_1.id, self.location_office_2.id])
+ ],
+ })
+
+ self.category_pizza = self.env['lunch.product.category'].create({
+ 'name': 'Pizza',
+ })
+
+ self.category_sandwich = self.env['lunch.product.category'].create({
+ 'name': 'Sandwich',
+ })
+
+ self.product_pizza = self.env['lunch.product'].create({
+ 'name': 'Pizza',
+ 'category_id': self.category_pizza.id,
+ 'price': 9,
+ 'supplier_id': self.supplier_pizza_inn.id,
+ })
+
+ self.product_sandwich_tuna = self.env['lunch.product'].create({
+ 'name': 'Tuna Sandwich',
+ 'category_id': self.category_sandwich.id,
+ 'price': 3,
+ 'supplier_id': self.supplier_coin_gourmand.id,
+ })
+
+ self.topping_olives = self.env['lunch.topping'].create({
+ 'name': 'Olives',
+ 'price': 0.3,
+ 'category_id': self.category_pizza.id,
+ })
+
+ self.env['lunch.cashmove'].create({
+ 'amount': 100,
+ })