Browse Source

View reorganization

pull/1/head
Veronika Kotovich 9 years ago
parent
commit
39ace35f39
  1. 1
      controllers/main.py
  2. 4
      mail_move_message_models.py
  3. 31
      mail_move_message_views.xml

1
controllers/main.py

@ -16,7 +16,6 @@ class DataSetCustom(DataSet):
break break
partner_info = {} partner_info = {}
if contact_field: if contact_field:
print res
partner_info = model.read([r[0] for r in res], [contact_field]) partner_info = model.read([r[0] for r in res], [contact_field])
partner_info = dict([(p['id'], p[contact_field]) for p in partner_info]) partner_info = dict([(p['id'], p[contact_field]) for p in partner_info])
final_res = [] final_res = []

4
mail_move_message_models.py

@ -67,10 +67,10 @@ class wizard(models.TransientModel):
self.record_url = '/web#id=%s&model=%s' % (self.res_id, self.model) self.record_url = '/web#id=%s&model=%s' % (self.res_id, self.model)
@api.onchange('filter_by_partner', 'partner_id')
@api.onchange('model', 'filter_by_partner', 'partner_id')
def on_change_partner(self): def on_change_partner(self):
domain = {'res_id': []} domain = {'res_id': []}
if self.filter_by_partner and self.partner_id:
if self.model and self.filter_by_partner and self.partner_id:
fields = self.env[self.model].fields_get(False) fields = self.env[self.model].fields_get(False)
contact_field = False contact_field = False
for n, f in fields.iteritems(): for n, f in fields.iteritems():

31
mail_move_message_views.xml

@ -13,6 +13,7 @@
<field name="model">mail_move_message.wizard</field> <field name="model">mail_move_message.wizard</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Move Message"> <form string="Move Message">
<field name="can_move" invisible="1"/> <field name="can_move" invisible="1"/>
<field name="message_is_moved" invisible="1"/> <field name="message_is_moved" invisible="1"/>
@ -22,16 +23,28 @@
<field name="message_moved_by_user_id"/> <field name="message_moved_by_user_id"/>
<button name="open_moved_by_message_id" string="Open message" type="object" class="oe_highlight"/> <button name="open_moved_by_message_id" string="Open message" type="object" class="oe_highlight"/>
</group> </group>
<group attrs="{'invisible':[('can_move', '=', False)]}" col="4">
<field name="move_back" attrs="{'invisible':[('message_is_moved','=',False)]}" colspan="4"/>
<field name="model" class="oe_inline" widget="polymorphic" polymorphic="res_id"/>
<field name="filter_by_partner"/>
<field name="partner_id"/>
<field name="res_id" colspan="2" context="{'extended_name_with_contact':1}" widget="many2one" attrs="{'readonly': [('model','=',False)]}"/>
<field name="record_url" colspan="4" widget="url"/>
<group attrs="{'invisible':[('can_move', '=', False)]}" colspan="2">
<label for="model"/>
<div>
<field name="model" widget="polymorphic" polymorphic="res_id" style="width:100%"/>
</div>
<label for="filter_by_partner"/>
<div>
<field name="filter_by_partner"/>
<field name="partner_id" style="width:50%"/>
<button name="create_partner" type="object" string="Create Partner" attrs="{'invisible':[('partner_id','!=',False)]}"/>
</div>
<label for="res_id"/>
<div>
<field name="res_id" context="{'extended_name_with_contact':1}" widget="many2one" attrs="{'readonly': [('model','=',False)]}" class="oe_inline"/>
<field name="record_url" widget="url" class="oe_inline"/>
</div>
</group> </group>
<button name="move" string="Move" type="object" class="oe_highlight" attrs="{'invisible':[('can_move', '=', False)]}"/>
<button string="Cancel" class="" special="cancel" />
<field name="move_back" attrs="{'invisible':[('message_is_moved','=',False)]}" colspan="4"/>
<button name="move" string="Move" type="object" class="oe_highlight" attrs="{'invisible':[('can_move', '=', False)]}"/>
<button string="Cancel" class="" special="cancel" />
<separator string="Message"/> <separator string="Message"/>
<div> <div>
<field name="message_id" invisible="1"/> <field name="message_id" invisible="1"/>

Loading…
Cancel
Save