Browse Source

[ADD] Initial Commit

pull/45/head
SHEREEF PT 8 years ago
parent
commit
eda8299d90
  1. 26
      one2many_mass_select_delete/README.rst
  2. 22
      one2many_mass_select_delete/__init__.py
  3. 46
      one2many_mass_select_delete/__manifest__.py
  4. BIN
      one2many_mass_select_delete/static/description/after_delete.png
  5. BIN
      one2many_mass_select_delete/static/description/after_select.png
  6. BIN
      one2many_mass_select_delete/static/description/banner.jpg
  7. BIN
      one2many_mass_select_delete/static/description/cybro_logo.png
  8. BIN
      one2many_mass_select_delete/static/description/delete.png
  9. BIN
      one2many_mass_select_delete/static/description/icon.png
  10. 112
      one2many_mass_select_delete/static/description/index.html
  11. BIN
      one2many_mass_select_delete/static/description/one2many.png
  12. BIN
      one2many_mass_select_delete/static/description/select.png
  13. 120
      one2many_mass_select_delete/static/src/js/widget.js
  14. 12
      one2many_mass_select_delete/static/src/xml/widget_view.xml
  15. 9
      one2many_mass_select_delete/views/web_assets.xml

26
one2many_mass_select_delete/README.rst

@ -0,0 +1,26 @@
=====================================
On2many Mass Select Delete Widget v10
=====================================
On2many Mass Select/Deselect Widget.
Installation
============
Just select it from available modules to install it, there is no need to extra installations.
Configuration
=============
<field name="order_lines" widget="one2many_delete">
Features
========
* Mass Selection.
* Mass Deletion.
Credits
=======
Developer: Nilmar Shereef @ cybrosys, shereef@cybrosys.in

