Skip to content

Commit

Permalink
Merge pull request #748 from Som-Energia/targeta_serrells_gurb_2
Browse files Browse the repository at this point in the history
🐛 (gurb): Més errors per solucionar
  • Loading branch information
pauboixsom authored Oct 31, 2024
2 parents 7683fa7 + 917b721 commit 44abec1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
11 changes: 9 additions & 2 deletions som_gurb/models/giscedata_switching.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def activar_polissa_from_m1(self, cursor, uid, sw_id, context=None):
gurb_obj = self.pool.get("som.gurb")
sw_obj = self.pool.get("giscedata.switching")

super(GiscedataSwitchingHelpers, self).activar_polissa_from_m1(
res = super(GiscedataSwitchingHelpers, self).activar_polissa_from_m1(
cursor, uid, sw_id, context=context
)

Expand All @@ -397,9 +397,16 @@ def activar_polissa_from_m1(self, cursor, uid, sw_id, context=None):
and sw.step_id.name == "05"
and _contract_has_gurb_category(cursor, uid, self.pool, sw.cups_polissa_id.id)
):
step_obj = self.pool.get("giscedata.switching.m1.05")
pas_id = int(sw.step_ids[-1].pas_id.split(",")[1])

data_activacio = step_obj.read(
cursor, uid, pas_id, ["data_activacio"])["data_activacio"]

gurb_obj.activate_gurb_from_m1_05(
cursor, uid, sw_id, sw.step_ids[-1:].pas_id[0].data_activacio, context=context
cursor, uid, sw_id, data_activacio, context=context
)
return res


GiscedataSwitchingHelpers()
7 changes: 5 additions & 2 deletions som_gurb/tests/tests_gurb_switching.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,8 @@ def test_do_close_m1_05_gurb_category(self, get_activation_method, generate_mail
self.update_polissa_distri(self.txn, pol_ref='polissa_tarifa_018')
self.activar_polissa_CUPS(set_gurb_category=True, context={
"polissa_xml_id": "polissa_tarifa_018"})
pol = pol_obj.browse(self.cursor, self.uid, contract_id)
cups = pol.cups.name

cups = pol_obj.browse(self.cursor, self.uid, contract_id).cups.name

step_id = self.create_case_and_step(
self.cursor, self.uid, contract_id, "M1", "01"
Expand Down Expand Up @@ -722,13 +722,16 @@ def test_do_close_m1_05_gurb_category(self, get_activation_method, generate_mail
self.assertEqual(len(res), 1)

m1 = sw_obj.browse(self.cursor, self.uid, res[0])
pol = pol_obj.browse(self.cursor, self.uid, contract_id)
self.assertEqual(m1.proces_id.name, "M1")
self.assertEqual(m1.step_id.name, "05")
self.assertEqual(m101.solicitud_autoconsum, "S")

self.assertEqual(m1.state, "done")
self.assertEqual(m1.notificacio_pendent, False)

self.assertEqual(pol.autoconsumo, "41")

def test_notify_m1_03_gurb_category(self):
pol_obj = self.openerp.pool.get("giscedata.polissa")
sw_obj = self.openerp.pool.get("giscedata.switching")
Expand Down

0 comments on commit 44abec1

Please sign in to comment.