Skip to content

Commit

Permalink
[FIX] tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EdgarRetes committed Nov 6, 2024
1 parent 6e06bf2 commit 72f067f
Showing 1 changed file with 46 additions and 42 deletions.
88 changes: 46 additions & 42 deletions fieldservice_sale/tests/test_fsm_sale_autofill_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,56 +49,60 @@ def test_00_autofill_so_fsm_location(self):
self.location2.partner_id = self.partner
self.location3.partner_id = self.shipping_partner

self.location1.flush_model()
self.location2.flush_model()
self.location3.flush_model()
self.location1.flush()
self.location2.flush()
self.location3.flush()
self.env.cr.commit()

with Form(self.env["sale.order"]) as so_form:
so_form.partner_id = self.partner
so = so_form.save()
self.assertEqual(so.fsm_location_id, self.location2)

def test_01_autofill_so_fsm_location(self):
"""Check location autofill from SO partner

SO partner is not an FSM location defined, but location1 is linked to
its commercial partner => expect location 1 (because of ordering)
"""
self.partner.fsm_location = False
self.location1.partner_id = self.commercial_partner
self.location2.partner_id = self.partner
self.location3.partner_id = self.shipping_partner
with Form(self.env["sale.order"]) as so_form:
so_form.partner_id = self.partner
so = so_form.save()
self.assertEqual(so.fsm_location_id, self.location1)
def test_01_autofill_so_fsm_location(self):
"""Check location autofill from SO partner
def test_02_autofill_so_fsm_location(self):
"""Check location autofill from SO partner
SO partner is not an FSM location defined, but location1 is linked to
its commercial partner => expect location 1 (because of ordering)
"""
self.partner.fsm_location = False
self.location1.partner_id = self.commercial_partner
self.location2.partner_id = self.partner
self.location3.partner_id = self.shipping_partner
with Form(self.env["sale.order"]) as so_form:
so_form.partner_id = self.partner
so = so_form.save()
self.assertEqual(so.fsm_location_id, self.location1)

SO partner is not an FSM location defined, but location1 is linked to
the partner itself => expect location 1 (because of ordering)
"""
self.partner.fsm_location = False
self.location1.partner_id = self.partner
self.location2.partner_id = self.shipping_partner
self.location3.partner_id = self.commercial_partner
with Form(self.env["sale.order"]) as so_form:
so_form.partner_id = self.partner
so = so_form.save()
self.assertEqual(so.fsm_location_id, self.location1)

def test_03_autofill_so_fsm_location(self):
"""Check location autofill from SO partner
def test_02_autofill_so_fsm_location(self):
"""Check location autofill from SO partner
SO partner is not an FSM location defined, but location1 is linked to
its shipping partner => expect location 1 (because of ordering)
"""
self.partner.fsm_location = False
self.location1.partner_id = self.shipping_partner
self.location2.partner_id = self.commercial_partner
self.location3.partner_id = self.partner
with Form(self.env["sale.order"]) as so_form:
so_form.partner_id = self.partner
so = so_form.save()
self.assertEqual(so.fsm_location_id, self.location1)
SO partner is not an FSM location defined, but location1 is linked to
the partner itself => expect location 1 (because of ordering)
"""
self.partner.fsm_location = False
self.location1.partner_id = self.partner
self.location2.partner_id = self.shipping_partner
self.location3.partner_id = self.commercial_partner
with Form(self.env["sale.order"]) as so_form:
so_form.partner_id = self.partner
so = so_form.save()
self.assertEqual(so.fsm_location_id, self.location1)


def test_03_autofill_so_fsm_location(self):
"""Check location autofill from SO partner
SO partner is not an FSM location defined, but location1 is linked to
its shipping partner => expect location 1 (because of ordering)
"""
self.partner.fsm_location = False
self.location1.partner_id = self.shipping_partner
self.location2.partner_id = self.commercial_partner
self.location3.partner_id = self.partner
with Form(self.env["sale.order"]) as so_form:
so_form.partner_id = self.partner
so = so_form.save()
self.assertEqual(so.fsm_location_id, self.location1)

0 comments on commit 72f067f

Please sign in to comment.