22
one2many_mass_select_delete/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Nilmar Shereef(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

46
one2many_mass_select_delete/__manifest__.py

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Nilmar Shereef(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'On2many Mass Select Delete Widget',
'version': '10.0.1.0',
'summary': """On2many Mass Select/Deselect Widget""",
'description': """On2many Mass Select/ Deselect Widget""",
'category': 'Tools',
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': "https://www.cybrosys.com",
'depends': ['web'],
'data': [
'views/web_assets.xml',
],
'qweb': [
'static/src/xml/widget_view.xml',
],
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'installable': True,
'images': ['static/description/banner.jpg'],
'auto_install': False,
'application': False,
}

BIN
one2many_mass_select_delete/static/description/after_delete.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
one2many_mass_select_delete/static/description/after_select.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

BIN
one2many_mass_select_delete/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

BIN
one2many_mass_select_delete/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
one2many_mass_select_delete/static/description/delete.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
one2many_mass_select_delete/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

112
one2many_mass_select_delete/static/description/index.html

@ -0,0 +1,112 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">On2many Mass Select/ Deselect Widget</h2>
<h3 class="oe_slogan">Managing Multiple Selection/Deselection of One2many Fields</h3>
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4>
</div>
<div class="oe_row oe_spaced" style="padding-left:65px;">
<h4>Widgets For:</h4>
<div>
<span style="color:green;"> &#9745; </span> Mass Selection.<br/>
<span style="color:green;"> &#9745; </span> Mass Deletion.<br/>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_picture">
<h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32" style="text-align: justify;">
If we want to Select/Deselect a few order lines from a lengthy Sale Order/Purchase Order (Case: 10+ Order lines),
We have two ways, individually delete orderline one by one from Purchase/Sale order or create a new order.
This module eliminates this issue by introducing a new widget "Mass Select/ Deselect Widget"; which can be used in
any One2Many fields to perform mass select/deselect.
<b><i>widget="one2many_delete"</i></b>
</p>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="text-align: center">
<p>
<h4>Widget</h4>
<p>
<span>We can see a new widget with two buttons and selection option for One2Many fields.</span>
</div>
<div style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="one2many.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h3 class="oe_slogan">Mass Selection</h3>
<div style="text-align: center">
<span >We can select the one or more lines and click on Select button.</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="select.png">
</div>
<span>Before Selection</span>
</div>
<div style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="after_select.png">
</div>
<span>After Selection</span>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<h3 class="oe_slogan">Mass Deletion</h3>
<div style="text-align: center">
<span >We can select the one or more lines and click on Deselect button.</span>
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="delete.png">
</div>
<span>Before Deletion</span>
</div>
<div style="text-align: center">
<div class="oe_demo oe_picture oe_screenshot">
<img style="border:10px solid white;" src="after_delete.png">
</div>
<span>After Deletion</span>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

BIN
one2many_mass_select_delete/static/description/one2many.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
one2many_mass_select_delete/static/description/select.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

120
one2many_mass_select_delete/static/src/js/widget.js

@ -0,0 +1,120 @@
odoo.define('web.one2many_mass_select_delete', function(require) {
"use strict";
var Model = require('web.Model');
var core = require('web.core');
var delete_on2many = core.form_widget_registry.get('one2many');
var _t = core._t;
var One2manyDelete = delete_on2many.extend({
template: 'One2manyDelete',
multi_selection: true,
init: function() {
this._super.apply(this, arguments);
},
render_value: function ()
{
this._super.apply(this, arguments);
var self=this;
if (this.get('readonly')) {
self.$('.mass_delete_buttons').hide();
}
else{
self.$('.mass_delete_buttons').show();
}
self.$el.find(".button_mass_delete").click(function(){
self.delete_selected_lines();
});
self.$el.find(".button_mass_select").click(function(){
self.selected_lines();
});
},
delete_selected_lines: function()
{
var self = this;
var current_model = new Model(this.dataset.model);
var selected_lines = self.find_deleted_lines();
if (selected_lines.length === 0) {
this.do_warn(_t("Please Select at least One Record.!"));
return false;
}
var w_response = confirm("Dou you want to delete.?");
if (w_response) {
current_model.call('unlink', [selected_lines], {context: self.dataset.context})
.then(function () {
window.location.reload()
});
}
},
selected_lines: function()
{
var self = this;
var current_model = new Model(this.dataset.model);
var select_lines = self.find_selected_lines();
if (select_lines.length === 0)
{
this.do_warn(_t("Please Select at least One Record"));
return false;
}
var w_response = confirm("Dou You Want to Select");
if (w_response) {
current_model.call('unlink', [select_lines], {context: self.dataset.context})
.then(function (result) {
window.location.reload()
});
}
},
find_deleted_lines: function ()
{
var selected_list =[];
this.$el.find('td.o_list_record_selector input:checked')
.closest('tr').each(function () {
selected_list.push(parseInt($(this).context.dataset.id));
});
return selected_list;
},
find_selected_lines: function ()
{
var selected_list =[];
var selected_list1 =[];
var selected_list2 =[];
this.$el.find('td.o_list_record_selector input:checked')
.closest('tr').each(function () {
selected_list.push(parseInt($(this).context.dataset.id));
});
if (selected_list.length != 0) {
this.$el.find('td.o_list_record_selector')
.closest('tr').each(function () {
selected_list1.push(parseInt($(this).context.dataset.id));
});
selected_list2 = selected_list1.filter(function (x) {
return selected_list.indexOf(x) < 0
});
}
return selected_list2;
},
process_modifiers: function () {
var self = this;
this._super();
if (this.get('readonly')) {
self.$('.mass_delete_buttons').hide();
}
else{
self.$('.mass_delete_buttons').show();
}
}
});
core.form_widget_registry.add('one2many_delete', One2manyDelete);
return {
One2manyDelete: One2manyDelete
};
});

12
one2many_mass_select_delete/static/src/xml/widget_view.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="One2manyDelete">
<div>
<div class="mass_delete_buttons" style="padding-left:746px;" >
<button class="btn button_mass_delete fa fa-trash oe_highlight"/>
<button class="btn button_mass_select fa fa-check oe_highlight"/>
</div>
</div>
</t>
</templates>

9
one2many_mass_select_delete/views/web_assets.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="assets_backend" name="one2many_mass_select_delete one2many_delete" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/one2many_mass_select_delete/static/src/js/widget.js"></script>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save