Remove allowed_contacts_mechanisms field in Work Asterisk Result view

This commit is contained in:
Raimon Esteve 2016-07-13 12:47:05 +02:00
parent 1cf7cb45fd
commit eb1437bfe3
3 changed files with 1 additions and 18 deletions

View File

@ -2,10 +2,6 @@
msgid "" msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n" msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:project.work.asterisk.result,allowed_contacts_mechanisms:"
msgid "Allowed Contacts Mechanisms"
msgstr "Mitjans de contacte disponibles"
msgctxt "field:project.work.asterisk.result,contact_mechanisms:" msgctxt "field:project.work.asterisk.result,contact_mechanisms:"
msgid "Contact Mechanisms" msgid "Contact Mechanisms"
msgstr "Mitjans de contacte" msgstr "Mitjans de contacte"

View File

@ -2,10 +2,6 @@
msgid "" msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n" msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:project.work.asterisk.result,allowed_contacts_mechanisms:"
msgid "Allowed Contacts Mechanisms"
msgstr "Medios de contacto disponibles"
msgctxt "field:project.work.asterisk.result,contact_mechanisms:" msgctxt "field:project.work.asterisk.result,contact_mechanisms:"
msgid "Contact Mechanisms" msgid "Contact Mechanisms"
msgstr "Medios de contacto" msgstr "Medios de contacto"

11
work.py
View File

@ -4,7 +4,6 @@
from trytond.model import ModelView, fields from trytond.model import ModelView, fields
from trytond.pool import Pool from trytond.pool import Pool
from trytond.transaction import Transaction from trytond.transaction import Transaction
from trytond.pyson import Eval
from trytond.wizard import Wizard, StateView, StateTransition, Button from trytond.wizard import Wizard, StateView, StateTransition, Button
__all__ = ['WorkAsteriskResult', 'WorkAsterisk'] __all__ = ['WorkAsteriskResult', 'WorkAsterisk']
@ -15,15 +14,8 @@ class WorkAsteriskResult(ModelView):
__name__ = 'project.work.asterisk.result' __name__ = 'project.work.asterisk.result'
phone = fields.Selection('get_phones', 'Phone', required=True) phone = fields.Selection('get_phones', 'Phone', required=True)
allowed_contacts_mechanisms = fields.Function(fields.One2Many(
'party.contact_mechanism', None, 'Allowed Contacts Mechanisms'),
'on_change_with_allowed_contacts_mechanisms')
contact_mechanisms = fields.Many2One('party.contact_mechanism', contact_mechanisms = fields.Many2One('party.contact_mechanism',
'Contact Mechanisms', 'Contact Mechanisms')
domain=[
('id', 'in', Eval('allowed_contacts_mechanisms', [])),
],
depends=['allowed_contacts_mechanisms'])
class WorkAsterisk(Wizard): class WorkAsterisk(Wizard):
@ -66,7 +58,6 @@ class WorkAsterisk(Wizard):
mechanisms.extend(self.get_mechanims(contact)) mechanisms.extend(self.get_mechanims(contact))
mechanisms = list(set(mechanisms)) mechanisms = list(set(mechanisms))
return { return {
'allowed_contacts_mechanisms': [m.id for m in mechanisms],
'contact_mechanisms': mechanisms and mechanisms[0].id or None 'contact_mechanisms': mechanisms and mechanisms[0].id or None
} }