Skip to content

Commit

Permalink
No agrupar línies en cas de factures que tinguin periode entre el can…
Browse files Browse the repository at this point in the history
…vi d'any
  • Loading branch information
egarciadiaz committed Jan 8, 2025
1 parent 6967f73 commit 768556f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions som_facturacio_comer/giscedata_facturacio.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

from osv import osv
from datetime import datetime


class GiscedataFacturacioFacturador(osv.osv):
Expand Down Expand Up @@ -53,5 +54,21 @@ def get_discount_line_vals(self, cursor, uid, line, context=None):

return vals

def crear_linia(self, cursor, uid, factura_id, vals, context=None):
if not context:
context = {}

if factura_id or 'factura_id' in vals:
factura_obj = self.pool.get('giscedata.facturacio.factura')
factura_info = factura_obj.read(cursor, uid, factura_id, ['data_inici', 'data_final'])
if factura_info and 'data_inici' in factura_info and 'data_final' in factura_info:
any_desde = datetime.strptime(factura_info['data_inici'], '%Y-%m-%d').year
any_fins = datetime.strptime(factura_info['data_final'], '%Y-%m-%d').year
if any_desde != any_fins:
context.update({'group_line': False})
return super(GiscedataFacturacioFacturador, self).crear_linia(
cursor, uid, factura_id, vals, context=context
)


GiscedataFacturacioFacturador()

0 comments on commit 768556f

Please sign in to comment.