Augustin Cisterne-Kaas - www.elico-corp.com has proposed merging lp:~ajite/openobject-addons/elico-7.0 into lp:~openerp-community/openobject-addons/elico-7.0.
Requested reviews: LIN Yu (lin-yu) For more details, see: https://code.launchpad.net/~ajite/openobject-addons/elico-7.0/+merge/207818 Added web polymorphic module: This module adds a new field named polymorphic. Added Mail Organizer This module allows a user to organize his email easily. Added a log for the web adblock extension. -- https://code.launchpad.net/~ajite/openobject-addons/elico-7.0/+merge/207818 Your team OpenERP Community is subscribed to branch lp:~openerp-community/openobject-addons/elico-7.0.
=== added directory 'mail_organizer' === added file 'mail_organizer/__init__.py' --- mail_organizer/__init__.py 1970-01-01 00:00:00 +0000 +++ mail_organizer/__init__.py 2014-02-23 07:15:07 +0000 @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +# Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> +# +# 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 model +import message +import wizard === added file 'mail_organizer/__openerp__.py' --- mail_organizer/__openerp__.py 1970-01-01 00:00:00 +0000 +++ mail_organizer/__openerp__.py 2014-02-23 07:15:07 +0000 @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +# Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> +# +# 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/>. +# +############################################################################## +{'name': 'Mail Organizer', + 'version': '0.1', + 'category': 'Social Network', + 'depends': ['web_polymorphic', 'mail'], + 'author': 'Elico Corp', + 'license': 'AGPL-3', + 'website': 'https://www.elico-corp.com', + 'description': """ +This module allows you to assign a message to an existing or +a new resource dynamically. + +You can configure the available model through +"Settings" -> "Technical" -> "Email Organizer" +""", + 'images': [], + 'demo': [], + 'data': ['wizard/wizard_mail_organizer_view.xml', + 'model_view.xml'], + 'qweb': [ + 'static/src/xml/mail.xml' + ], + 'js': [ + 'static/src/js/mail.js' + ], + 'css': [ + 'static/src/css/mail.css' + ], + 'installable': True, + 'application': False} === added file 'mail_organizer/message.py' --- mail_organizer/message.py 1970-01-01 00:00:00 +0000 +++ mail_organizer/message.py 2014-02-23 07:15:07 +0000 @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +# Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> +# +# 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 openerp.osv import fields, orm + + +class mail_message(orm.Model): + _inherit = 'mail.message' + _columns = { + 'name': fields.char('Name') + } === added file 'mail_organizer/model.py' --- mail_organizer/model.py 1970-01-01 00:00:00 +0000 +++ mail_organizer/model.py 2014-02-23 07:15:07 +0000 @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +# Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> +# +# 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 openerp.osv import fields, orm + + +class ir_model(orm.Model): + _inherit = 'ir.model' + _columns = { + 'mail_organizer': fields.boolean('Use in Mail Organizer') + } === added file 'mail_organizer/model_view.xml' --- mail_organizer/model_view.xml 1970-01-01 00:00:00 +0000 +++ mail_organizer/model_view.xml 2014-02-23 07:15:07 +0000 @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<openerp> + <data> + <record id="view_model_form" model="ir.ui.view"> + <field name="name">ir.model.form</field> + <field name="model">ir.model</field> + <field name="inherit_id" ref="base.view_model_form" /> + <field name="arch" type="xml" > + <field name="modules" position="after"> + <field name="mail_organizer" /> + </field> + </field> + </record> + + <record id="view_model_tree_editable" model="ir.ui.view"> + <field name="name">Ir Model editable tree</field> + <field name="model">ir.model</field> + <field name="arch" type="xml" > + <tree string="Mail Organizer" editable="bottom"> + <field name="name" readonly="1" /> + <field name="model" readonly="1" /> + <field name="mail_organizer" /> + </tree> + </field> + </record> + + + <record model="ir.actions.act_window" id="action_mail_organizer"> + <field name="name">Email organizer</field> + <field name="view_id" ref="view_model_tree_editable"/> + <field name="res_model">ir.model</field> + <field name="view_type">form</field> + <field name="usage">menu</field> + </record> + + <menuitem id="menu_email_organizer" + name="Email Organizer" + action="action_mail_organizer" + parent="base.menu_email" /> + </data> +</openerp> \ No newline at end of file === added directory 'mail_organizer/static' === added directory 'mail_organizer/static/src' === added directory 'mail_organizer/static/src/css' === added file 'mail_organizer/static/src/css/mail.css' --- mail_organizer/static/src/css/mail.css 1970-01-01 00:00:00 +0000 +++ mail_organizer/static/src/css/mail.css 2014-02-23 07:15:07 +0000 @@ -0,0 +1,24 @@ +/****************************************************************************** +* +* OpenERP, Open Source Management Solution +* Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +* Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> +* +* 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/>. +* +******************************************************************************/ +.openerp .oe_mail .oe_msg .oe_msg_icons .oe_assign:hover a{ + color: #1fc0ff; + text-shadow: 0px 1px #184fc5,0px -1px #184fc5, -1px 0px #184fc5, 1px 0px #184fc5, 0px 3px 3px rgba(0,0,0,0.1); +} === added directory 'mail_organizer/static/src/img' === added file 'mail_organizer/static/src/img/icon.png' Binary files mail_organizer/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and mail_organizer/static/src/img/icon.png 2014-02-23 07:15:07 +0000 differ === added directory 'mail_organizer/static/src/js' === added file 'mail_organizer/static/src/js/mail.js' --- mail_organizer/static/src/js/mail.js 1970-01-01 00:00:00 +0000 +++ mail_organizer/static/src/js/mail.js 2014-02-23 07:15:07 +0000 @@ -0,0 +1,53 @@ +/****************************************************************************** +* +* OpenERP, Open Source Management Solution +* Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +* Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> +* +* 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/>. +* +******************************************************************************/ +openerp.mail_organizer = function (instance) { + var mail = instance.mail; + var QWeb = instance.web.qweb; + window.yep = instance; + mail.ThreadMessage = mail.ThreadMessage.extend({ + template: 'mail.thread.message', + events: { + 'click .oe_assign': 'open_wizard', + }, + + start: function () { + this._super.apply(this, arguments); + }, + + open_wizard: function() { + var self = this; + var context = { + 'active_id': this.id, + }; + var action = { + type: 'ir.actions.act_window', + res_model: 'wizard.mail.organizer', + view_mode: 'form', + view_type: 'form', + views: [[false, 'form']], + target: 'new', + context: context, + }; + self.do_action(action); + } + + }); +}; \ No newline at end of file === added directory 'mail_organizer/static/src/xml' === added file 'mail_organizer/static/src/xml/mail.xml' --- mail_organizer/static/src/xml/mail.xml 1970-01-01 00:00:00 +0000 +++ mail_organizer/static/src/xml/mail.xml 2014-02-23 07:15:07 +0000 @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<template> + <t t-extend="mail.thread.message"> + <t t-jquery=".oe_msg_icons span:first-child()" t-operation="after"> + <span class="oe_assign"><a title="Assign to" class="oe_e">C</a></span> + </t> + </t> +</template> \ No newline at end of file === added directory 'mail_organizer/wizard' === added file 'mail_organizer/wizard/__init__.py' --- mail_organizer/wizard/__init__.py 1970-01-01 00:00:00 +0000 +++ mail_organizer/wizard/__init__.py 2014-02-23 07:15:07 +0000 @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +# Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> +# +# 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 wizard_mail_organizer === added file 'mail_organizer/wizard/wizard_mail_organizer.py' --- mail_organizer/wizard/wizard_mail_organizer.py 1970-01-01 00:00:00 +0000 +++ mail_organizer/wizard/wizard_mail_organizer.py 2014-02-23 07:15:07 +0000 @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +# Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> +# +# 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 openerp.osv import fields, osv + + +class wizard_mail_organizer(osv.osv_memory): + _name = 'wizard.mail.organizer' + + def _select_models(self, cr, uid, context=None): + module_pool = self.pool.get('ir.model') + module_ids = module_pool.search( + cr, uid, [('mail_organizer', '=', True)], + order="name", context=context) + modules = module_pool.browse(cr, uid, module_ids, context=context) + return [(m.model, m.name) for m in modules] + + def _get_default_message_id(self, cr, uid, context=None): + return context.get('active_id', None) + + _columns = { + 'message_id': fields.many2one( + 'mail.message', string="Message", required=True), + 'res': fields.char('Ressource', readonly=True), + 'model': fields.selection( + _select_models, string="Model", readonly=True), + 'new_res_id': fields.integer("New resource"), + 'new_model': fields.selection(_select_models, string="New model"), + 'subject': fields.char('Subject', readonly=True), + 'author_id': fields.many2one( + 'res.partner', string='Author', readonly=True), + 'has_domain': fields.boolean('Filter by partner'), + 'is_domain_visible': fields.boolean('Is domain visible') + } + + _defaults = { + 'message_id': lambda self, cr, uid, c: ( + self._get_default_message_id(cr, uid, context=c)), + 'has_domain': True, + 'is_domain_visible': False + } + + def onchange_new_model(self, cr, uid, ids, new_model, has_domain, + author_id, context=None): + res = {} + vals = {'new_res_id': None} + domain = {'new_res_id': []} + if new_model and has_domain: + obj_pool = self.pool.get(new_model) + vals.update({'is_domain_visible': False}) + if 'partner_id' in obj_pool._columns: + domain = {'new_res_id': [('partner_id', '=', author_id)]} + vals.update({'is_domain_visible': True}) + res.update({'value': vals, 'domain': domain}) + return res + + def onchange_message_id(self, cr, uid, ids, message_id, context=None): + res = {} + if not message_id: + return res + vals = {} + message_pool = self.pool.get('mail.message') + message = message_pool.browse( + cr, uid, message_id, context=context) + resource = '' + if message.model and message.res_id: + obj_pool = self.pool.get(message.model) + obj = obj_pool.browse( + cr, uid, message.res_id, context=context) + resource = getattr(obj, obj._rec_name) + vals.update({ + 'model': message.model, + 'res': resource, + 'author_id': (message.author_id and message.author_id.id + or None), + 'subject': message.subject + }) + res.update({'value': vals}) + return res + + def confirm(self, cr, uid, ids, context=None): + message_pool = self.pool.get('mail.message') + for wz in self.browse(cr, uid, ids, context=context): + data = {'model': wz.new_model, 'res_id': wz.new_res_id} + message_pool.write( + cr, uid, wz.message_id.id, data, context=context) + return { + 'type': 'ir.actions.client', + 'tag': 'reload' + } === added file 'mail_organizer/wizard/wizard_mail_organizer_view.xml' --- mail_organizer/wizard/wizard_mail_organizer_view.xml 1970-01-01 00:00:00 +0000 +++ mail_organizer/wizard/wizard_mail_organizer_view.xml 2014-02-23 07:15:07 +0000 @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<openerp> + <data> + <record model="ir.ui.view" id="wizard_mail_organizer_form"> + <field name="name">wizard_mail_organizer.form</field> + <field name="model">wizard.mail.organizer</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="Wizard Mail Organizer" version="7.0"> + <header> + <h2 class="oe_title">Assign email to another resource</h2> + </header> + <field name="message_id" invisible="True" on_change="onchange_message_id(message_id)" /> + <field name="is_domain_visible" invisible="True" /> + <group col="4" colspan="2"> + <field name="author_id" /> + <field name="subject" /> + <field name="model" /> + <field name="res" /> + <field name="new_model" colspan="2" on_change="onchange_new_model(new_model, has_domain, author_id)" /> + <field name="new_res_id" colspan="2" widget="polymorphic" polymorphic="new_model"/> + <field name="has_domain" + on_change="onchange_new_model(new_model, has_domain, author_id)" + attrs="{'invisible':[('is_domain_visible', '=', False)]}" /> + </group> + <footer> + <button name="confirm" string="Assign" type="object" class="oe_highlight" /> + <button string="Cancel" class="oe_link" special="cancel"/> + </footer> + </form> + </field> + </record> + </data> +</openerp> \ No newline at end of file === modified file 'web_adblock/__init__.py' --- web_adblock/__init__.py 2013-12-28 06:25:35 +0000 +++ web_adblock/__init__.py 2014-02-23 07:15:07 +0000 @@ -2,8 +2,8 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. -# Augustin Cisterne-Kaas <augustin.cisterne-ka...@elico-corp.com> +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +# Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as === modified file 'web_adblock/__openerp__.py' --- web_adblock/__openerp__.py 2013-12-28 06:25:35 +0000 +++ web_adblock/__openerp__.py 2014-02-23 07:15:07 +0000 @@ -2,8 +2,8 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. -# Augustin Cisterne-Kaas <augustin.cisterne-ka...@elico-corp.com> +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +# Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -22,7 +22,7 @@ { 'name': 'OpenERP Adblock', 'version': '0.1', - 'category': '', + 'category': 'Web', 'depends': ['mail'], 'author': 'Elico Corp', 'license': 'AGPL-3', === added file 'web_adblock/static/.DS_Store' Binary files web_adblock/static/.DS_Store 1970-01-01 00:00:00 +0000 and web_adblock/static/.DS_Store 2014-02-23 07:15:07 +0000 differ === added directory 'web_adblock/static/src/img' === added file 'web_adblock/static/src/img/icon.png' Binary files web_adblock/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and web_adblock/static/src/img/icon.png 2014-02-23 07:15:07 +0000 differ === modified file 'web_adblock/static/src/js/announcement.js' --- web_adblock/static/src/js/announcement.js 2013-12-28 06:25:35 +0000 +++ web_adblock/static/src/js/announcement.js 2014-02-23 07:15:07 +0000 @@ -1,3 +1,23 @@ +/****************************************************************************** +* +* OpenERP, Open Source Management Solution +* Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +* Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> +* +* 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/>. +* +******************************************************************************/ openerp_announcement = function(instance) { }; \ No newline at end of file === added directory 'web_polymorphic' === added file 'web_polymorphic/__init__.py' --- web_polymorphic/__init__.py 1970-01-01 00:00:00 +0000 +++ web_polymorphic/__init__.py 2014-02-23 07:15:07 +0000 @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +# Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> +# +# 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/>. +# +############################################################################## === added file 'web_polymorphic/__openerp__.py' --- web_polymorphic/__openerp__.py 1970-01-01 00:00:00 +0000 +++ web_polymorphic/__openerp__.py 2014-02-23 07:15:07 +0000 @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +# Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> +# +# 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/>. +# +############################################################################## +{'name': 'Web Polymorphic', + 'version': '0.1', + 'category': 'Web', + 'depends': ['web'], + 'author': 'Elico Corp', + 'license': 'AGPL-3', + 'website': 'https://www.elico-corp.com', + 'description': """ +Add a new widget named "polymorphic" +The polymorphic field allow to dynamically store an id linked to any model in +OpenERP instead of the usual fixed one in the view definition + +E.g: + +<field name="model" invisible="1" /> +<field name="object_id" widget="polymorphic" polymorphic="model" /> +""", + 'js': [ + 'static/src/js/view_form.js' + ], + 'installable': True, + 'application': False} === added directory 'web_polymorphic/static' === added file 'web_polymorphic/static/.DS_Store' Binary files web_polymorphic/static/.DS_Store 1970-01-01 00:00:00 +0000 and web_polymorphic/static/.DS_Store 2014-02-23 07:15:07 +0000 differ === added directory 'web_polymorphic/static/src' === added directory 'web_polymorphic/static/src/js' === added file 'web_polymorphic/static/src/js/view_form.js' --- web_polymorphic/static/src/js/view_form.js 1970-01-01 00:00:00 +0000 +++ web_polymorphic/static/src/js/view_form.js 2014-02-23 07:15:07 +0000 @@ -0,0 +1,47 @@ +/****************************************************************************** +* +* OpenERP, Open Source Management Solution +* Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +* Augustin Cisterne-Kaas <augustin.cisterne-k...@elico-corp.com> +* +* 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/>. +* +******************************************************************************/ +openerp.web_polymorphic = function (instance) { + instance.web.form.FieldPolymorphic = instance.web.form.FieldMany2One.extend( { + template: "FieldMany2One", + events: { + 'focus input': function(e) { + this.field.relation = this.field_manager.get_field_value(this.polymorphic); + }, + 'click input': function(e) { + this.field.relation = this.field_manager.get_field_value(this.polymorphic); + } + }, + init: function(field_manager, node) { + this._super(field_manager, node); + this.polymorphic = this.node.attrs.polymorphic; + }, + render_editable: function() { + var self = this; + this.$drop_down = this.$el.find(".oe_m2o_drop_down_button"); + this.$drop_down.click(function() { + self.polymorphic = self.node.attrs.polymorphic; + self.field.relation = self.field_manager.get_field_value(self.polymorphic); + }); + this._super(); + } + }); + instance.web.form.widgets.add('polymorphic', 'instance.web.form.FieldPolymorphic') +};
_______________________________________________ Mailing list: https://launchpad.net/~openerp-community Post to : openerp-community@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-community More help : https://help.launchpad.net/ListHelp