Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Maria Agustina
/
hgt_liquidacion_tareas
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit c9f7af58
authored
2020-12-15 11:06:25 -0300
by
Maria Agustina
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
ultimos detalles
1 parent
332e9fbd
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
16 deletions
models/__pycache__/liquidacionestareas.cpython-36.pyc
models/__pycache__/master.cpython-36.pyc
models/__pycache__/tareas.cpython-36.pyc
models/liquidacionestareas.py
models/master.py
models/tareas.py
views/vista_maestro.xml
models/__pycache__/liquidacionestareas.cpython-36.pyc
View file @
c9f7af5
No preview for this file type
models/__pycache__/master.cpython-36.pyc
View file @
c9f7af5
No preview for this file type
models/__pycache__/tareas.cpython-36.pyc
View file @
c9f7af5
No preview for this file type
models/liquidacionestareas.py
View file @
c9f7af5
# -*- coding: utf-8 -*-
from
odoo
import
models
,
fields
,
api
from
datetime
import
datetime
import
datetime
from
odoo.exceptions
import
UserError
#from lib.config import config
DEFAULT_SERVER_DATE_FORMAT
=
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
DEFAULT_SERVER_TIME_FORMAT
=
"
%
H:
%
M:
%
S"
DEFAULT_SERVER_DATETIME_FORMAT
=
"
%
s
%
s"
%
(
DEFAULT_SERVER_DATE_FORMAT
,
DEFAULT_SERVER_TIME_FORMAT
)
class
hgt_liquidacionestareas
(
models
.
Model
):
class
hdgt_liquidacionestareas
(
models
.
Model
):
_name
=
'hgt.liquidacionestareas'
nombre
=
fields
.
Char
(
...
...
@@ -59,18 +66,11 @@ class hgt_liquidacionestareas(models.Model):
def
crear_linea
(
self
,
liquidacion
,
usuario
,
desde
,
hasta
):
# input1= desde
# input2= hasta
# desde1= datetime.strptime(input1, "%Y-%m-%d")
# hasta1= datetime.strptime(input2, "%Y-%m-%d")
# desde2 = desde1.strftime("%m/%d/%Y %H:%M:%S")
# hasta2 = hasta1.strftime("%m/%d/%Y %H:%M:%S")
desde1
=
"{} 00:00:01"
.
format
(
desde
)
hasta1
=
"{} 23:59:59"
.
format
(
hasta
)
tareas
=
self
.
env
[
'hgt.tarea'
]
.
search
([(
'ejecutor'
,
'='
,
usuario
)])
#tareas = self.env['hgt.tarea'].search([('ejecutor','=',usuario),('inicio', '>=', desde.strftime('%Y-%m-%d 00:00:01')),('cierre', '<=', hasta.strftime('%Y-%m-%d 23:59:59'))])
# tareas = self.env['hgt.tarea'].search([('ejecutor','=',usuario),('inicio', '>', desde),('cierre', '<', hasta)])
#import ipdb; ipdb.set_trace()
tareas
=
self
.
env
[
'hgt.tarea'
]
.
search
([(
'ejecutor'
,
'='
,
usuario
),(
'write_date'
,
'>'
,
desde1
),(
'write_date'
,
'<'
,
hasta1
)])
for
tarea
in
tareas
.
ids
:
nva_lin
=
self
.
env
[
'hgt.linea_tarea'
]
.
create
({
...
...
@@ -79,6 +79,8 @@ class hgt_liquidacionestareas(models.Model):
'inicio'
:
desde
,
'cierre'
:
hasta
,
})
return
len
(
tareas
)
def
obtener_total
(
self
):
for
liq
in
self
:
...
...
@@ -87,9 +89,9 @@ class hgt_liquidacionestareas(models.Model):
tot
=
tot
+
record
.
subtotal
liq
.
total
=
tot
def
aprobar_liquidaciones
(
self
):
self
.
estado
=
'aprobado'
def
abonar_liquidaciones
(
self
):
self
.
estado
=
'liquidado'
...
...
models/master.py
View file @
c9f7af5
# -*- coding: utf-8 -*-
from
odoo
import
models
,
fields
,
api
from
odoo.exceptions
import
UserError
class
hgt_masterliquidaciones
(
models
.
Model
):
_name
=
'hgt.masterliquidaciones'
...
...
@@ -46,7 +47,10 @@ class hgt_masterliquidaciones(models.Model):
nva_liq
=
self
.
env
[
'hgt.liquidacionestareas'
]
.
create
(
datos
)
self
.
liquidaciones
=
[(
4
,
nva_liq
.
id
)]
self
.
liquidaciones
.
crear_linea
(
nva_liq
.
id
,
ejecutor
.
id
,
self
.
desde
,
self
.
hasta
)
if
self
.
liquidaciones
.
crear_linea
(
nva_liq
.
id
,
ejecutor
.
id
,
self
.
desde
,
self
.
hasta
)
==
0
:
raise
UserError
(
'No hay tareas que liquidar en el período de tiempo seleccionado'
)
...
...
models/tareas.py
View file @
c9f7af5
from
odoo.exceptions
import
UserError
,
ValidationError
,
Warning
from
datetime
import
datetime
,
timedelta
from
odoo
import
models
,
fields
,
api
#from lib.config import config
DEFAULT_SERVER_DATE_FORMAT
=
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
DEFAULT_SERVER_TIME_FORMAT
=
"
%
H:
%
M:
%
S"
DEFAULT_SERVER_DATETIME_FORMAT
=
"
%
s
%
s"
%
(
DEFAULT_SERVER_DATE_FORMAT
,
DEFAULT_SERVER_TIME_FORMAT
)
class
hgt_tarea
(
models
.
Model
):
_inherit
=
'hgt.tarea'
...
...
views/vista_maestro.xml
View file @
c9f7af5
...
...
@@ -50,7 +50,7 @@
<field
colspan=
"2"
name=
"hasta"
/>
</group>
<group
col=
"2"
string=
"Ejecutores"
>
<field
colspan=
"2"
nolabel=
"1"
name=
"ejecutores"
/>
<field
colspan=
"2"
nolabel=
"1"
name=
"ejecutores"
widget=
"many2many_tags"
/>
</group>
<group
col=
"2"
string=
"Liquidaciones"
>
<field
colspan=
"2"
nolabel=
"1"
name=
"liquidaciones"
/>
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment