From 0977bd97981efa49821c693dd51b809b39697d01 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 21 Mar 2016 15:25:21 +0100 Subject: [PATCH 01/27] [FIX] account: bank statement fiscal year sequence When using sequences per fiscal year, the sequence used to build the bank statement name must be the according fiscal year sequence. opw-671937 Closes #11185 --- addons/account/account_bank_statement.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 001085233c3..f0f31296551 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -32,7 +32,7 @@ class account_bank_statement(osv.osv): def create(self, cr, uid, vals, context=None): if vals.get('name', '/') == '/': journal_id = vals.get('journal_id', self._default_journal_id(cr, uid, context=context)) - vals['name'] = self._compute_default_statement_name(cr, uid, journal_id, context=context) + vals['name'] = self._compute_default_statement_name(cr, uid, journal_id, context=dict(context, period_id=vals.get('period_id'))) if 'line_ids' in vals: for idx, line in enumerate(vals['line_ids']): line[2]['sequence'] = idx + 1 @@ -75,7 +75,7 @@ class account_bank_statement(osv.osv): def _compute_default_statement_name(self, cr, uid, journal_id, context=None): context = dict(context or {}) obj_seq = self.pool.get('ir.sequence') - period = self.pool.get('account.period').browse(cr, uid, self._get_period(cr, uid, context=context), context=context) + period = self.pool.get('account.period').browse(cr, uid, context.get('period_id') or self._get_period(cr, uid, context=context), context=context) context['fiscalyear_id'] = period.fiscalyear_id.id journal = self.pool.get('account.journal').browse(cr, uid, journal_id, None) return obj_seq.next_by_id(cr, uid, journal.sequence_id.id, context=context) From ec21006d98e8cb076181a9ffb480471b4dc5f076 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 21 Mar 2016 16:41:33 +0100 Subject: [PATCH 02/27] [FIX] account: check context before using it. This is related to 0977bd97981efa49821c693dd51b809b39697d01 --- addons/account/account_bank_statement.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index f0f31296551..8ed9c1c41ef 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -30,6 +30,8 @@ import time class account_bank_statement(osv.osv): def create(self, cr, uid, vals, context=None): + if not context: + context = {} if vals.get('name', '/') == '/': journal_id = vals.get('journal_id', self._default_journal_id(cr, uid, context=context)) vals['name'] = self._compute_default_statement_name(cr, uid, journal_id, context=dict(context, period_id=vals.get('period_id'))) From 9d12f90c239a9d30a47cf5dce0ba15a1417f1438 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 21 Mar 2016 18:26:59 +0100 Subject: [PATCH 03/27] [FIX] crm: check context before using it context could be `Nonetype` opw-672452 --- addons/crm/crm_lead.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 4c784fcd398..9fcaa4e5f1d 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -320,6 +320,8 @@ class crm_lead(format_address, osv.osv): def on_change_user(self, cr, uid, ids, user_id, context=None): """ When changing the user, also set a team_id or restrict team id to the ones user_id is member of. """ + if not context: + context = {} if user_id and context.get('team_id'): team = self.pool['crm.team'].browse(cr, uid, context['team_id'], context=context) if user_id in team.member_ids.ids: From 43445db7e432c46252339d2aed4f284fb7b30746 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 22 Mar 2016 11:27:01 +0100 Subject: [PATCH 04/27] [FIX] point_of_sale: fiscal position on invoice In v8.0 and saas-6, the PoS does not support the concept of fiscal position. Therefore, the invoice generated should not use it, otherwise there might be an inconsistency between the PoS order and the invoice. FORWARDPORT TO SAAS-6 ONLY! Fixes #11299 opw-671743 --- addons/point_of_sale/point_of_sale.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index f665a5b1d32..46c84849bf6 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -1029,6 +1029,8 @@ class pos_order(osv.osv): 'currency_id': order.pricelist_id.currency_id.id, # considering partner's sale pricelist's currency } inv.update(inv_ref.onchange_partner_id(cr, uid, [], 'out_invoice', order.partner_id.id)['value']) + # FORWARDPORT TO SAAS-6 ONLY! + inv.update({'fiscal_position': False}) if not inv.get('account_id', None): inv['account_id'] = acc inv_id = inv_ref.create(cr, uid, inv, context=context) @@ -1045,8 +1047,7 @@ class pos_order(osv.osv): inv_line.update(inv_line_ref.product_id_change(cr, uid, [], line.product_id.id, line.product_id.uom_id.id, - line.qty, partner_id = order.partner_id.id, - fposition_id=order.partner_id.property_account_position.id)['value']) + line.qty, partner_id = order.partner_id.id)['value']) if not inv_line.get('account_analytic_id', False): inv_line['account_analytic_id'] = \ self._prepare_analytic_account(cr, uid, line, From d6c88b8809db5eec83bf3818391386d687f42340 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 21 Mar 2016 16:27:06 +0100 Subject: [PATCH 05/27] [FIX] account: filter out special periods Commit 7b7f3fa filters out the special periods. However, the filtering should be done only for the display in the form view, nto for the reporting which is actually correct. opw-672531 --- addons/account/account.py | 2 +- addons/account/account_invoice_view.xml | 3 ++- addons/account/account_view.xml | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 306bb18fef9..da19fcf7197 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -314,7 +314,7 @@ class account_account(osv.osv): res = {} null_result = dict((fn, 0.0) for fn in field_names) if children_and_consolidated: - aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=dict(context or {}, periods_special=False)) + aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=context) wheres = [""] if query.strip(): diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 3be43cd00e9..71b6779178f 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -336,7 +336,8 @@ on_change="onchange_journal_id(journal_id)" options="{'no_create': True}" attrs="{'readonly':[('internal_number','!=',False)]}"/> + name="account_id" groups="account.group_account_user" + context="{'periods_special': False}"/>