common.py 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # -*- coding: utf-8 -*-
  2. from odoo.addons.stock_account.tests.test_anglo_saxon_valuation_reconciliation_common import ValuationReconciliationTestCommon
  3. class TestStockLandedCostsCommon(ValuationReconciliationTestCommon):
  4. @classmethod
  5. def setUpClass(cls, chart_template_ref=None):
  6. super().setUpClass(chart_template_ref=chart_template_ref)
  7. # Objects
  8. cls.Product = cls.env['product.product']
  9. cls.Picking = cls.env['stock.picking']
  10. cls.Move = cls.env['stock.move']
  11. cls.LandedCost = cls.env['stock.landed.cost']
  12. cls.CostLine = cls.env['stock.landed.cost.lines']
  13. # References
  14. cls.warehouse = cls.company_data['default_warehouse']
  15. cls.supplier_id = cls.env['res.partner'].create({'name': 'My Test Supplier'}).id
  16. cls.customer_id = cls.env['res.partner'].create({'name': 'My Test Customer'}).id
  17. cls.supplier_location_id = cls.env.ref('stock.stock_location_suppliers').id
  18. cls.customer_location_id = cls.env.ref('stock.stock_location_customers').id
  19. cls.categ_all = cls.stock_account_product_categ
  20. cls.categ_manual_periodic = cls.env.ref('product.product_category_all').copy({
  21. "property_valuation": "manual_periodic",
  22. "property_cost_method": "fifo"
  23. })
  24. cls.categ_real_time = cls.env.ref('product.product_category_all').copy({
  25. "property_valuation": "real_time",
  26. "property_cost_method": "average"
  27. })
  28. cls.expenses_journal = cls.company_data['default_journal_purchase']
  29. cls.stock_journal = cls.env['account.journal'].create({
  30. 'name': 'Stock Journal',
  31. 'code': 'STJTEST',
  32. 'type': 'general',
  33. })
  34. # Create product refrigerator & oven
  35. cls.product_refrigerator = cls.Product.create({
  36. 'name': 'Refrigerator',
  37. 'type': 'product',
  38. 'standard_price': 1.0,
  39. 'weight': 10,
  40. 'volume': 1,
  41. 'categ_id': cls.categ_real_time.id})
  42. cls.product_oven = cls.Product.create({
  43. 'name': 'Microwave Oven',
  44. 'type': 'product',
  45. 'standard_price': 1.0,
  46. 'weight': 20,
  47. 'volume': 1.5,
  48. 'categ_id': cls.categ_real_time.id})
  49. # Create service type product 1.Labour 2.Brokerage 3.Transportation 4.Packaging
  50. cls.landed_cost = cls.Product.create({'name': 'Landed Cost', 'type': 'service'})
  51. cls.brokerage_quantity = cls.Product.create({'name': 'Brokerage Cost', 'type': 'service'})
  52. cls.transportation_weight = cls.Product.create({'name': 'Transportation Cost', 'type': 'service'})
  53. cls.packaging_volume = cls.Product.create({'name': 'Packaging Cost', 'type': 'service'})