Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f256f72
[IMP]mass_editing:Improved the module code for v11.
Trivedi-Vacha-SerpentCS Nov 10, 2017
3d8a096
[FIX]mass_editing:Fixed travis error.
Trivedi-Vacha-SerpentCS Nov 10, 2017
bf64e7c
Merge pull request #26 from Trivedi-Vacha/11.0
JayVora-SerpentCS Nov 10, 2017
62e1962
[IMP]mass_editing:Improved index file.
Trivedi-Vacha-SerpentCS Nov 21, 2017
91a0f9d
Update template.xml
JayVora-SerpentCS Nov 29, 2017
5e13c12
Update test_mass_editing.py
JayVora-SerpentCS Nov 29, 2017
179eba9
Update .travis.yml
JayVora-SerpentCS Nov 29, 2017
ee8a0b4
Update test_mass_editing.py
JayVora-SerpentCS Nov 29, 2017
a2eaeb2
Update test_mass_editing.py
JayVora-SerpentCS Nov 29, 2017
d71998b
Update mass_object.py
JayVora-SerpentCS Nov 29, 2017
49a8bae
Update mass_object.py
JayVora-SerpentCS Nov 29, 2017
af2442c
Merge pull request #27 from Trivedi-Vacha/11.0
JayVora-SerpentCS Nov 29, 2017
c643a04
Update mass_editing_view.xml
JayVora-SerpentCS Jan 30, 2018
7a597ad
Update ir_model_fields.py
JayVora-SerpentCS Jan 30, 2018
13697fa
[IMP] Improved the Test case for the search method
saif-serpentcs Jan 31, 2018
c875077
[FIX]Fixed the Basestring and search fields base on model
saif-serpentcs Feb 1, 2018
a225ce7
Update ir_model_fields.py
saif-serpentcs Feb 1, 2018
7b20c51
[FIX]Fixed travis
saif-serpentcs Feb 1, 2018
16bee54
[FIX]Fixed travis
saif-serpentcs Feb 1, 2018
e897f85
Fixed travis
saif-serpentcs Feb 1, 2018
9ecf26b
Fixed travis
saif-serpentcs Feb 1, 2018
a8f3c79
[FIX]Fixed travis
saif-serpentcs Feb 1, 2018
4fffed3
[FIX]Fixed travis
saif-serpentcs Feb 1, 2018
709bffa
Fixed js travis
saif-serpentcs Feb 1, 2018
f9b0760
Merge pull request #29 from saif-serpentcs/11.0
JayVora-SerpentCS Feb 1, 2018
97b326e
[FIX]mass_editing:Fixed the Remove option for O2m fields.
Trivedi-Vacha-SerpentCS Jun 20, 2018
d7932c1
[FIX]mass_editing:Fixed Travis and m2m remove all data.
Trivedi-Vacha-SerpentCS Jun 29, 2018
1ab55fd
[FIX]mass_editing:Fixed Travis.
Trivedi-Vacha-SerpentCS Jun 29, 2018
42b23b9
Merge pull request #34 from Trivedi-Vacha-SerpentCS/11.0
JayVora-SerpentCS Jun 29, 2018
beda204
Update README.md
JayVora-SerpentCS Dec 13, 2018
71a8b39
[add] module 'web' in depends
mrddter Apr 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
language: python
sudo: false
cache: pip

python:
- "2.7"

addons:
postgresql: "9.2" # minimal postgresql version for the daterange method
apt:
packages:
packages:
- expect-dev # provides unbuffer utility
- python-lxml # because pip installation is slow


language: python

python:
- "3.5"

env:
global:
- VERSION="10.0" TESTS="0" LINT_CHECK="0" TRANSIFEX="0"
- VERSION="11.0" TESTS="0" LINT_CHECK="0" TRANSIFEX="0"
- TRANSIFEX_USER='[email protected]'
- secure: Z06mZCN+Hm3myqHSOZpOOk1pd4oq1epAWZv6m9OX2bTNHbhyOVOGK6JWWsnDm/3DUCN1ZeLtSGOl9bvQfMa8ahQHA80MkLL16YlTvQV59Lh+L2gAYmxX+ogJCJgeQSVAXlGLscgkADCu/HzDlmatrDeROMtULn5i23j2qcyUNyM=


matrix:
- LINT_CHECK="1"
- TRANSIFEX="1"
- TESTS="1" ODOO_REPO="odoo/odoo"
- TESTS="1" ODOO_REPO="OCA/OCB"
- TESTS="1" ODOO_REPO="odoo/odoo"


