From a36146430decfca525de11e34424c8388ddb258e Mon Sep 17 00:00:00 2001 From: ara <> Date: Wed, 30 May 2012 16:01:20 +0530 Subject: [PATCH 001/408] portal:Improve portal wizard of contact bzr revid: mma@tinyerp.com-20120530103120-as3coz6hx3y2cvbg --- addons/portal/wizard/portal_wizard.py | 68 ++++++++++++++++++--------- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py index 1ec4cbb0e4b..3b5a0c31b8c 100644 --- a/addons/portal/wizard/portal_wizard.py +++ b/addons/portal/wizard/portal_wizard.py @@ -91,11 +91,20 @@ class wizard(osv.osv_memory): def _default_user_ids(self, cr, uid, context): """ determine default user_ids from the active records """ def create_user_from_address(address): - return { # a user config based on a contact (address) + has_portal=False + portal_id = context.get('portal_id',False) + portal_users = self.pool.get('res.portal').browse(cr,uid,portal_id).group_id.users + active_user = [u.login for u in portal_users] + if address.email in active_user: + has_portal = True + + return { # a user config based on a contact (address) 'name': address.name, 'user_email': extract_email(address.email), 'lang': address.parent_id and address.parent_id.lang or 'en_US', 'partner_id': address.parent_id and address.parent_id.id, + 'has_portal_user':has_portal, + 'portal_id': context.get('portal_id', False) } user_ids = [] @@ -112,9 +121,13 @@ class wizard(osv.osv_memory): return user_ids - _defaults = { - 'user_ids': _default_user_ids - } + def onchange_portal_id(self, cr, uid, ids, portal_id=False, context=None): + if not portal_id: + return {'value': {}} + user_obj = self.pool.get('res.users') + context.update({'portal_id':portal_id}) + user_list = self._default_user_ids(cr, uid, context=context) + return {'value': {'user_ids': user_list}} def action_create(self, cr, uid, ids, context=None): """ create new users in portal(s), and notify them by email """ @@ -133,25 +146,33 @@ class wizard(osv.osv_memory): portal_obj = self.pool.get('res.portal') for wiz in self.browse(cr, uid, ids, context): # determine existing users - login_cond = [('login', 'in', [u.user_email for u in wiz.user_ids])] - existing_uids = user_obj.search(cr, ROOT_UID, login_cond) - existing_users = user_obj.browse(cr, ROOT_UID, existing_uids) - existing_logins = [u.login for u in existing_users] - - # create new users in portal (skip existing logins) - new_users_data = [ { - 'name': u.name, - 'login': u.user_email, - 'password': random_password(), - 'user_email': u.user_email, - 'context_lang': u.lang, - 'share': True, - 'action_id': wiz.portal_id.home_action_id and wiz.portal_id.home_action_id.id or False, - 'partner_id': u.partner_id and u.partner_id.id, - } for u in wiz.user_ids if u.user_email not in existing_logins ] - portal_obj.write(cr, ROOT_UID, [wiz.portal_id.id], - {'users': [(0, 0, data) for data in new_users_data]}, context0) - + + for u in wiz.user_ids: + login_cond = [('login', 'in', [u.user_email])] + existing_uids = user_obj.search(cr, ROOT_UID, login_cond) + existing_users = user_obj.browse(cr, ROOT_UID, existing_uids) + existing_logins = [user.login for user in existing_users] + new_users_data = [] + if u.has_portal_user==False: + new_users_data = [] + if u.user_email in existing_logins: + portal_uids = user_obj.search(cr, ROOT_UID, [('login','=',u.user_email),('partner_id', '=', u.partner_id.id)]) + user_obj.unlink(cr,uid,portal_uids) + else: + if u.user_email not in existing_logins: + new_users_data.append({ + 'name': u.name, + 'login': u.user_email, + 'password': random_password(), + 'user_email': u.user_email, + 'context_lang': u.lang, + 'share': True, + 'action_id': wiz.portal_id.home_action_id and wiz.portal_id.home_action_id.id or False, + 'partner_id': u.partner_id and u.partner_id.id, + } ) + portal_obj.write(cr, ROOT_UID, [wiz.portal_id.id], + {'users': [(0, 0, data) for data in new_users_data]}, context0) + # send email to all users (translated in their language) data = { 'company': user.company_id.name, @@ -205,6 +226,7 @@ class wizard_user(osv.osv_memory): help="The language for the user's user interface"), 'partner_id': fields.many2one('res.partner', string='Partner'), + 'has_portal_user':fields.boolean('Has portal access') } def _check_email(self, cr, uid, ids): From 60df377cdfc992b75657749e9ec6f3f6903dee4c Mon Sep 17 00:00:00 2001 From: ara-desktop <> Date: Wed, 30 May 2012 16:37:44 +0530 Subject: [PATCH 002/408] portal:add missing xml file changes bzr revid: mma@tinyerp.com-20120530110744-4lufcl4veemhvewn --- addons/portal/wizard/portal_wizard_view.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/portal/wizard/portal_wizard_view.xml b/addons/portal/wizard/portal_wizard_view.xml index 7f36272720c..0f49c25d108 100644 --- a/addons/portal/wizard/portal_wizard_view.xml +++ b/addons/portal/wizard/portal_wizard_view.xml @@ -17,7 +17,7 @@ form
- + @@ -30,7 +30,7 @@ diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 3e1f2ac01cd..b6880dab90d 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1589,7 +1589,6 @@ tree,form - {'view_mode':True} @@ -1599,7 +1598,6 @@ form tree,form - [('partner_id.customer','=',True)] diff --git a/addons/account/static/src/css/account_move_reconciliation.css b/addons/account/static/src/css/account_move_reconciliation.css index a60d7c24788..2757227ac2d 100644 --- a/addons/account/static/src/css/account_move_reconciliation.css +++ b/addons/account/static/src/css/account_move_reconciliation.css @@ -11,6 +11,23 @@ margin: 2px; } +.openerp .oe_pager_button{ + float: left; + height: 22px; + line-height: 24px; + display: inline-block; + border: 1px solid #ababab; + color: #4c4c4c; + cursor: pointer; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + padding: 0 5px 0 5px; + margin: 0 2px 0 2px; + float: left; + border-right: 1px solid #ababab; +} + .openerp .oe_pager_m2o li { display: inline-block; height: 24px; diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index f6204c2e0d2..53d1b27f820 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -4,7 +4,6 @@ var _t = instance.web._t, instance.web.views.add('form_clone', 'instance.account.extend_form_view'); instance.web.form.tags.add('list_button','instance.account.list_button') instance.web.form.tags.add('btn_extend','instance.account.btn_extend') -instance.web.form.widgets.add('many2one_pager','instance.account.many2one_pager') instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({ start : function(){ From 512f5a1bc5aa945877772352675f33a56b8e6ce4 Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Tue, 7 Aug 2012 19:04:27 +0530 Subject: [PATCH 085/408] [REM] remove button widget bzr revid: rgaopenerp-20120807133427-kskuv8gtf72fdlwe --- .../account/account_move_reconciliation.xml | 4 +- .../src/js/account_move_reconciliation.js | 78 ++++++------------- .../account/wizard/account_reconcile_view.xml | 6 +- 3 files changed, 30 insertions(+), 58 deletions(-) diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml index 96054d0548d..d98f929d05b 100644 --- a/addons/account/account_move_reconciliation.xml +++ b/addons/account/account_move_reconciliation.xml @@ -22,8 +22,8 @@
-
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 53d1b27f820..8e21bb6e84d 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -2,8 +2,6 @@ openerp.account = function(instance) { var _t = instance.web._t, _lt = instance.web._lt; instance.web.views.add('form_clone', 'instance.account.extend_form_view'); -instance.web.form.tags.add('list_button','instance.account.list_button') -instance.web.form.tags.add('btn_extend','instance.account.btn_extend') instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({ start : function(){ @@ -11,13 +9,6 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({ if(this.action.context && this.action.context.extended_form_view_id) this.setup_exended_form_view(this) }, - on_mode_switch: function (view_type, no_store, options) { - self = this - self.list_loaded = $.when(this._super.apply(this, arguments)).then(function () { - if(self.action.context && self.action.context.extended_form_view_id) - self.list_view = self.views['list'] - }) - }, setup_exended_form_view: function(parent){ var self = this, from_view, @@ -45,51 +36,15 @@ instance.account.extend_form_view = instance.web.FormView.extend({ on_loaded: function(data) { this._super.apply(this,arguments); var self = this + this.$element.find(".oe_reconcile").on('click', this.do_reconcilation) this.$element.on('click','a[data-pager-action]',function() { var action = $(this).data('pager-action'); self.on_pager_action(action); }); }, - do_update_pager: function(hide_index) { - var index = hide_index ? '-' : this.dataset.index + 1; - this.$element.find('span.oe_pager_index_extend').html(index).end() - .find('span.oe_pager_count_extend').html(this.dataset.ids.length); - }, - on_pager_action: function(action) { + do_reconcilation:function(event){ var self = this - var viewmanager = self.getParent(); - viewmanager.action.domain = this.original_domain - $.when(this._super(action)).then(function() { - var id = self.get_fields_values().partner_id; - // apply domain on list - viewmanager.action.domain = (viewmanager.action.domain || []).concat([["partner_id", "=", id]]) - viewmanager.searchview.do_search() - }) - }, - }) - -instance.account.btn_extend = instance.web.form.WidgetButton.extend({ - on_click: function() { - var self = this; - this.force_disabled = true; - this.check_disable(); - this.execute_action().always(function() { - self.force_disabled = false; - self.check_disable(); - self.reload_view(); - }); - - }, - reload_view :function(){ - viewmanager = this.view.getParent().getParent() - viewmanager.inner_widget.list_view.controller.reload_content(); - }, -}) - -instance.account.list_button = instance.web.form.WidgetButton.extend({ - on_click: function() { - var self = this - var list_view = this.view.getParent().list_view.controller + var list_view = this.getParent().views['list'].controller ids = list_view.get_selected_ids() if (ids.length == 0) { instance.web.dialog($("
").text(_t("You must choose at least one record.")), { title: _t("Warning"), modal: true }); @@ -101,7 +56,7 @@ instance.account.list_button = instance.web.form.WidgetButton.extend({ active_model: list_view.dataset.model }); self.rpc("/web/action/load", { - action_id: py.eval(this.node.attrs.name), + action_id: py.eval(event.target.name), context: additional_context }, function(result) { result.result.context = _.extend(result.result.context || {}, @@ -111,10 +66,27 @@ instance.account.list_button = instance.web.form.WidgetButton.extend({ self.do_action(result.result, function () { // reload view list_view.reload(); - self.getParent().reload() }); }); - } -}) - + + }, + do_update_pager: function(hide_index) { + var index = hide_index ? '-' : this.dataset.index + 1; + this.$element.find('span.oe_pager_index_extend').html(index).end() + .find('span.oe_pager_count_extend').html(this.dataset.ids.length); + }, + + on_pager_action: function(action) { + var self = this + var viewmanager = self.getParent(); + viewmanager.action.domain = this.original_domain + $.when(this._super(action)).then(function() { + var id = self.get_fields_values().partner_id; + // apply domain on list + viewmanager.action.domain = (viewmanager.action.domain || []).concat([["partner_id", "=", id]]) + viewmanager.searchview.do_search(); + }) + }, + }) + } diff --git a/addons/account/wizard/account_reconcile_view.xml b/addons/account/wizard/account_reconcile_view.xml index 426eeeb4514..1b36394a7e0 100644 --- a/addons/account/wizard/account_reconcile_view.xml +++ b/addons/account/wizard/account_reconcile_view.xml @@ -14,9 +14,9 @@
-
From 085e20a23d85f749a765767ff53531c72a4c2842 Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Wed, 8 Aug 2012 11:04:42 +0530 Subject: [PATCH 086/408] [REM/IMP] remove button from form view and improve css bzr revid: rgaopenerp-20120808053442-ljzf2wy1lmxsdslt --- .../account/account_move_reconciliation.xml | 4 +- .../src/css/account_move_reconciliation.css | 51 ++++++++++--------- .../src/js/account_move_reconciliation.js | 12 ++++- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml index d98f929d05b..62ae504ab89 100644 --- a/addons/account/account_move_reconciliation.xml +++ b/addons/account/account_move_reconciliation.xml @@ -22,8 +22,8 @@
diff --git a/addons/account/static/src/css/account_move_reconciliation.css b/addons/account/static/src/css/account_move_reconciliation.css index 2757227ac2d..c087cde296e 100644 --- a/addons/account/static/src/css/account_move_reconciliation.css +++ b/addons/account/static/src/css/account_move_reconciliation.css @@ -25,45 +25,46 @@ padding: 0 5px 0 5px; margin: 0 2px 0 2px; float: left; - border-right: 1px solid #ababab; +} + +.openerp .oe_reconcile_button { + float: left; + display: inline-block; + background-color: #EFEFEF; + background-image: -moz-linear-gradient(center top , #EFEFEF, #D8D8D8); + border: 1px solid #ABABAB; + border-radius: 3px 3px 3px 3px; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + color: #404040; + display: inline-block; + font-size: 13px; + margin: 0 3px 0 3px; + padding: 3px 12px; + text-align: center; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); } -.openerp .oe_pager_m2o li { - display: inline-block; - height: 24px; - line-height: 24px; - padding: 0; - float: left; +.openerp .oe_reconcile_button:hover { + background-color: #E3E3E3; + background-image: -moz-linear-gradient(center top , #E3E3E3, #F6F6F6); + box-shadow: none; } -.openerp .oe_pager_m2o a { - padding: 0 8px; +.openerp .oe_reconcile_button a:hover { + text-decoration: none } - .openerp .oe_extended_form_view .oe_form_field:empty { display: inline-block !important; } .openerp .oe_extended_form_view .oe_datepicker_root { - display: inline-block; - min-width: 100px; + display: inline-block; + min-width: 100px; } .openerp .oe_extended_form_view .oe_form_field { - width: auto; -} -.openerp .oe_extended_form_view button { - margin-right: 10px -} - -.openerp .oe_extended_form_view .oe_button_container .oe_form_field{ width: auto; - margin: 0px 10px 0px 10px; } -.openerp .oe_extended_form_view .oe_button_container{ - display: inline-block ; - width:100%; - margin: 10px; -} + .openerp .oe_extended_form_view .oe_form_field_progressbar.ui-progressbar { width: 200px !important; } \ No newline at end of file diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 8e21bb6e84d..b8435da7c9b 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -37,6 +37,7 @@ instance.account.extend_form_view = instance.web.FormView.extend({ this._super.apply(this,arguments); var self = this this.$element.find(".oe_reconcile").on('click', this.do_reconcilation) + this.$element.find(".oe_nothing_to_reconcile").on('click', this.do_nothing_to_reconcile) this.$element.on('click','a[data-pager-action]',function() { var action = $(this).data('pager-action'); self.on_pager_action(action); @@ -68,8 +69,17 @@ instance.account.extend_form_view = instance.web.FormView.extend({ list_view.reload(); }); }); - }, + + do_nothing_to_reconcile:function(event){ + self = this + this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() { + self.dataset.read_slice().done(function(){ + self.on_pager_action(); + }); + }) + }, + do_update_pager: function(hide_index) { var index = hide_index ? '-' : this.dataset.index + 1; this.$element.find('span.oe_pager_index_extend').html(index).end() From 7b26f82778944a5955129fefe80bd675c57cff5a Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Wed, 8 Aug 2012 11:36:47 +0530 Subject: [PATCH 087/408] [IMP] imporve view (CSS) bzr revid: rgaopenerp-20120808060647-9pgjic3obic4wwrg --- .../static/src/css/account_move_reconciliation.css | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/account/static/src/css/account_move_reconciliation.css b/addons/account/static/src/css/account_move_reconciliation.css index c087cde296e..59861a66b68 100644 --- a/addons/account/static/src/css/account_move_reconciliation.css +++ b/addons/account/static/src/css/account_move_reconciliation.css @@ -11,7 +11,7 @@ margin: 2px; } -.openerp .oe_pager_button{ +.openerp .oe_pager_button { float: left; height: 22px; line-height: 24px; @@ -26,6 +26,9 @@ margin: 0 2px 0 2px; float: left; } +.openerp .oe_pager_button:hover{ + text-decoration:none !important; +} .openerp .oe_reconcile_button { float: left; @@ -35,16 +38,18 @@ border: 1px solid #ABABAB; border-radius: 3px 3px 3px 3px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; - color: #404040; + color: #4C4C4C !important; display: inline-block; font-size: 13px; margin: 0 3px 0 3px; padding: 3px 12px; + cursor: pointer; text-align: center; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); } .openerp .oe_reconcile_button:hover { + text-decoration:none !important; background-color: #E3E3E3; background-image: -moz-linear-gradient(center top , #E3E3E3, #F6F6F6); box-shadow: none; From fbddeaa021aa4d43f9b0248d73cc8722bda22e9c Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Wed, 8 Aug 2012 19:27:47 +0530 Subject: [PATCH 088/408] [IMP] impromve sql view for model, remove method for nothing to reconcile button bzr revid: rgaopenerp-20120808135747-vdi2wztvi9qprsus --- addons/account/__openerp__.py | 2 +- addons/account/account_move_reconciliation.py | 57 +++++++------------ addons/account/account_view.xml | 14 +---- .../src/js/account_move_reconciliation.js | 11 ++-- 4 files changed, 27 insertions(+), 57 deletions(-) diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 950ee2da895..0542c9fa79e 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -66,8 +66,8 @@ financial year and for preparation of vouchers there is a module named account_v 'wizard/account_period_close_view.xml', 'wizard/account_reconcile_view.xml', 'wizard/account_unreconcile_view.xml', - 'account_view.xml', 'account_move_reconciliation.xml', + 'account_view.xml', 'account_report.xml', 'account_financial_report_data.xml', 'wizard/account_report_common_view.xml', diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py index 8dee6e98b22..f885214ec65 100644 --- a/addons/account/account_move_reconciliation.py +++ b/addons/account/account_move_reconciliation.py @@ -22,12 +22,9 @@ import tools from osv import fields,osv -class res_partner(osv.osv): - _inherit = 'res.partner' - _columns = { - 'partner_move_count': fields.integer('Partner move line count') - } -res_partner() +#1. Remove field from res.partner + +#4 remove get_unreconcile_entry method mange it with domain class account_move_line(osv.osv): _inherit = "account.move.line" @@ -49,53 +46,37 @@ class account_move_reconciliation(osv.osv): _auto = False def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None): + active_ids = context.get('active_ids', []) res = 0 - cr.execute("""SELECT partner_id, reconcile_id - FROM account_move_line WHERE state <> 'draft' - GROUP BY partner_id, reconcile_id""") - result = cr.fetchall() - partner_total = len(result) - partner_reconcile = len([ (x,y) for x, y in result if y == None ]) - if partner_total: - res = float(partner_total- partner_reconcile)/partner_total * 100 - + if active_ids: + total_records = self.search(cr, uid, [('id','in',active_ids)]) + total_reconcile = 0 + for record in self.read(cr, uid, total_records, ['reconcile_count'], context=context): + if record['reconcile_count'] > 0: + total_reconcile += 1 + res = float(total_reconcile)/len(total_records) * 100 res_all = {} for id in ids: res_all[id] = res return res_all - def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): - ids = super(account_move_reconciliation, self).search(cr, uid, args, offset, limit, order, context, count) - res = [] - for l in self.browse(cr, uid, ids, context=context): - if (not l.partner_move_count) or (l.move_lines_count >l.partner_move_count): - res.append(l.id) - return res - + _columns = { 'partner_id':fields.many2one('res.partner', 'Partner'), - 'last_reconciliation_date':fields.datetime('Last Reconciliation'), + 'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'), 'latest_date' :fields.date('Latest Entry'), 'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float'), - 'move_lines_count':fields.integer('Move Count'), - 'partner_move_count':fields.integer('Partner move line count'), + 'reconcile_count':fields.integer('Reconcile Count'), } - def skip_partner(self, cr, uid, ids, context): - res_partner = self.pool.get('res.partner') - for line in self.browse(cr, uid, ids, context=context): - res_partner.write(cr, uid, [line.id] ,{'partner_move_count':line.move_lines_count}) - def init(self, cr): tools.drop_view_if_exists(cr, 'account_move_reconciliation') cr.execute(""" CREATE or REPLACE VIEW account_move_reconciliation as ( - SELECT p.id, p.id as partner_id, - MAX(p.last_reconciliation_date) as last_reconciliation_date, - MAX(l.date) as latest_date, - COUNT(l.id) as move_lines_count, - MAX(p.partner_move_count) as partner_move_count - FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id) - GROUP by p.id + SELECT move_line.partner_id as id, move_line.partner_id, + MAX(move_line.date) as latest_date, + (select count(reconcile.id) from account_move_line as reconcile where reconcile.reconcile_id is not null and reconcile.partner_id = move_line.partner_id) as reconcile_count + FROM account_move_line as move_line where move_line.state <> 'draft' + GROUP by move_line.partner_id ) """) account_move_reconciliation() diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index b6880dab90d..8f4089e5e2c 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1582,16 +1582,6 @@ - - Entries To Reconcile - account.move.line - form - tree,form - - - {'view_mode':True} - - Entries To Reconcile account.move.line @@ -1599,7 +1589,7 @@ tree,form [('partner_id.customer','=',True)] - + @@ -1609,7 +1599,7 @@ tree,form [('partner_id.supplier','=',True)] - + Date: Thu, 9 Aug 2012 12:20:42 +0530 Subject: [PATCH 089/408] [IMP] progress bar and reload formon destroy of reconcile wizard bzr revid: rgaopenerp-20120809065042-bl8tyauxovr07r2v --- addons/account/account_move_reconciliation.py | 16 +++++++--------- .../static/src/js/account_move_reconciliation.js | 10 ++++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py index f885214ec65..eaf9d31f976 100644 --- a/addons/account/account_move_reconciliation.py +++ b/addons/account/account_move_reconciliation.py @@ -22,8 +22,6 @@ import tools from osv import fields,osv -#1. Remove field from res.partner - #4 remove get_unreconcile_entry method mange it with domain class account_move_line(osv.osv): @@ -50,11 +48,11 @@ class account_move_reconciliation(osv.osv): res = 0 if active_ids: total_records = self.search(cr, uid, [('id','in',active_ids)]) - total_reconcile = 0 - for record in self.read(cr, uid, total_records, ['reconcile_count'], context=context): - if record['reconcile_count'] > 0: - total_reconcile += 1 - res = float(total_reconcile)/len(total_records) * 100 + total_unreconcile = 0 + for record in self.read(cr, uid, total_records, ['unreconcile_count'], context=context): + if record['unreconcile_count'] > 0: + total_unreconcile += 1 + res = float(len(total_records) - total_unreconcile)/len(total_records) * 100 res_all = {} for id in ids: res_all[id] = res @@ -66,7 +64,7 @@ class account_move_reconciliation(osv.osv): 'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'), 'latest_date' :fields.date('Latest Entry'), 'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float'), - 'reconcile_count':fields.integer('Reconcile Count'), + 'unreconcile_count':fields.integer('Unreconcile Count'), } def init(self, cr): tools.drop_view_if_exists(cr, 'account_move_reconciliation') @@ -74,7 +72,7 @@ class account_move_reconciliation(osv.osv): CREATE or REPLACE VIEW account_move_reconciliation as ( SELECT move_line.partner_id as id, move_line.partner_id, MAX(move_line.date) as latest_date, - (select count(reconcile.id) from account_move_line as reconcile where reconcile.reconcile_id is not null and reconcile.partner_id = move_line.partner_id) as reconcile_count + (select count(unreconcile.id) from account_move_line as unreconcile where unreconcile.reconcile_id is null and unreconcile.partner_id = move_line.partner_id) as unreconcile_count FROM account_move_line as move_line where move_line.state <> 'draft' GROUP by move_line.partner_id ) diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 03a41fef8a3..765a48af13b 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -68,15 +68,17 @@ instance.account.extend_form_view = instance.web.FormView.extend({ self.do_action(result.result, function () { // reload view list_view.reload(); + self.reload(); }); }); }, - do_nothing_to_reconcile:function(event){ - viewmanager = this.getParent(); + do_nothing_to_reconcile:function(){ this.dataset.ids = _.without(this.dataset.ids, this.datarecord.id) - viewmanager.action.context.active_ids = viewmanager.dataset_form.ids; - this.on_pager_action(); + // viewmanager = this.getParent(); + // viewmanager.action.context.active_ids = viewmanager.dataset_form.ids; + if (!_.isEmpty(this.dataset.ids)) + this.on_pager_action('first'); }, do_update_pager: function(hide_index) { From bd79baf8b39073b73ac5b4f50a8ddb382313bb5d Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Thu, 9 Aug 2012 14:47:47 +0530 Subject: [PATCH 090/408] [fix] inheretied view of account followup bzr revid: rgaopenerp-20120809091747-46o45ssfkmoh9shf --- .../account_move_reconciliation.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/addons/account_followup/account_move_reconciliation.py b/addons/account_followup/account_move_reconciliation.py index b185b9a7347..6370a4bbdca 100644 --- a/addons/account_followup/account_move_reconciliation.py +++ b/addons/account_followup/account_move_reconciliation.py @@ -12,16 +12,14 @@ class account_move_reconciliation(osv.osv): def init(self, cr): tools.drop_view_if_exists(cr, 'account_move_reconciliation') cr.execute(""" - CREATE or REPLACE VIEW account_move_reconciliation as ( - SELECT p.id, p.id as partner_id, - MAX(p.last_reconciliation_date) as last_reconciliation_date, - MAX(l.date) as latest_date, - COUNT(l.id) as move_lines_count, - MAX(p.partner_move_count) as partner_move_count, - MAX(l.followup_date) as followup_date, - MAX(l.followup_line_id) as max_followup_id - FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id) - GROUP by p.id + CREATE or REPLACE VIEW account_move_reconciliation as ( + SELECT move_line.partner_id as id, move_line.partner_id, + MAX(move_line.date) as latest_date, + MAX(move_line.followup_date) as followup_date, + MAX(move_line.followup_line_id) as max_followup_id, + (select count(unreconcile.id) from account_move_line as unreconcile where unreconcile.reconcile_id is null and unreconcile.partner_id = move_line.partner_id) as unreconcile_count + FROM account_move_line as move_line where move_line.state <> 'draft' + GROUP by move_line.partner_id ) """) account_move_reconciliation() \ No newline at end of file From c92422b2ace39a0dde2cb1952da4a26159257377 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Thu, 9 Aug 2012 15:23:41 +0530 Subject: [PATCH 091/408] [ADD]: Add vote system in openchatter bzr revid: atp@tinyerp.com-20120809095341-xn70i8beof20b07h --- addons/mail/__init__.py | 1 + addons/mail/mail_message.py | 41 +++++++++++++++++++ addons/mail/mail_thread.py | 14 ++++++- addons/mail/mail_vote.py | 36 +++++++++++++++++ addons/mail/security/ir.model.access.csv | 1 + addons/mail/static/src/css/mail.css | 29 ++++++++++++++ addons/mail/static/src/img/vote.gif | Bin 0 -> 892 bytes addons/mail/static/src/js/mail.js | 48 ++++++++++++++++++++++- addons/mail/static/src/xml/mail.xml | 22 ++++++++++- 9 files changed, 188 insertions(+), 4 deletions(-) create mode 100644 addons/mail/mail_vote.py create mode 100644 addons/mail/static/src/img/vote.gif diff --git a/addons/mail/__init__.py b/addons/mail/__init__.py index cbd477f55e6..4cf2caf8804 100644 --- a/addons/mail/__init__.py +++ b/addons/mail/__init__.py @@ -24,6 +24,7 @@ import mail_message import mail_thread import mail_group import mail_subscription +import mail_vote import ir_needaction import res_users import res_partner diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index b96b6e3791e..1b5178e7271 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -230,6 +230,7 @@ class mail_message(osv.Model): select=True, ondelete='set null', help="Parent message, used for displaying as threads with hierarchy"), 'child_ids': fields.one2many('mail.message', 'parent_id', 'Child Messages'), + 'vote_ids': fields.one2many('mail.vote', 'msg_id', 'Votes'), } _defaults = { @@ -237,6 +238,46 @@ class mail_message(osv.Model): 'state': 'received', } + + #--------------------------------------------------- + #Mail Vote system (Like or Unlike comments + #----------------------------------------------------- + + def get_vote_summary(self, cr, uid, ids, context=None): + ''' + Return message ,count vote of message id given by .particular user with True or False. + ''' + for message in self.browse(cr, uid, ids, context): + is_vote_liked = False + vote_count = len(message.vote_ids) + for vote in message.vote_ids: + if vote.user_id.id == uid: + is_vote_liked = True + break + res = { + 'msg_id': message.id, + 'vote_count': vote_count, + 'is_vote_liked': is_vote_liked + } + return res + + def vote_toggle(self, cr, uid, ids, context=None): + ''' + Toggles when Comment is liked or unlike. + Return the number of votes of particular message. + ''' + vote_pool = self.pool.get('mail.vote') + vote_count = 0 + for message in self.browse(cr, uid, ids, context): + voters_id = vote_pool.search(cr, uid, [('msg_id', '=', message.id), ('user_id', '=', uid)], context=context) + if not voters_id: + new_vote_id = vote_pool.create(cr, uid, {'msg_id': message.id, 'user_id': uid}, context=context) + else: + vote_pool.unlink(cr, uid, voters_id, context=context) + if message.vote_ids: + vote_count = len(message.vote_ids) + return vote_count + #------------------------------------------------------ # Email api #------------------------------------------------------ diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index f0dd023bf06..092050ff812 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -64,12 +64,14 @@ class mail_thread(osv.Model): def _get_message_ids(self, cr, uid, ids, name, args, context=None): res = {} + img_vote = "" for id in ids: message_ids = self.message_search(cr, uid, [id], context=context) subscriber_ids = self.message_get_subscribers(cr, uid, [id], context=context) + vote_list = self.message_vote_ids(cr, uid, ids, context=context) res[id] = { 'message_ids': message_ids, - 'message_summary': "9 %d + %d" % (len(message_ids), len(subscriber_ids)), + 'message_summary': "Msg: %d . Fol: %d . %s %d" % (len(message_ids), len(subscriber_ids), img_vote, len(vote_list)), } return res @@ -100,7 +102,15 @@ class mail_thread(osv.Model): #------------------------------------------------------ # Automatic subscription when creating/reading #------------------------------------------------------ - + def message_vote_ids(self, cr, uid, ids, context=None): + message_pool = self.pool.get('mail.message') + vote_list = [] + message_ids = self.message_search(cr, uid, [id], context=context) + for message in message_pool.browse(cr, uid, message_ids, context=context): + if message.vote_ids: + vote_list.append(message.vote_ids) + return vote_list + def create(self, cr, uid, vals, context=None): """Automatically subscribe the creator """ thread_id = super(mail_thread, self).create(cr, uid, vals, context=context) diff --git a/addons/mail/mail_vote.py b/addons/mail/mail_vote.py new file mode 100644 index 00000000000..5d63de80864 --- /dev/null +++ b/addons/mail/mail_vote.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2012-Today OpenERP SA (). +# +# 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 +# +############################################################################## + +from osv import osv, fields +from tools.translate import _ + +class mail_vote(osv.Model): + ''' + Mail vote feature allow users to like and unlike particular message or Document's message comment. + It counts the number of votes per document. + ''' + _name = 'mail.vote' + _description = 'Mail Vote' + _columns = { + 'msg_id': fields.many2one('mail.message', 'Message', required=True), + 'user_id': fields.many2one('res.users', 'User', required=True), + } +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/mail/security/ir.model.access.csv b/addons/mail/security/ir.model.access.csv index 3677d424c14..1941a41a259 100644 --- a/addons/mail/security/ir.model.access.csv +++ b/addons/mail/security/ir.model.access.csv @@ -7,3 +7,4 @@ access_mail_notification_all,mail.notification.all,model_mail_notification,,1,1, access_mail_group,mail.group,model_mail_group,base.group_user,1,1,1,1 access_mail_alias_user,mail.alias,model_mail_alias,base.group_user,1,1,1,0 access_mail_alias_system,mail.alias,model_mail_alias,base.group_system,1,1,1,1 +access_mail_vote,mail.vote,model_mail_vote,base.group_user,1,1,1,1 diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index c0317633aa7..ae934eeb4ff 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -275,6 +275,35 @@ display: none; } +/*--------------------------------------------------------------*/ +/* Mail Vote System (Like or Unlike Comment) +/*--------------------------------------------------------------*/ + +.oe_mail_vote_image{ + height='12px'; + width='16px'; +} + +button.oe_mail_msg_vote_like{ + height:21px; + width: 30px; + padding: 1px; + background: #8A89BA; + margin-top: -4px; +} + +button.oe_mail_msg_vote_like:hover{ + background: #8A89BA; +} + +button.oe_mail_msg_vote_like span { + color: white; +} + +span.oe_mail_vote_string{ + color: #807FB4; +} + /* ------------------------------------------------------------ */ /* mail.compose.message form view & OpenERP hacks /* ------------------------------------------------------------ */ diff --git a/addons/mail/static/src/img/vote.gif b/addons/mail/static/src/img/vote.gif new file mode 100644 index 0000000000000000000000000000000000000000..0e6b874770e1122b3f08f01d26bae9f08b94cfe6 GIT binary patch literal 892 zcmZ?wbhEHb_7cRVe_wN7y z|G^4JiO~=kZXuxflZBCi;Xi{8$YY>9!N3v8@Sju0!k~eniGy7zp};`#5CadBg-XW) zha;V=k}f;~2O1ohWSp~PDnG_IFtaO6lF_`F(#WJ0K8@#t(X&(2OcGCB>Da7xoQcbW V?}tRu!6p_1OTLJPi-`^l)&OE6GJpU8 literal 0 HcmV?d00001 diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index da6816d3441..8b60e96744c 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -559,6 +559,48 @@ openerp.mail = function(session) { return display_done && compose_done; }, + //Mail vote Functionality... + add_vote_event: function(element){ + vote_img = element.find('.oe_mail_msg_vote_like'); + self = this; + if (vote_img) + vote_img.click(function(){ + self.subscribe_vote($(this).attr('data-id')); + }); + return + }, + + find_parent_element: function(name, message_id){ + parent_element = false; + _.each($(name), function(element){ + if ($(element).attr("data-id") == message_id){ + parent_element = element; + } + }); + return parent_element; + }, + + render_vote: function(message_id){ + var self = this; + this.mail_message = new session.web.DataSet(this, 'mail.message'); + this.mail_message.call('get_vote_summary',[[parseInt(message_id)]]).then(function(result){ + if (result){ + parent_element = self.find_parent_element(".oe_mail_msg_vote", message_id); + vote_element = session.web.qweb.render('VoteDisplay', result); + $(parent_element).html(vote_element); + self.add_vote_event($(parent_element)); + } + }); + }, + + subscribe_vote: function(message_id){ + var self = this; + this.mail_message = new session.web.DataSet(this, 'mail.message'); + return this.mail_message.call('vote_toggle', [[parseInt(message_id)]]).then(function(result){ + self.render_vote(message_id); + }); + }, + /** * Override-hack of do_action: automatically reload the chatter. * Normally it should be called only when clicking on 'Post/Send' @@ -697,6 +739,10 @@ openerp.mail = function(session) { display_comments: function (records) { var self = this; + //Render Vote. + _.each(records, function(record){ + self.render_vote(record.id); + }); // sort the records mail.ChatterUtils.records_struct_add_records(this.comments_structure, records, this.params.parent_id); //build attachments download urls and compute time-relative from dates @@ -1119,7 +1165,7 @@ openerp.mail = function(session) { var records = self.comments_structure.tree_struct[root_id]['for_thread_msgs']; var model_name = self.comments_structure.msgs[root_id]['model']; var res_id = self.comments_structure.msgs[root_id]['res_id']; - var render_res = session.web.qweb.render('mail.wall_thread_container', {}); + var render_res = session.web.qweb.render('mail.Wall_thread_container', {}); $('
  • ').html(render_res).appendTo(self.$element.find('ul.oe_mail_wall_threads')); var thread = new mail.Thread(self, { 'res_model': model_name, 'res_id': res_id, 'uid': self.session.uid, 'records': records, diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 86d115f29c8..bd18d78e41d 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -45,7 +45,7 @@ wall_thread_container template for the wall Each discussion thread is contained inside this template --> - + + + + Votes : + +
  • + + + + + + +
  • + +
  • @@ -155,6 +174,7 @@
  • +
  • Reply
  • + - From bb109f7af9cc042be5ce19ca6de6f4c871606909 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Tue, 14 Aug 2012 11:45:28 +0530 Subject: [PATCH 102/408] [FIX] portal: access managment wizard, remove label of user_ids bzr revid: hmo@tinyerp.com-20120814061528-9u2o265dq5qebnry --- addons/portal/wizard/portal_wizard_view.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/portal/wizard/portal_wizard_view.xml b/addons/portal/wizard/portal_wizard_view.xml index b88c10f28e1..8e1ba9b1695 100644 --- a/addons/portal/wizard/portal_wizard_view.xml +++ b/addons/portal/wizard/portal_wizard_view.xml @@ -16,12 +16,11 @@ res.portal.wizard form - + -
    -
    + -
    +
    diff --git a/addons/account/static/src/css/account_move_reconciliation.css b/addons/account/static/src/css/account_move_reconciliation.css index 0cedec95f09..f4136a79ef4 100644 --- a/addons/account/static/src/css/account_move_reconciliation.css +++ b/addons/account/static/src/css/account_move_reconciliation.css @@ -73,7 +73,9 @@ .openerp .oe_extended_form_view .oe_form_field_progressbar.ui-progressbar { width: 200px !important; } - +.openerp .oe_extended_form_view div.oe_reconcile_row{ + margin-top:7px; +} .openerp .oe_list_content > tbody > tr > td > button.reconcile_btn { color: white; background-color: #8a89ba; diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 9a3af14f665..d91c6158d18 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -1499,8 +1499,6 @@ class account_bank_statement_line(osv.osv): statement_id = ids[0] statement = self.browse(cr, uid, statement_id, context=context) voucher = statement.voucher_id or False - if voucher and voucher.state == 'posted': - return voucher.cancel_voucher(context=context) mod_obj = self.pool.get('ir.model.data') if voucher and voucher.type == 'customer': res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') @@ -1529,7 +1527,16 @@ class account_bank_statement_line(osv.osv): else: res[line.id] = 0.0 return res - + + def _is_reconciled(self, cr, uid, ids, name, args, context=None): + res = {} + for line in self.browse(cr, uid, ids, context=context): + if line.voucher_id and line.voucher_id.state == 'posted': + res[line.id] = True + else: + res[line.id] = False + return res + def _check_amount(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): if obj.voucher_id: @@ -1543,6 +1550,8 @@ class account_bank_statement_line(osv.osv): ] _columns = { + 'is_reconciled': fields.function(_is_reconciled, + string='Statement is reconciled?', type='boolean'), 'amount_reconciled': fields.function(_amount_reconciled, string='Amount reconciled', type='float'), 'voucher_id': fields.many2one('account.voucher', 'Payment'), diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml index ddeba22d905..30dfe527d3b 100644 --- a/addons/account_voucher/account_voucher_view.xml +++ b/addons/account_voucher/account_voucher_view.xml @@ -217,7 +217,8 @@ --> - --> -
    +
    -
    -