common.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # -*- coding: utf-8 -*-
  2. from odoo.tests import common
  3. class TestPurchaseRequisitionCommon(common.TransactionCase):
  4. @classmethod
  5. def setUpClass(cls):
  6. super(TestPurchaseRequisitionCommon, cls).setUpClass()
  7. # Fetch purchase related user groups
  8. user_group_purchase_manager = cls.env.ref('purchase.group_purchase_manager')
  9. user_group_purchase_user = cls.env.ref('purchase.group_purchase_user')
  10. # User Data: purchase requisition Manager and User
  11. Users = cls.env['res.users'].with_context({'tracking_disable': True})
  12. cls.user_purchase_requisition_manager = Users.create({
  13. 'name': 'Purchase requisition Manager',
  14. 'login': 'prm',
  15. 'email': 'requisition_manager@yourcompany.com',
  16. 'notification_type': 'inbox',
  17. 'groups_id': [(6, 0, [user_group_purchase_manager.id])]})
  18. cls.user_purchase_requisition_user = Users.create({
  19. 'name': 'Purchase requisition User',
  20. 'login': 'pru',
  21. 'email': 'requisition_user@yourcompany.com',
  22. 'notification_type': 'inbox',
  23. 'groups_id': [(6, 0, [user_group_purchase_user.id])]})
  24. # Create Product
  25. cls.product_uom_id = cls.env.ref('uom.product_uom_unit')
  26. cls.product_09 = cls.env['product.product'].create({
  27. 'name': 'Pedal Bin',
  28. 'categ_id': cls.env.ref('product.product_category_all').id,
  29. 'standard_price': 10.0,
  30. 'list_price': 47.0,
  31. 'type': 'consu',
  32. 'uom_id': cls.product_uom_id.id,
  33. 'uom_po_id': cls.product_uom_id.id,
  34. 'default_code': 'E-COM10',
  35. })
  36. cls.product_13 = cls.env['product.product'].create({
  37. 'name': 'Corner Desk Black',
  38. 'categ_id': cls.env.ref('product.product_category_all').id,
  39. 'standard_price': 78.0,
  40. 'list_price': 85.0,
  41. 'type': 'consu',
  42. 'uom_id': cls.product_uom_id.id,
  43. 'uom_po_id': cls.product_uom_id.id,
  44. 'default_code': 'FURN_1118',
  45. })
  46. # In order to test process of the purchase requisition ,create requisition
  47. cls.bo_requisition = cls.env['purchase.requisition'].create({
  48. 'line_ids': [(0, 0, {
  49. 'product_id': cls.product_09.id,
  50. 'product_qty': 10.0,
  51. 'product_uom_id': cls.product_uom_id.id})]
  52. })
  53. cls.res_partner_1 = cls.env['res.partner'].create({
  54. 'name': 'Wood Corner',
  55. })