Skip to content

Commit

Permalink
fix minor error
Browse files Browse the repository at this point in the history
  • Loading branch information
susu105 committed Aug 16, 2022
1 parent a089442 commit ba02cbf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions som_generationkwh/som_generationkwh.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ def getPriceWithoutGeneration(self, cr, uid, line):
def getProfit(self, cr, uid, line):
ai_obj = self.pool.get('account.invoice')
cfg_obj = self.pool.get('res.config')
gffl_obj = self.pool.get('giscedata.facturacio.factura.linia')

if line['quantity'] == 0:
return 0
Expand All @@ -540,9 +541,8 @@ def getProfit(self, cr, uid, line):
cr, uid, 'end_date_mecanisme_ajust_gas', '2099-12-31')

priceNoGen = float(self.getPriceWithoutGeneration(cr, uid, line)['price_unit'])
rmag_lines_ids = self.browse(cr, uid, line).factura_id.get_rmag_lines()

if rmag_lines_ids and \
rmag_lines = gffl_obj.browse(cr, uid, line['id']).factura_id.get_rmag_lines()
if rmag_lines and \
line['data_desde'] >= start_date_mecanisme_ajust_gas and \
line['data_fins'] <= end_date_mecanisme_ajust_gas:
rmag_line = self.browse(cr, uid, rmag_lines_ids[0])
Expand All @@ -564,6 +564,7 @@ def _ff_saving_generation(self, cursor, uid, ids, field_name, arg,
gffl_obj = self.pool.get('giscedata.facturacio.factura.linia')

res = {k: {} for k in ids}

for gilo_line in self.browse(cursor, uid, ids):
line = gffl_obj.read(cursor, uid, gilo_line.factura_line_id.id)
res[gilo_line.id] = self.getProfit(cursor, uid, line)
Expand Down

0 comments on commit ba02cbf

Please sign in to comment.