From 3c055a769fc22e5fdc71ab9dc5a48237dd6d1812 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 27 Apr 2015 14:19:02 +0200 Subject: [PATCH 01/10] [FIX] account: Taxes report The Tax Report printed with details should not include draft accounting entries. Technicaly, the account move lines include in a draft account move do not have to be printed opw:633642 --- addons/account/report/account_tax_report.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/account/report/account_tax_report.py b/addons/account/report/account_tax_report.py index b3cbcb441bf..91b1514ba2a 100644 --- a/addons/account/report/account_tax_report.py +++ b/addons/account/report/account_tax_report.py @@ -143,15 +143,18 @@ class tax_report(report_sxw.rml_parse, common_report_header): account.name AS name, \ account.code AS code \ FROM account_move_line AS line, \ - account_account AS account \ + account_account AS account, \ + account_move as move \ WHERE line.state <> %s \ + AND line.move_id = move.id \ AND line.tax_code_id = %s \ AND line.account_id = account.id \ AND account.company_id = %s \ AND line.period_id IN %s\ AND account.active \ + AND move.state <> %s \ GROUP BY account.id,account.name,account.code', ('draft', tax_code_id, - company_id, periods_ids,)) + company_id, periods_ids, 'draft',)) res = self.cr.dictfetchall() i = 0 From 39325842e473ffee80fb7fbc967a4bd21c8a09b7 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 28 Apr 2015 11:15:39 +0200 Subject: [PATCH 02/10] [FIX] note: do not set self in args of a super call This silly mistake prevents to group notes by something else than stages. opw-633980 --- addons/note/note.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/note/note.py b/addons/note/note.py index 3e419888c28..ee8d6bb139a 100644 --- a/addons/note/note.py +++ b/addons/note/note.py @@ -173,7 +173,7 @@ class note_note(osv.osv): return result else: - return super(note_note, self).read_group(self, cr, uid, domain, fields, groupby, + return super(note_note, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby) From 24526b18a78191f31500ac622eb84de5ac1342fd Mon Sep 17 00:00:00 2001 From: Mohammad Alhashash Date: Tue, 28 Apr 2015 13:19:22 +0200 Subject: [PATCH 03/10] [FIX] account: remove journal_id from account domains From invoice lines and move lines views. The model 'account.account' has no field journal_id. --- addons/account/account_invoice_view.xml | 6 +++--- addons/account/account_view.xml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 19919e53877..61110cf18ee 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -59,7 +59,7 @@ - + @@ -199,7 +199,7 @@ @@ -358,7 +358,7 @@ diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index e942df0b56e..0b84e86c970 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1119,7 +1119,7 @@ - + @@ -1364,7 +1364,7 @@ - + From 717a695317ace428e37465683a575ebb2854f2d2 Mon Sep 17 00:00:00 2001 From: Mohammad Alhashash Date: Tue, 28 Apr 2015 23:13:45 +0300 Subject: [PATCH 04/10] Revert "[FIX] account: remove journal_id from account domains" This reverts commit 24526b18a78191f31500ac622eb84de5ac1342fd. The journal_id field is not present on account.account but is processed in search method. Next commit will improve the processing to also accept journal_id in read_group. --- addons/account/account_invoice_view.xml | 6 +++--- addons/account/account_view.xml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 61110cf18ee..19919e53877 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -59,7 +59,7 @@ - + @@ -199,7 +199,7 @@ @@ -358,7 +358,7 @@ diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 0b84e86c970..e942df0b56e 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1119,7 +1119,7 @@ - + @@ -1364,7 +1364,7 @@ - + From a6a3db31889260cf4b15fc00a6c035b0c8df7879 Mon Sep 17 00:00:00 2001 From: Mohammad Alhashash Date: Tue, 28 Apr 2015 22:02:35 +0200 Subject: [PATCH 05/10] [FIX] account: custom '_where_calc' method instead of 'search' The domain on account.account was preprocessed in search method but it had no effect on read_group. This lead to inconsistency or errors when using 'goup by' filter. Move domain processing in '_where_calc' method instead as this is used by both 'search' and 'read_group'. --- addons/account/account.py | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 149a1257b71..a9a5b30e4b1 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -226,30 +226,37 @@ class account_account(osv.osv): _description = "Account" _parent_store = True - def search(self, cr, uid, args, offset=0, limit=None, order=None, - context=None, count=False): - if context is None: - context = {} + def _where_calc(self, cr, uid, domain, active_test=True, context=None): + """ Convert domains to allow easier filtering: + code: force case insensitive and right side matching search + journal_id: restrict to the accounts sharing the same account.account.type + """ pos = 0 - - while pos < len(args): - - if args[pos][0] == 'code' and args[pos][1] in ('like', 'ilike') and args[pos][2]: - args[pos] = ('code', '=like', tools.ustr(args[pos][2].replace('%', ''))+'%') - if args[pos][0] == 'journal_id': - if not args[pos][2]: - del args[pos] + while pos < len(domain): + if domain[pos][0] == 'code' and domain[pos][1] in ('like', 'ilike') and domain[pos][2]: + domain[pos] = ('code', '=like', tools.ustr(domain[pos][2].replace('%', '')) + '%') + if domain[pos][0] == 'journal_id': + if not domain[pos][2]: + del domain[pos] continue - jour = self.pool.get('account.journal').browse(cr, uid, args[pos][2], context=context) - if (not (jour.account_control_ids or jour.type_control_ids)) or not args[pos][2]: - args[pos] = ('type','not in',('consolidation','view')) + jour = self.pool.get('account.journal').browse(cr, uid, domain[pos][2], context=context) + if (not (jour.account_control_ids or jour.type_control_ids)) or not domain[pos][2]: + domain[pos] = ('type', 'not in', ('consolidation', 'view')) continue ids3 = map(lambda x: x.id, jour.type_control_ids) ids1 = super(account_account, self).search(cr, uid, [('user_type', 'in', ids3)]) ids1 += map(lambda x: x.id, jour.account_control_ids) - args[pos] = ('id', 'in', ids1) + domain[pos] = ('id', 'in', ids1) pos += 1 + return super(account_account, self)._where_calc(cr, uid, domain, active_test, context) + + def search(self, cr, uid, args, offset=0, limit=None, order=None, + context=None, count=False): + """ Check presence of key 'consolidate_children' in context to include also the Consolidated Children + of found accounts into the result of the search + """ + if context and context.has_key('consolidate_children'): #add consolidated children of accounts ids = super(account_account, self).search(cr, uid, args, offset, limit, order, context=context, count=count) From fa01054ae0a82ccea7c986f6b0c27292dcdc9c23 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 29 Apr 2015 17:14:56 +0200 Subject: [PATCH 06/10] [FIX] delivery: delivery price uses pricelist currency instead of company currency opw-632574 --- addons/delivery/sale.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/delivery/sale.py b/addons/delivery/sale.py index c5ae43a4546..71b72efc452 100644 --- a/addons/delivery/sale.py +++ b/addons/delivery/sale.py @@ -48,6 +48,7 @@ class sale_order(osv.osv): grid_obj = self.pool.get('delivery.grid') carrier_obj = self.pool.get('delivery.carrier') acc_fp_obj = self.pool.get('account.fiscal.position') + currency_obj = self.pool.get('res.currency') for order in self.browse(cr, uid, ids, context=context): grid_id = carrier_obj.grid_get(cr, uid, [order.carrier_id.id], order.partner_shipping_id.id) if not grid_id: @@ -61,6 +62,10 @@ class sale_order(osv.osv): taxes = grid.carrier_id.product_id.taxes_id fpos = order.fiscal_position or False taxes_ids = acc_fp_obj.map_tax(cr, uid, fpos, taxes) + price_unit = grid_obj.get_price(cr, uid, grid.id, order, time.strftime('%Y-%m-%d'), context) + if order.company_id.currency_id.id != order.pricelist_id.currency_id.id: + price_unit = currency_obj.compute(cr, uid, order.company_id.currency_id.id, order.pricelist_id.currency_id.id, + price_unit, context=dict(context or {}, date=order.date_order)) #create the sale order line line_obj.create(cr, uid, { 'order_id': order.id, @@ -68,7 +73,7 @@ class sale_order(osv.osv): 'product_uom_qty': 1, 'product_uom': grid.carrier_id.product_id.uom_id.id, 'product_id': grid.carrier_id.product_id.id, - 'price_unit': grid_obj.get_price(cr, uid, grid.id, order, time.strftime('%Y-%m-%d'), context), + 'price_unit': price_unit, 'tax_id': [(6,0,taxes_ids)], 'type': 'make_to_stock' }) From f2f4391e8bc0a135f0b1c4afe93e272cb27407b6 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 29 Apr 2015 17:39:58 +0200 Subject: [PATCH 07/10] [FIX] account_followup: partial overdue payments This is related to rev. ab9f02cdee91d9caa873f190a40bbb17e6cbc7b4 The above rev. take care to exclude payments that are not yet due; meaning the ones due in the future, by checking the maturity date. Problem: Payments (e.g. move lines from bank statements) do not have a maturity date. Only move lines that actually have a maturity date, in the future, must be excluded, not the one that do not have a maturity date. opw-633930 --- addons/account_followup/account_followup.py | 2 +- addons/account_followup/report/account_followup_print.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py index e7778cb76c2..c48bab0f256 100644 --- a/addons/account_followup/account_followup.py +++ b/addons/account_followup/account_followup.py @@ -315,7 +315,7 @@ class res_partner(osv.osv): ('reconcile_id', '=', False), ('state', '!=', 'draft'), ('company_id', '=', company_id), - ('date_maturity', '<=', fields.date.context_today(self,cr,uid)), + '|', ('date_maturity', '=', False), ('date_maturity', '<=', fields.date.context_today(self, cr, uid)), ], context=context): raise osv.except_osv(_('Error!'),_("The partner does not have any accounting entries to print in the overdue report for the current company.")) self.message_post(cr, uid, [ids[0]], body=_('Printed overdue payments report'), context=context) diff --git a/addons/account_followup/report/account_followup_print.py b/addons/account_followup/report/account_followup_print.py index cd868629de5..bfec7f2f52d 100644 --- a/addons/account_followup/report/account_followup_print.py +++ b/addons/account_followup/report/account_followup_print.py @@ -58,7 +58,7 @@ class report_rappel(report_sxw.rml_parse): ('reconcile_id', '=', False), ('state', '!=', 'draft'), ('company_id', '=', company_id), - ('date_maturity', '<=', fields.date.context_today(self,self.cr,self.uid)), + '|', ('date_maturity', '=', False), ('date_maturity', '<=', fields.date.context_today(self, self.cr, self.uid)), ]) # lines_per_currency = {currency: [line data, ...], ...} From 1da5d89ba32526f241b3a0ce82b25a2fa9ee858f Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 30 Apr 2015 13:29:27 +0200 Subject: [PATCH 08/10] [FIX] web: advanced search on floats with ',' as decimal separator When using another decimal separator than `.` (dot) in the language settings, it wasn't possible to build an advanced search specifying the decimals. e.g. with a language with decimal separator `,` and thousand separator `.`, if you want to search invoices with amount total 366,38 The advanced search "Total" "is equal to" obliged you to enter your number with `.` as separator (366.38), and then, when entering the search, the `.` was regarded as the thousand separator, giving as domain `('amount_total', '=', 36638)`, which is not what you asked. opw-634201 PS: The `|| '.'` in the xml template are only for retro-compatibility, so if the server sources are updated, but the browser cache is not refreshed (meaning the Javascript code isn't refreshed, and, therefore, `widget.decimal_point is undefined) it still works. --- addons/web/static/src/js/search.js | 4 ++++ addons/web/static/src/xml/base.xml | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 3ac03cf4052..3a3fab3e74c 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -2150,6 +2150,10 @@ instance.web.search.ExtendedSearchProposition.Float = instance.web.search.Extend {value: "∃", text: _lt("is set")}, {value: "∄", text: _lt("is not set")} ], + init: function (parent) { + this._super(parent); + this.decimal_point = instance.web._t.database.parameters.decimal_point; + }, toString: function () { return this.$el.val(); }, diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 13d7e5df080..e9949a589b1 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1673,7 +1673,11 @@ - +