From 052c5f8eeb92570db295bedec4162225835f86e0 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Mon, 4 Jun 2012 17:03:50 +0530 Subject: [PATCH 001/153] [FIX] account_asset: change the calculation of field depreciated_value lp bug: https://launchpad.net/bugs/997141 fixed bzr revid: cha@tinyerp.com-20120604113350-sdzv1lr0zcf5l5wr --- addons/account_asset/account_asset.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index 0799a59a423..362fcce1982 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -141,7 +141,6 @@ class account_asset_asset(osv.osv): old_depreciation_line_ids = depreciation_lin_obj.search(cr, uid, [('asset_id', '=', asset.id), ('move_id', '=', False)]) if old_depreciation_line_ids: depreciation_lin_obj.unlink(cr, uid, old_depreciation_line_ids, context=context) - amount_to_depr = residual_amount = asset.value_residual if asset.prorata: depreciation_date = datetime.strptime(self._get_last_depreciation_date(cr, uid, [asset.id], context)[asset.id], '%Y-%m-%d') @@ -159,13 +158,21 @@ class account_asset_asset(osv.osv): i = x + 1 amount = self._compute_board_amount(cr, uid, asset, i, residual_amount, amount_to_depr, undone_dotation_number, posted_depreciation_line_ids, total_days, depreciation_date, context=context) residual_amount -= amount + + if posted_depreciation_line_ids: + if x == range(len(posted_depreciation_line_ids), undone_dotation_number)[0] : + depreciated_value = depreciation_lin_obj.browse(cr, uid, posted_depreciation_line_ids[0], context=context).amount + else: + depreciated_value = depreciated_value + amount + else: + depreciated_value = (asset.purchase_value - asset.salvage_value) - (residual_amount + amount) vals = { 'amount': amount, 'asset_id': asset.id, 'sequence': i, 'name': str(asset.id) +'/' + str(i), 'remaining_value': residual_amount, - 'depreciated_value': (asset.purchase_value - asset.salvage_value) - (residual_amount + amount), + 'depreciated_value': depreciated_value, 'depreciation_date': depreciation_date.strftime('%Y-%m-%d'), } depreciation_lin_obj.create(cr, uid, vals, context=context) From 987e362d7f9f507a00aabbedc24790580aa4b7a8 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Fri, 24 Aug 2012 10:47:06 +0530 Subject: [PATCH 002/153] [IMP] account_asset: revert old changes bzr revid: cha@tinyerp.com-20120824051706-16pn120zdtxfve49 --- addons/account_asset/account_asset.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index 362fcce1982..c4c1db0dec2 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -141,6 +141,7 @@ class account_asset_asset(osv.osv): old_depreciation_line_ids = depreciation_lin_obj.search(cr, uid, [('asset_id', '=', asset.id), ('move_id', '=', False)]) if old_depreciation_line_ids: depreciation_lin_obj.unlink(cr, uid, old_depreciation_line_ids, context=context) + amount_to_depr = residual_amount = asset.value_residual if asset.prorata: depreciation_date = datetime.strptime(self._get_last_depreciation_date(cr, uid, [asset.id], context)[asset.id], '%Y-%m-%d') @@ -158,21 +159,13 @@ class account_asset_asset(osv.osv): i = x + 1 amount = self._compute_board_amount(cr, uid, asset, i, residual_amount, amount_to_depr, undone_dotation_number, posted_depreciation_line_ids, total_days, depreciation_date, context=context) residual_amount -= amount - - if posted_depreciation_line_ids: - if x == range(len(posted_depreciation_line_ids), undone_dotation_number)[0] : - depreciated_value = depreciation_lin_obj.browse(cr, uid, posted_depreciation_line_ids[0], context=context).amount - else: - depreciated_value = depreciated_value + amount - else: - depreciated_value = (asset.purchase_value - asset.salvage_value) - (residual_amount + amount) vals = { 'amount': amount, 'asset_id': asset.id, 'sequence': i, 'name': str(asset.id) +'/' + str(i), 'remaining_value': residual_amount, - 'depreciated_value': depreciated_value, + 'depreciated_value': (asset.purchase_value - asset.salvage_value) - (residual_amount + amount), 'depreciation_date': depreciation_date.strftime('%Y-%m-%d'), } depreciation_lin_obj.create(cr, uid, vals, context=context) From 87e7926a14aef3841ef401b7cd32ea45b5718642 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Fri, 24 Aug 2012 11:17:47 +0530 Subject: [PATCH 003/153] [IMP] account_asset: fixed depriciation board calculation problem bzr revid: cha@tinyerp.com-20120824054747-vgfv4e3xv7h7ao0r --- addons/account_asset/account_asset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index 2dc95e832e6..bbad438f1db 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -141,7 +141,7 @@ class account_asset_asset(osv.osv): old_depreciation_line_ids = depreciation_lin_obj.search(cr, uid, [('asset_id', '=', asset.id), ('move_id', '=', False)]) if old_depreciation_line_ids: depreciation_lin_obj.unlink(cr, uid, old_depreciation_line_ids, context=context) - + amount_to_depr = residual_amount = asset.value_residual if asset.prorata: depreciation_date = datetime.strptime(self._get_last_depreciation_date(cr, uid, [asset.id], context)[asset.id], '%Y-%m-%d') @@ -189,7 +189,7 @@ class account_asset_asset(osv.osv): def _amount_residual(self, cr, uid, ids, name, args, context=None): cr.execute("""SELECT - l.asset_id as id, round(SUM(abs(l.debit-l.credit))) AS amount + l.asset_id as id, SUM(abs(l.debit-l.credit)) AS amount FROM account_move_line l WHERE From 151552cfdfe4af85ac2e6921a63738bdc5518a8b Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Tue, 28 Aug 2012 14:52:32 +0530 Subject: [PATCH 004/153] [IMP] account_asset: fix the issue of residual value bzr revid: cha@tinyerp.com-20120828092232-7a8t9ntuto0eubhb --- addons/account_asset/account_asset.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index bbad438f1db..3ea38ef9aa2 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -134,6 +134,7 @@ class account_asset_asset(osv.osv): def compute_depreciation_board(self, cr, uid, ids, context=None): depreciation_lin_obj = self.pool.get('account.asset.depreciation.line') + currency_obj = self.pool.get('res.currency') for asset in self.browse(cr, uid, ids, context=context): if asset.value_residual == 0.0: continue @@ -158,6 +159,9 @@ class account_asset_asset(osv.osv): for x in range(len(posted_depreciation_line_ids), undone_dotation_number): i = x + 1 amount = self._compute_board_amount(cr, uid, asset, i, residual_amount, amount_to_depr, undone_dotation_number, posted_depreciation_line_ids, total_days, depreciation_date, context=context) + company_currency = asset.company_id.currency_id.id + current_currency = asset.currency_id.id + amount = currency_obj.compute(cr, uid, current_currency, company_currency, amount, context=context) residual_amount -= amount vals = { 'amount': amount, @@ -347,8 +351,8 @@ class account_asset_depreciation_line(osv.osv): 'sequence': fields.integer('Sequence', required=True), 'asset_id': fields.many2one('account.asset.asset', 'Asset', required=True), 'parent_state': fields.related('asset_id', 'state', type='char', string='State of Asset'), - 'amount': fields.float('Depreciation Amount', required=True), - 'remaining_value': fields.float('Amount to Depreciate', required=True), + 'amount': fields.float('Depreciation Amount', digits_compute=dp.get_precision('Account'), required=True), + 'remaining_value': fields.float('Amount to Depreciate', digits_compute=dp.get_precision('Account'),required=True), 'depreciated_value': fields.float('Amount Already Depreciated', required=True), 'depreciation_date': fields.char('Depreciation Date', size=64, select=1), 'move_id': fields.many2one('account.move', 'Depreciation Entry'), From de6066ae970f2832d1aa547139725def43d0af11 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Tue, 16 Oct 2012 11:42:41 +0530 Subject: [PATCH 005/153] [IMP] base_calendar : The onchange on the duration must be the same on start date, in order to set the end_date if we change the start date. bzr revid: mdi@tinyerp.com-20121016061241-chm3hipucc44kmdm --- addons/base_calendar/crm_meeting_view.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/base_calendar/crm_meeting_view.xml b/addons/base_calendar/crm_meeting_view.xml index 4df0a8a22b2..79a3b6d1c78 100644 --- a/addons/base_calendar/crm_meeting_view.xml +++ b/addons/base_calendar/crm_meeting_view.xml @@ -89,7 +89,8 @@ - + From 27ea8ab7a43354d28893320fba0f326e4c07b972 Mon Sep 17 00:00:00 2001 From: Saurang Suthar Date: Tue, 16 Oct 2012 12:08:47 +0530 Subject: [PATCH 007/153] [IMP]hr_timesheet_invoice:renamed buttons Close to Contract Finished and Cancel to Cancel Contract bzr revid: ssu@tinyerp.com-20121016063847-vpwt26fwme7reryx --- addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml index b752ade8da0..d47bf3b1252 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml @@ -19,10 +19,10 @@
From 976a3eb276a70c3a945429d450468626e9adf22f Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Tue, 16 Oct 2012 12:54:28 +0530 Subject: [PATCH 008/153] [FIX] account_analytic_default : TypeError: The model 'stock.picking' specifies an unexisting parent class 'stock.picking'. You may need to add a dependency on the parent class' module. bzr revid: mdi@tinyerp.com-20121016072428-srbvx9037iz40e5c --- addons/account_analytic_default/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_analytic_default/__openerp__.py b/addons/account_analytic_default/__openerp__.py index 213d055f8de..0af606821ce 100644 --- a/addons/account_analytic_default/__openerp__.py +++ b/addons/account_analytic_default/__openerp__.py @@ -38,7 +38,7 @@ Allows to automatically select analytic accounts based on criterions: 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', 'images': ['images/analytic_defaults.jpeg'], - 'depends': ['sale'], + 'depends': ['sale_stock'], 'data': [ 'security/ir.model.access.csv', 'security/account_analytic_default_security.xml', From a7ee26e706b89058b320d4a56e9eaf72e54eeb42 Mon Sep 17 00:00:00 2001 From: Saurang Suthar Date: Tue, 16 Oct 2012 14:43:28 +0530 Subject: [PATCH 009/153] [IMP]crm_claim:removed Next Stage and Previous stage buttons bzr revid: ssu@tinyerp.com-20121016091328-n0ugjw3uqlcpkehs --- addons/crm_claim/crm_claim_view.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/addons/crm_claim/crm_claim_view.xml b/addons/crm_claim/crm_claim_view.xml index 9643a56bfe2..1f6ef54ad10 100644 --- a/addons/crm_claim/crm_claim_view.xml +++ b/addons/crm_claim/crm_claim_view.xml @@ -107,12 +107,6 @@ states="draft,pending" /> From 4d9907ada9b65d52eb038efc0629e23260298b58 Mon Sep 17 00:00:00 2001 From: "Foram Katharotiya (OpenERP)" Date: Mon, 22 Oct 2012 19:03:54 +0530 Subject: [PATCH 064/153] [IMP] remove graph view mode in bank statement & coda statement bzr revid: fka@tinyerp.com-20121022133354-03g0z7se5tv4ngb1 --- .../account_bank_statement_view.xml | 2 +- addons/l10n_be_coda/l10n_be_coda_view.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_bank_statement_extensions/account_bank_statement_view.xml b/addons/account_bank_statement_extensions/account_bank_statement_view.xml index 9164c00373f..3d5560856a3 100644 --- a/addons/account_bank_statement_extensions/account_bank_statement_view.xml +++ b/addons/account_bank_statement_extensions/account_bank_statement_view.xml @@ -148,7 +148,7 @@ Bank Statement Lines account.bank.statement.line form - tree,graph,form + tree,form {'block_statement_line_delete' : 1} diff --git a/addons/l10n_be_coda/l10n_be_coda_view.xml b/addons/l10n_be_coda/l10n_be_coda_view.xml index 21db77466a0..d5067e7951a 100644 --- a/addons/l10n_be_coda/l10n_be_coda_view.xml +++ b/addons/l10n_be_coda/l10n_be_coda_view.xml @@ -473,7 +473,7 @@ CODA Statement Lines coda.bank.statement.line form - tree,graph,form + tree,form {'block_statement_line_delete' : 1} From 6239433a002dc17d72e2e9c9d0eae61507825027 Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Tue, 23 Oct 2012 11:04:12 +0530 Subject: [PATCH 065/153] [IMP]improve code bzr revid: sgo@tinyerp.com-20121023053412-gpoxqj3jp55m65wu --- .../product_visible_discount/product_visible_discount.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/product_visible_discount/product_visible_discount.py b/addons/product_visible_discount/product_visible_discount.py index 48e3c4a8283..008c1f313a6 100644 --- a/addons/product_visible_discount/product_visible_discount.py +++ b/addons/product_visible_discount/product_visible_discount.py @@ -111,9 +111,11 @@ class account_invoice_line(osv.osv): if res_dict.get('item_id',False) and res_dict['item_id'].get(pricelist,False): item = res_dict['item_id'].get(pricelist,False) - item_base = item_obj.read(cr, uid, [item], ['base'])[0]['base'] - if item_base > 0: - field_name = price_type_obj.browse(cr, uid, item_base).field + item_read = item_obj.read(cr, uid, [item], ['base']) + if item_read: + item_base = item_read[0]['base'] + if item_base > 0: + field_name = price_type_obj.browse(cr, uid, item_base).field product = product_obj.browse(cr, uid, product_id, context) product_read = product_obj.read(cr, uid, product_id, [field_name], context=context) From 7f64cbd875e22d8feb1555cf886c00bb3163c072 Mon Sep 17 00:00:00 2001 From: "Foram Katharotiya (OpenERP)" Date: Tue, 23 Oct 2012 11:52:30 +0530 Subject: [PATCH 066/153] [IMP] remove date_start_date function field bzr revid: fka@tinyerp.com-20121023062230-l6941b0lt7qx4wzu --- addons/mrp_operations/mrp_operations.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index 9f6671c3b2b..ffe0305d5f1 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -50,17 +50,6 @@ class stock_move(osv.osv): stock_move() class mrp_production_workcenter_line(osv.osv): - def _get_date_date(self, cr, uid, ids, field_name, arg, context=None): - """ Finds starting date. - @return: Dictionary of values. - """ - res={} - for op in self.browse(cr, uid, ids, context=context): - if op.date_start: - res[op.id] = op.date_start[:10] - else: - res[op.id]=False - return res def _get_date_end(self, cr, uid, ids, field_name, arg, context=None): """ Finds ending date. @@ -92,7 +81,6 @@ class mrp_production_workcenter_line(osv.osv): "* When work order is in running mode, during that time if user wants to stop or to make changes in order then can set in 'Pending' state.\n" \ "* When the user cancels the work order it will be set in 'Canceled' state.\n" \ "* When order is completely processed that time it is set in 'Finished' state."), - 'date_start_date': fields.function(_get_date_date, string='Start Date', type='date'), 'date_planned': fields.datetime('Scheduled Date', select=True), 'date_planned_end': fields.function(_get_date_end, string='End Date', type='datetime'), 'date_start': fields.datetime('Start Date'), From 1435e6faeb1fea4d5d973d5d06f4b78ec2622f0b Mon Sep 17 00:00:00 2001 From: Hardik Date: Tue, 23 Oct 2012 13:01:50 +0530 Subject: [PATCH 067/153] [IMP]Diagram view pager is working and display in header bzr revid: hsa@tinyerp.com-20121023073150-ozao4l0wca96cgmp --- addons/web_diagram/static/src/js/diagram.js | 75 ++++++++++++------- .../static/src/xml/base_diagram.xml | 13 ++-- 2 files changed, 55 insertions(+), 33 deletions(-) diff --git a/addons/web_diagram/static/src/js/diagram.js b/addons/web_diagram/static/src/js/diagram.js index d5a6e78f862..a85dff23032 100644 --- a/addons/web_diagram/static/src/js/diagram.js +++ b/addons/web_diagram/static/src/js/diagram.js @@ -22,6 +22,7 @@ instance.web.DiagramView = instance.web.View.extend({ this.context = {}; this.ids = this.dataset.ids; this.on('view_loaded', self, self.load_diagram); + this.on('pager_action_executed', self, self.pager_action_trigger); }, start: function() { var self = this; @@ -59,12 +60,7 @@ instance.web.DiagramView = instance.web.View.extend({ self.$el.find('.oe_diagram_header').append(html_label); }) - this.$el.find('div.oe_diagram_pager button[data-pager-action]').click(function() { - var action = $(this).data('pager-action'); - self.execute_pager_action(action); - }); - - this.do_update_pager(); + this.init_pager(); // New Node,Edge this.$el.find('#new_node.oe_diagram_button_new').click(function(){self.add_node();}); @@ -366,36 +362,61 @@ instance.web.DiagramView = instance.web.View.extend({ form_controller.fields[self.connectors.attrs.destination].dirty = true; }); }, - - execute_pager_action: function(action) { - switch (action) { - case 'first': - this.dataset.index = 0; - break; - case 'previous': - this.dataset.previous(); - break; - case 'next': - this.dataset.next(); - break; - case 'last': - this.dataset.index = this.dataset.ids.length - 1; - break; + do_hide: function () { + if (this.$pager) { + this.$pager.hide(); } + this._super(); + }, + init_pager: function() { + var self = this; + if (this.$pager) + this.$pager.remove(); + + this.$pager = $(QWeb.render("DiagramView.pager", {'widget':self})).hide(); + if (this.options.$pager) { + this.$pager.appendTo(this.options.$pager); + } else { + this.$el.find('.oe_diagram_pager').replaceWith(this.$pager); + } + this.$pager.on('click','a[data-pager-action]',function() { + var action = $(this).data('pager-action'); + self.execute_pager_action(action); + }); + this.do_update_pager(); + }, + pager_action_trigger: function(){ var loaded = this.dataset.read_index(_.keys(this.fields_view.fields)) .pipe(this.on_diagram_loaded); this.do_update_pager(); return loaded; }, + execute_pager_action: function(action) { + switch (action) { + case 'first': + this.dataset.index = 0; + break; + case 'previous': + this.dataset.previous(); + break; + case 'next': + this.dataset.next(); + break; + case 'last': + this.dataset.index = this.dataset.ids.length - 1; + break; + } + this.trigger('pager_action_executed'); + + }, do_update_pager: function(hide_index) { - var $pager = this.$el.find('div.oe_diagram_pager'); - var index = hide_index ? '-' : this.dataset.index + 1; - if(!this.dataset.count) { - this.dataset.count = this.dataset.ids.length; + this.$pager.toggle(this.dataset.ids.length > 1); + if (hide_index) { + $(".oe_diagram_pager_state", this.$pager).html(""); + } else { + $(".oe_diagram_pager_state", this.$pager).html(_.str.sprintf(_t("%d / %d"), this.dataset.index + 1, this.dataset.ids.length)); } - $pager.find('span.oe_pager_index').html(index); - $pager.find('span.oe_pager_count').html(this.dataset.count); }, do_show: function() { diff --git a/addons/web_diagram/static/src/xml/base_diagram.xml b/addons/web_diagram/static/src/xml/base_diagram.xml index 388092b3d23..54b06aafb27 100644 --- a/addons/web_diagram/static/src/xml/base_diagram.xml +++ b/addons/web_diagram/static/src/xml/base_diagram.xml @@ -1,18 +1,19 @@