Skip to content

Commit

Permalink
search gffl by dates to get price
Browse files Browse the repository at this point in the history
  • Loading branch information
MarJene committed Aug 16, 2022
1 parent b4eefc1 commit 3f0a21a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions som_generationkwh/som_generationkwh.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,12 +519,15 @@ def _ff_invoice_number(self, cursor, uid, ids, field_name, arg,
def getPriceWithoutGeneration(self, cr, uid, line):
per_obj = self.pool.get('giscedata.polissa.tarifa.periodes')
gff_obj = self.pool.get('giscedata.facturacio.factura')
ail_obj = self.pool.get('account.invoice.line')
gffl_obj = self.pool.get('giscedata.facturacio.factura.linia')

fare_period = gff_obj.get_fare_period(cr, uid, line['product_id'])
product_id_nogen = per_obj.read(cr, uid, fare_period, ['product_id'])['product_id'][0]
line_s_gen_id = ail_obj.search(cr, uid, [('invoice_id','=', line['invoice_id'][0]),('product_id','=',product_id_nogen)])
line_s_gen = ail_obj.read(cr, uid, line_s_gen_id[0])
line_s_gen_id = gffl_obj.search(cr, uid, [
('invoice_id','=', line['invoice_id'][0]),('product_id','=',product_id_nogen),
('data_fins', '=', line['data_fins']), ('data_desde', '=', line['data_desde'])
])
line_s_gen = gffl_obj.read(cr, uid, line_s_gen_id[0])
return line_s_gen

def getProfit(self, cr, uid, line):
Expand Down

0 comments on commit 3f0a21a

Please sign in to comment.