virtualenv:
system_site_packages: true
before_install:
- "export DISPLAY=:911.0"
- "sh -e /etc/init.d/xvfb start"

install:
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- export WKHTMLTOPDF_VERSION=0.12.4
- travis_install_nightly
- printf '[options]\n\nrunning_env = dev\n' > ${HOME}/.openerp_serverrc
- ln -s ${TRAVIS_BUILD_DIR}/server_environment_files_sample ${TRAVIS_BUILD_DIR}/server_environment_files

script:
- travis_run_tests

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/JayVora-SerpentCS/MassEditing.svg?branch=10.0)](https://travis-ci.org/JayVora-SerpentCS/MassEditing)
[![Build Status](https://travis-ci.org/JayVora-SerpentCS/MassEditing.svg?branch=11.0)](https://travis-ci.org/JayVora-SerpentCS/MassEditing)

============
Mass Editing
Expand Down
1 change: 0 additions & 1 deletion mass_editing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# © 2016 Serpent Consulting Services Pvt. Ltd. ([email protected])
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

Expand Down
5 changes: 3 additions & 2 deletions mass_editing/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# © 2016 Serpent Consulting Services Pvt. Ltd. ([email protected])
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Mass Editing',
'version': '10.0.1.0.0',
'version': '11.0.1.0.0',
'author': 'Serpent Consulting Services Pvt. Ltd., '
'Odoo Community Association (OCA)',
'contributors': [
Expand All @@ -18,10 +17,12 @@
'uninstall_hook': 'uninstall_hook',
'depends': [
'base',
'web',
],
'data': [
'security/ir.model.access.csv',
'views/mass_editing_view.xml',
'views/template.xml'
],
'installable': True,
'application': False,
Expand Down
9 changes: 2 additions & 7 deletions mass_editing/hooks.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# -*- coding: utf-8 -*-
# © 2016 Serpent Consulting Services Pvt. Ltd. ([email protected])
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


def uninstall_hook(cr, registry):
cr.execute("""SELECT id FROM ir_act_window
WHERE res_model = 'mass.editing.wizard'""")
for res in cr.dictfetchall():
value = 'ir.actions.act_window,%s' % res.get('id')
cr.execute("DELETE FROM ir_values WHERE value = '%s'" % value)
return True
cr.execute("""DELETE FROM ir_act_window WHERE
res_model = 'mass.editing.wizard'""")
1 change: 0 additions & 1 deletion mass_editing/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# © 2016 Serpent Consulting Services Pvt. Ltd. ([email protected])
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

Expand Down
26 changes: 15 additions & 11 deletions mass_editing/models/ir_model_fields.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# © 2016 Serpent Consulting Services Pvt. Ltd. ([email protected])
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

Expand All @@ -11,14 +10,19 @@ class IrModelFields(models.Model):
@api.model
def search(self, args, offset=0, limit=0, order=None, count=False):
model_domain = []
for domain in args:
if (len(domain) > 2 and domain[0] == 'model_id' and
isinstance(domain[2], basestring) and
list(domain[2][1:-1])):
model_domain += [('model_id', 'in',
map(int, domain[2][1:-1].split(',')))]
else:
model_domain.append(domain)
return super(IrModelFields, self).search(model_domain, offset=offset,
limit=limit, order=order,
if not self.env.context.get('mass_edit', False):
model_domain = args
else:
for domain in args:
if (len(domain) > 2 and domain[0] == 'model_id' and
isinstance(domain[2], str) and
list(domain[2][1:-1])):
model_ids = list(map(int, domain[2][1:-1].split(',')))
model_domain += [('model_id', 'in', model_ids)]
else:
model_domain.append(domain)
return super(IrModelFields, self).search(args=model_domain,
offset=offset,
limit=limit,
order=order,
count=count)
28 changes: 8 additions & 20 deletions mass_editing/models/mass_object.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# © 2016 Serpent Consulting Services Pvt. Ltd. ([email protected])
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

Expand All @@ -10,24 +9,20 @@ class MassObject(models.Model):
_name = "mass.object"
_description = "Mass Editing Object"

name = fields.Char('Name', required=True, select=1)
name = fields.Char('Name', required=True, index=True)
model_id = fields.Many2one('ir.model', 'Model', required=True,
help="Model is used for Selecting Fields. "
"This is editable until Sidebar menu "
"is not created.")
field_ids = fields.Many2many('ir.model.fields', 'mass_field_rel',
'mass_id', 'field_id', 'Fields')
ref_ir_act_window_id = fields.Many2one('ir.actions.act_window',
'Sidebar action',
'Sidebar Action',
readonly=True,
help="Sidebar action to make this "
"template available on "
"records of the related "
"document model.")
ref_ir_value_id = fields.Many2one('ir.values', 'Sidebar button',
readonly=True,
help="Sidebar button to open "
"the sidebar action.")
model_list = fields.Char('Model List')

_sql_constraints = [
Expand All @@ -43,8 +38,10 @@ def _onchange_model_id(self):
model_list = [self.model_id.id]
active_model_obj = self.env[self.model_id.model]
if active_model_obj._inherits:
keys = active_model_obj._inherits.keys()
inherits_model_list = model_obj.search([('model', 'in', keys)])
model_names = active_model_obj._inherits.keys()
inherits_model_list = model_obj.search([('model',
'in',
list(model_names))])
model_list.extend((inherits_model_list and
inherits_model_list.ids or []))
self.model_list = model_list
Expand All @@ -63,16 +60,9 @@ def create_action(self):
'src_model': src_obj,
'view_type': 'form',
'context': "{'mass_editing_object' : %d}" % (self.id),
'view_mode': 'form, tree',
'view_mode': 'form',
'target': 'new',
'auto_refresh': 1,
}).id
vals['ref_ir_value_id'] = self.env['ir.values'].create({
'name': button_name,
'model': src_obj,
'key2': 'client_action_multi',
'value': "ir.actions.act_window," +
str(vals['ref_ir_act_window_id']),
'binding_model_id': self.model_id.id,
}).id
self.write(vals)
return True
Expand All @@ -83,8 +73,6 @@ def unlink_action(self):
try:
if mass.ref_ir_act_window_id:
mass.ref_ir_act_window_id.unlink()
if mass.ref_ir_value_id:
mass.ref_ir_value_id.unlink()
except:
raise UserError(_("Deletion of the action record failed."))
return True
Expand Down
Binary file removed mass_editing/static/description/after_edit_note.png
Binary file not shown.
Binary file removed mass_editing/static/description/after_mass_edit.png
Binary file not shown.
17 changes: 9 additions & 8 deletions mass_editing/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ <h4 class="oe_slogan" style="color:#875A7B;"> </h4>
<p>The user can remove the action by clicking on the "Remove Sidebar Button".</p>
</div>
<div class="col-md-8 mt16">
<img class="img img-responsive" src="remove_button.png">
<img class="img img-responsive" src="remove_button2.png">
</div>
</div>


<div class="row mt32" style="font-size:15px">
<div class="col-md-8 mt16">
<img class="img img-responsive" src="mass_editing_menu.png">
<img class="img img-responsive" src="mass_edit_menu.png">
</div>
<div class="col-md-4 text-justify mt32">
<p>Go to the model/object in which mass editing is configured (ex. Partner).</p>
Expand All @@ -39,26 +39,27 @@ <h4 class="oe_slogan" style="color:#875A7B;"> </h4>

<div class="row mt32" style="overflow: hidden;background: #efefef;box-shadow: none;font-size:15px">
<div class="col-md-8 mt16">
<img class="img img-responsive" src="mass_edit_wizard.png">
<img class="img img-responsive" src="mass_edit_copy.png">
</div>
<div class="col-md-4 text-justify mt32">
<p>The user can set or remove the value of the fields which were configured in mass editing configuration.</p>
<p>The user can set or remove the value of the fields which were configured in mass editing configuration.
you can also copy the value of the fields from another field.</p>
</div>
</div>

<div class="row mt32" style='font-size:15px'>
<div class="row mt32" style='font-size:15px'>
<div class="col-md-4 text-justify mt32">
<p>You can see the mass editing changes in customer tree view..</p>
</div>
<div class="col-md-8 mt16">
<img class="img img-responsive" src="after_mass_edit.png">
<img class="img img-responsive" src="mass_edit_tree.png">
</div>
</div>
</div>


<div class="row mt32" style="overflow: hidden;background: #efefef;box-shadow: none;font-size:15px">
<div class="col-md-8 mt16">
<img class="img img-responsive" src="after_edit_note.png">
<img class="img img-responsive" src="mass_edit_result.png">
</div>
<div class="col-md-4 text-justify mt32">
<p>You can see the mass editing changes in selected customer</p>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed mass_editing/static/description/mass_edit_wizard.png
Binary file not shown.
Binary file modified mass_editing/static/description/mass_editing-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file removed mass_editing/static/description/remove_button.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions mass_editing/static/src/js/mass_editing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
odoo.define('mass_editing.mass_editing', function (require) {
"use strict";

var BasicModel = require("web.BasicModel");

BasicModel.include({
/**
* parse the server values to javascript framwork
* @param {String} fieldNames
* @param {Object} element the dataPoint used as parent for the created
* dataPoints
* @param {Object} data the server data to parse
*/
_parseServerData: function (fieldNames, element, data) {
var self = this;
_.each(fieldNames, function (fieldName) {
var field = element.fields[fieldName];
var val = data[fieldName];
if (field.type === 'many2one') {
// process many2one: split [id, nameget] and create corresponding record
// For val = Null
if (val && val !== false) {
// the many2one value is of the form [id, display_name]
var r = self._makeDataPoint({
modelName: field.relation,
fields: {
display_name: {type: 'char'},
id: {type: 'integer'},
},
data: {
display_name: val[1],
id: val[0],
},
parentID: element.id,
});
data[fieldName] = r.id;
} else {
// no value for the many2one
data[fieldName] = false;
}
} else {
data[fieldName] = self._parseServerValue(field, val);
}
});
},
});

});
1 change: 0 additions & 1 deletion mass_editing/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# © 2016 Serpent Consulting Services Pvt. Ltd. ([email protected])
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

Expand Down
29 changes: 17 additions & 12 deletions mass_editing/tests/test_mass_editing.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
# © 2016 Serpent Consulting Services Pvt. Ltd. ([email protected])
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import ast

from odoo.tests import common
from odoo.modules import registry
from odoo.addons.mass_editing.hooks import uninstall_hook
from ..hooks import uninstall_hook


class TestMassEditing(common.TransactionCase):
Expand All @@ -21,11 +20,21 @@ def setUp(self):
self.partner_model = model_obj.\
search([('model', '=', 'res.partner')])
self.user_model = model_obj.search([('model', '=', 'res.users')])
# Calling the Search method without context for
# the Search from the List view of the Fields.
self.fields_model = self.env['ir.model.fields'].\
search([('model_id', '=', self.partner_model.id),
('name', 'in', ['email', 'phone', 'category_id', 'comment',
'country_id', 'customer', 'child_ids',
'title'])])
# Calling the Search method with context for the Search
# model_id field related fields in the fields_ids.
self.fields_model = self.env['ir.model.fields'].\
with_context({'mass_edit': True}).\
search([('model_id', '=', self.partner_model.id),
('name', 'in', ['email', 'phone', 'category_id', 'comment',
'country_id', 'customer', 'child_ids',
'title'])])
self.mass = self._create_mass_editing(self.partner_model,
self.fields_model)
self.copy_mass = self.mass.copy()
Expand Down Expand Up @@ -142,21 +151,19 @@ def test_mass_edit_copy(self):

def test_sidebar_action(self):
"""Test if Sidebar Action is added / removed to / from give object."""
action = self.mass.ref_ir_act_window_id and self.mass.ref_ir_value_id
action = self.mass.ref_ir_act_window_id
self.assertTrue(action, 'Sidebar action must be exists.')
# Remove the sidebar actions
self.mass.unlink_action()
action = self.mass.ref_ir_act_window_id and self.mass.ref_ir_value_id
action = self.mass.ref_ir_act_window_id
self.assertFalse(action, 'Sidebar action must be removed.')

def test_unlink_mass(self):
"""Test if related actions are removed when mass editing
record is unlinked."""
mass_action_id = "ir.actions.act_window," + str(self.mass.id)
self.mass.unlink()
value_cnt = self.env['ir.values'].search([('value', '=',
mass_action_id)],
count=True)
value_cnt = self.env['ir.actions.act_window'].search([
('res_model', '=', 'mass.editing.wizard')], count=True)
self.assertTrue(value_cnt == 0,
"Sidebar action must be removed when mass"
" editing is unlinked.")
Expand All @@ -165,10 +172,8 @@ def test_uninstall_hook(self):
"""Test if related actions are removed when mass editing
record is uninstalled."""
uninstall_hook(self.cr, registry)
mass_action_id = "ir.actions.act_window," + str(self.mass.id)
value_cnt = self.env['ir.values'].search([('value', '=',
mass_action_id)],
count=True)
value_cnt = self.env['ir.actions.act_window'].search([
('res_model', '=', 'mass.editing.wizard')], count=True)
self.assertTrue(value_cnt == 0,
"Sidebar action must be removed when mass"
" editing module is uninstalled.")
Loading