-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #422 from Som-Energia/48966-feat_validate_fact_exp…
…edient_frau Validació de expedient de frau o anomalia nomes si hi ha flux solar
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
som_facturacio_switching/giscedata_facturacio_validation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
from datetime import datetime | ||
|
||
from osv import osv | ||
|
||
|
||
class GiscedataFacturacioValidationValidator(osv.osv): | ||
_inherit = 'giscedata.facturacio.validation.validator' | ||
_name = 'giscedata.facturacio.validation.validator' | ||
|
||
def check_factura_amb_expedient(self, cursor, uid, fact, parameters): | ||
for bat in fact.polissa_id.bateria_ids: | ||
if (datetime.strptime(bat.data_inici, '%Y-%m-%d') < datetime.today() | ||
and (not bat.data_final or datetime.strptime(bat.data_final, '%Y-%m-%d') > datetime.today())): | ||
return super(GiscedataFacturacioValidationValidator, self).check_factura_amb_expedient(cursor, uid, fact, parameters) | ||
|
||
return None | ||
|
||
|
||
GiscedataFacturacioValidationValidator() |