parent
70877f2047
commit
877d4389d5
|
@ -3,6 +3,7 @@
|
|||
# the full copyright notices and license terms.
|
||||
from trytond.pool import Pool
|
||||
from . import role
|
||||
from . import user
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
|
@ -11,4 +12,5 @@ def register():
|
|||
role.Allocation,
|
||||
role.WorkStatus,
|
||||
role.Work,
|
||||
user.User,
|
||||
module='project_role', type_='model')
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:project.allocation,role:"
|
||||
msgid "Role"
|
||||
msgstr "Rol"
|
||||
|
||||
msgctxt "field:project.role,name:"
|
||||
msgid "Name"
|
||||
msgstr "Nom"
|
||||
|
||||
msgctxt "field:project.work,assignee:"
|
||||
msgid "Assignee"
|
||||
msgstr "Assigna"
|
||||
|
||||
msgctxt "field:project.work,role_employee:"
|
||||
msgid "Role Employee"
|
||||
msgstr "Rol empleat"
|
||||
|
||||
msgctxt "field:project.work.status,role:"
|
||||
msgid "Role"
|
||||
msgstr "Rols"
|
||||
|
||||
msgctxt "field:res.user,send_own_assignee:"
|
||||
msgid "Send Own Assignee"
|
||||
msgstr "Envia assignació pròpia"
|
||||
|
||||
msgctxt "field:work.configuration,default_allocation_employee:"
|
||||
msgid "Default Allocation Employee"
|
||||
msgstr "Assigna empleat per defecte"
|
||||
|
||||
msgctxt "model:ir.action,name:act_project_role"
|
||||
msgid "Project Roles"
|
||||
msgstr "Rols projecte"
|
||||
|
||||
msgctxt "model:ir.rule.group,name:rule_group_project_allocation"
|
||||
msgid "User in company"
|
||||
msgstr "Usuari a les empreses"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_project_role_configuration"
|
||||
msgid "Roles"
|
||||
msgstr "Rols"
|
||||
|
||||
msgctxt "model:project.role,name:"
|
||||
msgid "Project Role"
|
||||
msgstr "Rol projecte"
|
|
@ -0,0 +1,47 @@
|
|||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:project.allocation,role:"
|
||||
msgid "Role"
|
||||
msgstr "Rol"
|
||||
|
||||
msgctxt "field:project.role,name:"
|
||||
msgid "Name"
|
||||
msgstr "Nombre"
|
||||
|
||||
msgctxt "field:project.work,assignee:"
|
||||
msgid "Assignee"
|
||||
msgstr "Asignar"
|
||||
|
||||
msgctxt "field:project.work,role_employee:"
|
||||
msgid "Role Employee"
|
||||
msgstr "Rol empleado"
|
||||
|
||||
msgctxt "field:project.work.status,role:"
|
||||
msgid "Role"
|
||||
msgstr "Roles"
|
||||
|
||||
msgctxt "field:res.user,send_own_assignee:"
|
||||
msgid "Send Own Assignee"
|
||||
msgstr "Envía asignación propia"
|
||||
|
||||
msgctxt "field:work.configuration,default_allocation_employee:"
|
||||
msgid "Default Allocation Employee"
|
||||
msgstr "Asignar empleado por defecto"
|
||||
|
||||
msgctxt "model:ir.action,name:act_project_role"
|
||||
msgid "Project Roles"
|
||||
msgstr "Roles proyecto"
|
||||
|
||||
msgctxt "model:ir.rule.group,name:rule_group_project_allocation"
|
||||
msgid "User in company"
|
||||
msgstr "Usuario a las empresas"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_project_role_configuration"
|
||||
msgid "Roles"
|
||||
msgstr "Roles"
|
||||
|
||||
msgctxt "model:project.role,name:"
|
||||
msgid "Project Role"
|
||||
msgstr "Rol proyecto"
|
13
role.py
13
role.py
|
@ -4,13 +4,15 @@ from trytond.pool import Pool, PoolMeta
|
|||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.sendmail import sendmail_transactional
|
||||
from trytond.config import config
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
FROM_ADDR = config.get('email', 'from')
|
||||
|
||||
|
||||
class Role(ModelSQL, ModelView):
|
||||
'Project Role'
|
||||
__name__ = 'project.role'
|
||||
name = fields.Char('name', required=True)
|
||||
name = fields.Char('Name', required=True)
|
||||
|
||||
|
||||
class WorkConfiguration(metaclass=PoolMeta):
|
||||
|
@ -69,11 +71,12 @@ class Work(metaclass=PoolMeta):
|
|||
if not self.assignee or not self.assignee.party.email:
|
||||
return
|
||||
|
||||
user_id = Transaction().user
|
||||
|
||||
users = User.search([('id', '=', self.write_uid)], limit=1)
|
||||
if users:
|
||||
user, = users
|
||||
else:
|
||||
user = None
|
||||
user = users[0] if users else None
|
||||
if not user or (user.id == user_id and not user.send_own_assignee):
|
||||
return
|
||||
|
||||
body = []
|
||||
previous_assignee = previous.get('assignee')
|
||||
|
|
|
@ -8,4 +8,5 @@ depends:
|
|||
project_sequence
|
||||
xml:
|
||||
role.xml
|
||||
user.xml
|
||||
work.xml
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
from trytond.pool import PoolMeta
|
||||
from trytond.model import fields
|
||||
|
||||
|
||||
class User(metaclass=PoolMeta):
|
||||
__name__ = 'res.user'
|
||||
|
||||
send_own_assignee = fields.Boolean('Send Own Assignee')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(User, cls).__setup__()
|
||||
if not 'send_own_assignee' in cls._preferences_fields:
|
||||
cls._preferences_fields.append('send_own_assignee')
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="user_view_form">
|
||||
<field name="model">res.user</field>
|
||||
<field name="inherit" ref="res.user_view_form"/>
|
||||
<field name="name">user_form</field>
|
||||
</record>
|
||||
</data>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="user_view_form_preferences">
|
||||
<field name="model">res.user</field>
|
||||
<field name="inherit" ref="res.user_view_form_preferences"/>
|
||||
<field name="name">user_form_preferences</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<data>
|
||||
<xpath expr="/form/notebook/page[@id='preferences']/field" position="after">
|
||||
<label name="send_own_assignee"/>
|
||||
<field name="send_own_assignee"/>
|
||||
</xpath>
|
||||
</data>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<data>
|
||||
<xpath expr="/form/notebook/page[@id='preferences']/field" position="after">
|
||||
<label name="send_own_assignee"/>
|
||||
<field name="send_own_assignee"/>
|
||||
</xpath>
|
||||
</data>
|
Loading…
Reference in New Issue