[ADD]: Add wizard for open document
bzr revid: ksa@tinyerp.co.in-20100929094950-1m73wiqkltjymrk0
This commit is contained in:
parent
926a310691
commit
85cf1ab9bd
|
@ -21,6 +21,7 @@
|
|||
|
||||
import mail_gateway
|
||||
import res_partner
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -31,9 +31,11 @@
|
|||
'depends': ['base'],
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'wizard/mail_gateway_document_view.xml',
|
||||
"mail_gateway_view.xml",
|
||||
"res_partner_view.xml",
|
||||
'security/ir.model.access.csv'
|
||||
|
||||
],
|
||||
'demo_xml': [],
|
||||
'installable': True,
|
||||
|
|
|
@ -542,3 +542,5 @@ class mailgate_tool(osv.osv_memory):
|
|||
return res
|
||||
|
||||
mailgate_tool()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -2,11 +2,11 @@
|
|||
<openerp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_mailgate_message_form">
|
||||
<field name="name">mailgate.message.form</field>
|
||||
<field name="name">mailgate.message.form</field>
|
||||
<field name="model">mailgate.message</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="mailgate message">
|
||||
<form string="mailgate message">
|
||||
<group colspan="4" col="6">
|
||||
<field name="name" string="Subject" required="1" select="1" widget="char" size="512"/>
|
||||
<field name="date" required="1" select="1"/>
|
||||
|
@ -66,12 +66,12 @@
|
|||
<field name="name" string="Subject"/>
|
||||
<field name="date" />
|
||||
<field name="user_id" string="Owner" default="uid"/>
|
||||
<field name="description" />
|
||||
<field name="partner_id" string="Partner Name"/>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." groups="base.group_extended">
|
||||
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Owner" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Owner" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Thread" icon="terp-mail-" domain="[]" context="{'group_by':'message_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Month" help="Creation Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
|
||||
|
@ -191,7 +191,6 @@
|
|||
view_id="view_mailgate_message_tree"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<menuitem name="Emails" id="menu_base_config_mail"
|
||||
parent="base.menu_base_partner" sequence="5" />
|
||||
|
@ -201,6 +200,11 @@
|
|||
action="mail_gateway.action_view_mailgate_message"
|
||||
/>
|
||||
|
||||
<act_window
|
||||
id="act_res_partner_open_email" name="Attachments"
|
||||
res_model="ir.attachment"
|
||||
src_model="mailgate.message"
|
||||
domain="[('res_id', '=', res_id),('res_model','=',model)]"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import mail_gateway_document
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,61 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from osv import fields, osv
|
||||
|
||||
class mail_gateway_document(osv.osv_memory):
|
||||
""" Mail Gateway Document """
|
||||
_name = "mail.gateway.document"
|
||||
_description = "Mail Gateway Document"
|
||||
|
||||
|
||||
def open_document(self, cr, uid, ids, context):
|
||||
""" To Open Document
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param ids: the ID or list of IDs if we want more than one
|
||||
@param context: A standard dictionary
|
||||
"""
|
||||
result = []
|
||||
document_id = context.get('active_id', False)
|
||||
mailgate_obj = self.pool.get('mailgate.message')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
act_obj = self.pool.get('ir.actions.act_window')
|
||||
mailgate_data = mailgate_obj.browse(cr, uid, document_id)
|
||||
model = mailgate_data.model
|
||||
res_id = mailgate_data.res_id
|
||||
|
||||
view_obj = self.pool.get('ir.ui.view')
|
||||
view_id = view_obj.search(cr, uid, [('model', '=', model),('type','=','tree')])
|
||||
return {
|
||||
'domain' : "[('id','=',%d)]"%(res_id),
|
||||
'view_mode': 'tree,form',
|
||||
'view_type': 'form',
|
||||
'view_id': view_id or False,
|
||||
'res_model': model,
|
||||
'res_id': res_id,
|
||||
'context': context,
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
mail_gateway_document()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
|
||||
<record id="view_mail_gateway_document" model="ir.ui.view">
|
||||
<field name="name">Open Document</field>
|
||||
<field name="model">mail.gateway.document</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Open Document">
|
||||
<label string="" colspan="2" />
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="open_document" string="Open Document" type="object" icon="gtk-ok"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_view_mail_gateway_document" model="ir.actions.act_window">
|
||||
<field name="name">Open Document</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">mail.gateway.document</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<act_window id="action_view_mail_gateway_document_window"
|
||||
name="Open Document"
|
||||
res_model="mail.gateway.document"
|
||||
src_model="mailgate.message"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
view_type="form"
|
||||
key2="client_action_multi"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue