bemade_fsm: Added tests and code for site contacts and work order contacts on tasks.
This commit is contained in:
parent
df14a3afda
commit
89a09aebb7
4 changed files with 43 additions and 1 deletions
|
|
@ -5,3 +5,7 @@ class Task(models.Model):
|
||||||
_inherit = "project.task"
|
_inherit = "project.task"
|
||||||
|
|
||||||
equipment_id = fields.Many2one("bemade_fsm.equipment", string="Target Equipment")
|
equipment_id = fields.Many2one("bemade_fsm.equipment", string="Target Equipment")
|
||||||
|
|
||||||
|
work_order_contacts = fields.Many2many(related='sale_line_id.order_id.work_order_contacts')
|
||||||
|
site_contacts = fields.Many2many(related='sale_line_id.order_id.site_contacts')
|
||||||
|
equipment_ids = fields.Many2many(related='sale_line_id.order_id.equipment_ids')
|
||||||
|
|
|
||||||
|
|
@ -3,3 +3,4 @@ from . import test_task_template
|
||||||
from . import test_task_template_sale_order
|
from . import test_task_template_sale_order
|
||||||
from . import test_equipment
|
from . import test_equipment
|
||||||
from . import test_fsm_contact_setting
|
from . import test_fsm_contact_setting
|
||||||
|
from . import test_so_task_contacts
|
||||||
|
|
|
||||||
37
bemade_fsm/tests/test_so_task_contacts.py
Normal file
37
bemade_fsm/tests/test_so_task_contacts.py
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
from .test_task_template_sale_order import TestTaskTemplateSalesOrder
|
||||||
|
from odoo import Command
|
||||||
|
|
||||||
|
|
||||||
|
class TestSaleOrderTaskContacts(TestTaskTemplateSalesOrder):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
|
Partner = cls.env['res.partner']
|
||||||
|
cls.partner2 = Partner.create({
|
||||||
|
'name': 'New Partner',
|
||||||
|
'company_type': 'company',
|
||||||
|
})
|
||||||
|
cls.contact = Partner.create({
|
||||||
|
'name': 'Contact',
|
||||||
|
'company_type': 'person',
|
||||||
|
'parent_id': cls.partner2.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
def _test_contacts(self, field):
|
||||||
|
def ga(obj):
|
||||||
|
return getattr(obj, field)
|
||||||
|
self.partner2.write({field: [Command.set([self.contact.id])]})
|
||||||
|
self.sale_order1.write(
|
||||||
|
{'partner_id': self.partner2.id, field: [Command.set(ga(self.partner2).ids)]})
|
||||||
|
so = self.sale_order1
|
||||||
|
self.assertTrue(ga(so))
|
||||||
|
so.action_confirm()
|
||||||
|
task = so.order_line[0].task_id
|
||||||
|
self.assertTrue(ga(task))
|
||||||
|
self.assertTrue(ga(task) == ga(so))
|
||||||
|
|
||||||
|
def test_work_order_contacts_on_task(self):
|
||||||
|
self._test_contacts('work_order_contacts')
|
||||||
|
|
||||||
|
def test_site_contacts_on_task(self):
|
||||||
|
self._test_contacts('site_contacts')
|
||||||
Loading…
Reference in a new issue