Files
encoach_backend_new_v3/odoo/addons/pos_mrp/tests/common.py
Yamen Ahmad 3e83d8d7d5 feat: add complete EnCoach backend — Odoo 19 + all addons
Includes:
- Odoo 19 framework (odoo/)
- 27 custom EnCoach addons (new_project/custom_addons/)
  - encoach_core, encoach_api, encoach_lms_api, encoach_adaptive_api
  - encoach_exam, encoach_taxonomy, encoach_adaptive, encoach_assignment
  - encoach_ai, encoach_ai_grading, encoach_ai_generation, encoach_ai_media
  - encoach_courseware, encoach_communication, encoach_subscription
  - encoach_notification, encoach_approval, encoach_branding
  - encoach_classroom, encoach_registration, encoach_stats
  - encoach_faq, encoach_ticket, encoach_training, encoach_resources
  - encoach_adaptive_ai, encoach_sis
- 21 OpenEduCat Enterprise modules (new_project/enterprise-19/)
- 14 OpenEduCat Community modules (new_project/openeducat_erp-19.0/)
- Configuration: odoo.conf, requirements.txt, scripts
- 200+ REST API endpoints with JWT authentication
- SRS and test documentation

Made-with: Cursor
2026-04-01 17:10:04 +04:00

124 lines
4.7 KiB
Python

from odoo.addons.point_of_sale.tests.common import CommonPosTest
from odoo.fields import Command
class CommonPosMrpTest(CommonPosTest):
@classmethod
def setUpClass(self):
super().setUpClass()
self.mrp_create_product_category(self)
self.mrp_edit_product_template(self)
self.mrp_create_bom(self)
def mrp_edit_product_template(self):
self.product_product_kit_one = self.ten_dollars_no_tax.product_variant_id
self.product_product_kit_two = self.twenty_dollars_no_tax.product_variant_id
self.product_product_kit_three = self.product_product_kit_two.copy()
self.product_product_kit_four = self.product_product_kit_two.copy()
self.product_product_comp_one = self.ten_dollars_with_10_incl.product_variant_id
self.product_product_comp_two = self.ten_dollars_with_15_incl.product_variant_id
self.product_product_comp_three = self.twenty_dollars_with_10_incl.product_variant_id
self.product_product_comp_four = self.twenty_dollars_with_15_incl.product_variant_id
self.product_product_kit_one.write({
'is_storable': True,
'categ_id': self.category_fifo.id,
})
self.product_product_kit_two.write({
'is_storable': True,
'categ_id': self.category_fifo.id,
})
self.product_product_kit_three.write({
'is_storable': True,
'categ_id': self.category_fifo.id,
})
self.product_product_kit_four.write({
'is_storable': True,
'categ_id': self.category_fifo.id,
})
self.product_product_comp_one.product_tmpl_id.write({
'standard_price': 10,
})
self.product_product_comp_two.product_tmpl_id.write({
'standard_price': 10,
})
self.product_product_comp_three.product_tmpl_id.write({
'standard_price': 10,
})
self.product_product_comp_four.product_tmpl_id.write({
'standard_price': 10,
})
def mrp_create_product_category(self):
self.category_average = self.env['product.category'].create({
'name': 'Category for average cost',
'property_cost_method': 'average',
})
self.category_fifo = self.env['product.category'].create({
'name': 'Category for kit',
'property_cost_method': 'fifo',
})
self.category_fifo_realtime = self.env['product.category'].create({
'name': 'Category for kit',
'property_cost_method': 'fifo',
'property_valuation': 'real_time',
})
def mrp_create_bom(self):
self.bom_one_line = self.env['mrp.bom'].create({
'product_tmpl_id': self.product_product_kit_one.product_tmpl_id.id,
'product_qty': 1,
'type': 'phantom',
'bom_line_ids': [
Command.create({
'product_id': self.product_product_comp_one.id,
'product_qty': 1
}),
],
})
self.bom_two_lines = self.env['mrp.bom'].create({
'product_tmpl_id': self.product_product_kit_two.product_tmpl_id.id,
'product_qty': 1,
'type': 'phantom',
'bom_line_ids': [
Command.create({
'product_id': self.product_product_comp_one.id,
'product_qty': 1
}),
Command.create({
'product_id': self.product_product_comp_two.id,
'product_qty': 1
}),
],
})
self.bom_two_lines_of_kits = self.env['mrp.bom'].create({
'product_tmpl_id': self.product_product_kit_three.product_tmpl_id.id,
'product_qty': 1,
'type': 'phantom',
'bom_line_ids': [
Command.create({
'product_id': self.product_product_kit_one.id,
'product_qty': 1
}),
Command.create({
'product_id': self.product_product_kit_two.id,
'product_qty': 1
}),
],
})
self.bom_two_lines_of_kits_with_qty = self.env['mrp.bom'].create({
'product_tmpl_id': self.product_product_kit_four.product_tmpl_id.id,
'product_qty': 1,
'type': 'phantom',
'bom_line_ids': [
Command.create({
'product_id': self.product_product_kit_one.id,
'product_qty': 2
}),
Command.create({
'product_id': self.product_product_kit_two.id,
'product_qty': 3
}),
],
})