[Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

[Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

Maxime Chambreuil (http://www.savoirfairelinux.com)
Maxime Chambreuil (http://www.savoirfairelinux.com) has proposed merging lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1.

Requested reviews:
  Stefan Rijnhart (Therp) (stefan-therp)
  Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c): code review, no test
Related bugs:
  Bug #1187937 in Server Environment And Tools: "[6.1][mass_editing] TypeError when try to create a product.product edition registry"
  https://bugs.launchpad.net/server-env-tools/+bug/1187937

For more details, see:
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

=== added directory 'mass_editing'
=== added file 'mass_editing/mass_editing.py.OTHER'
--- mass_editing/mass_editing.py.OTHER 1970-01-01 00:00:00 +0000
+++ mass_editing/mass_editing.py.OTHER 2013-07-22 06:35:30 +0000
@@ -0,0 +1,101 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2012 Serpent Consulting Services (<http://www.serpentcs.com>)
+#    Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU 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 General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+
+
+from osv import fields, osv
+from tools.translate import _
+
+class mass_object(osv.osv):
+    _name = "mass.object"
+
+    _columns = {
+        'name' : fields.char("Name", size=64, required=True, select=1),
+        'model_id' : fields.many2one('ir.model', 'Model', required=True, select=1),
+        'field_ids' : fields.many2many('ir.model.fields', 'mass_field_rel', 'mass_id', 'field_id', 'Fields'),
+        'ref_ir_act_window':fields.many2one('ir.actions.act_window', 'Sidebar action', readonly=True,
+                                            help="Sidebar action to make this template available on records "
+                                                 "of the related document model"),
+        'ref_ir_value':fields.many2one('ir.values', 'Sidebar button', readonly=True,
+                                       help="Sidebar button to open the sidebar action"),
+        'model_ids': fields.many2many('ir.model', string='Model List')
+    }
+
+    def onchange_model(self, cr, uid, ids, model_id):
+        model_ids = []
+        if model_id:
+            model_obj = self.pool.get('ir.model')
+            model_data = model_obj.browse(cr, uid, model_id)
+            model_ids = [model_id]
+            active_model_obj = self.pool.get(model_data.model)
+            if active_model_obj._inherits:
+                for key, val in active_model_obj._inherits.items():
+                    found_model_ids = model_obj.search(cr, uid, [('model', '=', key)])
+                    if found_model_ids:
+                        model_ids.append(found_model_ids[0])
+        return {'value': {'model_ids': [(6, 0, model_ids)]}}
+
+    def create_action(self, cr, uid, ids, context=None):
+        vals = {}
+        action_obj = self.pool.get('ir.actions.act_window')
+        data_obj = self.pool.get('ir.model.data')
+        for data in self.browse(cr, uid, ids, context=context):
+            src_obj = data.model_id.model
+            button_name = _('Mass Editing (%s)') % data.name
+            vals['ref_ir_act_window'] = action_obj.create(cr, uid, {
+                 'name': button_name,
+                 'type': 'ir.actions.act_window',
+                 'res_model': 'mass.editing.wizard',
+                 'src_model': src_obj,
+                 'view_type': 'form',
+                 'context': "{'mass_editing_object' : %d}" % (data.id),
+                 'view_mode':'form,tree',
+                 'target': 'new',
+                 'auto_refresh':1
+            }, context)
+            vals['ref_ir_value'] = self.pool.get('ir.values').create(cr, uid, {
+                 'name': button_name,
+                 'model': src_obj,
+                 'key2': 'client_action_multi',
+                 'value': "ir.actions.act_window," + str(vals['ref_ir_act_window']),
+                 'object': True,
+             }, context)
+        self.write(cr, uid, ids, {
+                    'ref_ir_act_window': vals.get('ref_ir_act_window',False),
+                    'ref_ir_value': vals.get('ref_ir_value',False),
+                }, context)
+        return True
+
+    def unlink_action(self, cr, uid, ids, context=None):
+        for template in self.browse(cr, uid, ids, context=context):
+            try:
+                if template.ref_ir_act_window:
+                    self.pool.get('ir.actions.act_window').unlink(cr, uid, template.ref_ir_act_window.id, context)
+                if template.ref_ir_value:
+                    ir_values_obj = self.pool.get('ir.values')
+                    ir_values_obj.unlink(cr, uid, template.ref_ir_value.id, context)
+            except:
+                raise osv.except_osv(_("Warning"), _("Deletion of the action record failed."))
+        return True
+
+mass_object()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'mass_editing/mass_editing_view.xml.OTHER'
--- mass_editing/mass_editing_view.xml.OTHER 1970-01-01 00:00:00 +0000
+++ mass_editing/mass_editing_view.xml.OTHER 2013-07-22 06:35:30 +0000
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+
+        <record model="ir.ui.view" id="view_mass_object_form">
+            <field name="name">mass.object.form</field>
+            <field name="model">mass.object</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <form string="Object">
+                    <field name="name"/>
+                    <field name="model_id" on_change="onchange_model(model_id)"/>
+                    <field name="model_ids" invisible="1"/>
+                    <notebook colspan="4">
+                        <page string="Fields">
+                            <field name="field_ids" colspan="4" nolabel="1"
+                                domain="[('ttype', 'not in', ['one2many', 'refenrence', 'function']), ('model_id', 'in', model_ids[0][2])]"/>
+                        </page>
+                        <page string="Advance">
+                            <group colspan="2" col="2">
+                                <button name="create_action" string="Add sidebar button" type="object" icon="gtk-execute"
+                                        colspan="2" attrs="{'invisible':[('ref_ir_act_window','!=',False)]}"
+                                        help="Display a button in the sidebar of related documents to open a composition wizard"/>
+                                <field name="ref_ir_act_window" attrs="{'invisible':[('ref_ir_act_window','=',False)]}"/>
+                                <field name="ref_ir_value" attrs="{'invisible':[('ref_ir_act_window','=',False)]}"/>
+                                <button name="unlink_action" string="Remove sidebar button" type="object" icon="gtk-delete"
+                                         attrs="{'invisible':[('ref_ir_act_window','=',False)]}" colspan="2" />
+                            </group>
+                        </page>
+                    </notebook>
+                </form>
+            </field>
+        </record>
+
+        <record model="ir.ui.view" id="view_mass_object_tree">
+            <field name="name">mass.object.tree</field>
+            <field name="model">mass.object</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <tree string="Object">
+                    <field name="name"/>
+                    <field name="model_id"/>
+                </tree>
+            </field>
+        </record>
+
+        <record model="ir.actions.act_window" id="action_mass_object_form">
+            <field name="name">Mass Editing</field>
+            <field name="res_model">mass.object</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="view_id" ref="view_mass_object_tree" />
+        </record>
+
+        <record id="action_mass_object_form_view1" model="ir.actions.act_window.view">
+            <field eval="10" name="sequence"/>
+            <field name="view_mode">tree</field>
+            <field name="view_id" ref="view_mass_object_tree"/>
+            <field name="act_window_id" ref="action_mass_object_form"/>
+        </record>
+        <record id="action_mass_object_form_view2" model="ir.actions.act_window.view">
+            <field eval="20" name="sequence"/>
+            <field name="view_mode">form</field>
+            <field name="view_id" ref="view_mass_object_form"/>
+            <field name="act_window_id" ref="action_mass_object_form"/>
+        </record>
+
+        <menuitem id="menu_mass_editing" name="Mass Editing" parent="base.menu_config" sequence="6"/>
+
+        <menuitem id="menu_mass_object_view" action="action_mass_object_form" parent="menu_mass_editing"/>
+
+    </data>
+</openerp>


_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

Stefan Rijnhart (Therp)
Review: Needs Fixing

Hi Maxime,

first of all, the branch is borked and cannot be merged with the 6.1 series of the project without the conflict mentioned at the top of this page. You could try crafting a new branch with the module directory from this one. As a result, I cannot refer to line numbers in the (incomplete) diff.

About the module in 7.0: I was pretty happy with how it looked at merge time. I compared its code with the code in this branch. Changes from it that you should probably include here:

7.0 removes its act window and ir value upon unlinking. The code is present in 6.1 but it is not called.
6.1 still contains the typo 'refenrence'. In the same line, it still excludes field type 'one2many'. The 7.0 does not exclude it anymore (although I am still a bit dubious about that but I haven't tested).
6.1 still contains typo 'Advance' in the page view element. Change to Advanced
6.1: permissions on mass.object for group_users are too wide. Set to readonly (1,0,0,0)
6.1 still contains the Serpent logo. 7.0 does not
6.1 still contains the bug causing data loss in the case of attempting to remove a *selection* of m2m items

Changes not to include:

The 7.0 still contains the (by now unnecessary) unguided override of ir.model.fields::search().

--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

Maxime Chambreuil (http://www.savoirfairelinux.com)
In reply to this post by Maxime Chambreuil (http://www.savoirfairelinux.com)
Hi Stefan,

Thanks for the review.

unlink_action is used in the view (l345).

Typo fixed. 'one2many' removed from the exclude list.

Typo fixed.

Permissions fixed.

Logo removed from the wizard.

Data loss bug not fixed yet.
--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

Stefan Rijnhart (Therp)
In reply to this post by Maxime Chambreuil (http://www.savoirfairelinux.com)
Hi Maxime,

Thanks. Don't you need to call unlink_action in the model's unlink() method to prevent dangling act_windows? The dataloss is easy to fix, just apply the (3, id) directive to remove specific items.


--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

Stefan Rijnhart (Therp)
In reply to this post by Maxime Chambreuil (http://www.savoirfairelinux.com)
Review: Needs Fixing

I received a resubmit in my mail, meaning that you put the status of this MP to 'Needs review', but the dataloss issue has not yet been resolved.

--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

Stefan Rijnhart (Therp)
In reply to this post by Maxime Chambreuil (http://www.savoirfairelinux.com)
I'm proposing the long awaited change (AFAIK) to this branch here: https://code.launchpad.net/~therp-nl/server-env-tools/6.1-mass_editing-fix_dataloss/+merge/201321
--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

Stefan Rijnhart (Therp)
In reply to this post by Maxime Chambreuil (http://www.savoirfairelinux.com)
or rather: AFAIC
--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

Sandy Carter (http://www.savoirfairelinux.com)
In reply to this post by Maxime Chambreuil (http://www.savoirfairelinux.com)
Review: Needs Information

@Stefan, could you please explain the dataloss issue in this frame, I don't quite understand.
How does the branch you propose come into play here?
--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

Stefan Rijnhart (Therp)
In reply to this post by Maxime Chambreuil (http://www.savoirfairelinux.com)
l.550: when the user makes a selection of m2m values to remove, the code executes a [(5, 0, [])]. This removes all values. My branch executes a [(3, value) for each value].

--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

Sandy Carter (http://www.savoirfairelinux.com)
In reply to this post by Maxime Chambreuil (http://www.savoirfairelinux.com)
Review: Approve


--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

Re: [Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

Stefan Rijnhart (Therp)
In reply to this post by Maxime Chambreuil (http://www.savoirfairelinux.com)
Review: Approve

Thanks for taking my suggestions!

--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

[Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

Sandy Carter (http://www.savoirfairelinux.com)
In reply to this post by Maxime Chambreuil (http://www.savoirfairelinux.com)
The proposal to merge lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1 has been updated.

    Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

[Openerp-community] [Merge] lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1

noreply
In reply to this post by Maxime Chambreuil (http://www.savoirfairelinux.com)
The proposal to merge lp:~openerp-community/server-env-tools/6.1-mass_editing into lp:server-env-tools/6.1 has been updated.

    Status: Approved => Merged

For more details, see:
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|

[Openerp-community] different stuff

debaetsr
In reply to this post by Maxime Chambreuil (http://www.savoirfairelinux.com)
Hello,

I've found a lot of interesting stuff that you might like, just  take a look <http://name.piratebrain.com/e4epbxi>

Very truly yours, ruben



--
https://code.launchpad.net/~openerp-community/server-env-tools/6.1-mass_editing/+merge/161619
Your team OpenERP Community is subscribed to branch lp:~openerp-community/server-env-tools/6.1-mass_editing.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp