File: common.py

package info (click to toggle)
odoo 18.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 878,716 kB
  • sloc: javascript: 927,937; python: 685,670; xml: 388,524; sh: 1,033; sql: 415; makefile: 26
file content (68 lines) | stat: -rw-r--r-- 2,558 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- coding: utf-8 -*-

from odoo.tests import common


class TestPurchaseRequisitionCommon(common.TransactionCase):

    @classmethod
    def setUpClass(cls):
        super(TestPurchaseRequisitionCommon, cls).setUpClass()

        # Fetch purchase related user groups
        user_group_purchase_manager = cls.env.ref('purchase.group_purchase_manager')
        user_group_purchase_user = cls.env.ref('purchase.group_purchase_user')

        # User Data: purchase requisition Manager and User
        Users = cls.env['res.users'].with_context({'tracking_disable': True})

        cls.user_purchase_requisition_manager = Users.create({
            'name': 'Purchase requisition Manager',
            'login': 'prm',
            'email': 'requisition_manager@yourcompany.com',
            'notification_type': 'inbox',
            'groups_id': [(6, 0, [user_group_purchase_manager.id])]})

        cls.user_purchase_requisition_user = Users.create({
            'name': 'Purchase requisition User',
            'login': 'pru',
            'email': 'requisition_user@yourcompany.com',
            'notification_type': 'inbox',
            'groups_id': [(6, 0, [user_group_purchase_user.id])]})

        # Create Product
        cls.product_uom_id = cls.env.ref('uom.product_uom_unit')

        cls.product_09 = cls.env['product.product'].create({
            'name': 'Pedal Bin',
            'categ_id': cls.env.ref('product.product_category_all').id,
            'standard_price': 10.0,
            'list_price': 47.0,
            'type': 'consu',
            'uom_id': cls.product_uom_id.id,
            'uom_po_id': cls.product_uom_id.id,
            'default_code': 'E-COM10',
        })

        cls.product_13 = cls.env['product.product'].create({
            'name': 'Corner Desk Black',
            'categ_id': cls.env.ref('product.product_category_all').id,
            'standard_price': 78.0,
            'list_price': 85.0,
            'type': 'consu',
            'uom_id': cls.product_uom_id.id,
            'uom_po_id': cls.product_uom_id.id,
            'default_code': 'FURN_1118',
        })

        # In order to test process of the purchase requisition ,create requisition
        cls.bo_requisition = cls.env['purchase.requisition'].create({
            'line_ids': [(0, 0, {
                'product_id': cls.product_09.id,
                'product_qty': 10.0,
                'product_uom_id': cls.product_uom_id.id})]
        })

        cls.res_partner_1 = cls.env['res.partner'].create({
            'name': 'Wood Corner',
        })