From 026781ec3e133d1c7ac7468a25bb286e64e8a9b9 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 9 Apr 2018 10:36:10 +0200 Subject: [PATCH 1/5] [FIX] account: Validating a statement with old posted moves When validating a statement with old posted moves, the lock date was checked by function, _check_lock_date and then it was impossible to validate the statement even if all the moves were already posted. Backport of this commit: 86a0d31251a701da8bd1dbcb5580b958d932b33a opw:1830804 --- addons/account/models/account_bank_statement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 3f75f605644..e60c0dc09d4 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -247,7 +247,7 @@ class AccountBankStatement(models.Model): raise UserError(_('All the account entries lines must be processed in order to close the statement.')) moves = (moves | st_line.journal_entry_ids) if moves: - moves.post() + moves.filtered(lambda m: m.state != 'posted').post() statement.message_post(body=_('Statement %s confirmed, journal items were created.') % (statement.name,)) statements.link_bank_to_partner() statements.write({'state': 'confirm', 'date_done': time.strftime("%Y-%m-%d %H:%M:%S")}) From ec7f88c334e10c81de4c05e62a06f4b6b2c19ae3 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 9 Apr 2018 11:14:10 +0200 Subject: [PATCH 2/5] [FIX] account_asset: Access error with shared product with deferred revenue Steps to reproduce the bug: -Let's consider a multicompany environment with company A and B -Let's consider a shared product P for A and B -P has a deferred revenue type D set on it -D is defined in A -Let's consider a user U in company B -U creates a SO with P and try to generate the invoice Bug: A access error was raised because U is not allowed to see D and D is needed to genrate the invoice. opw:1825944 --- addons/account_asset/account_asset_invoice.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account_asset/account_asset_invoice.py b/addons/account_asset/account_asset_invoice.py index fe7ab4c7d44..66bc6779cc6 100644 --- a/addons/account_asset/account_asset_invoice.py +++ b/addons/account_asset/account_asset_invoice.py @@ -116,6 +116,7 @@ class ProductTemplate(models.Model): def onchange_deferred_revenue(self): if self.deferred_revenue_category_id: self.property_account_income_id = self.deferred_revenue_category_id.account_asset_id + self.company_id = self.deferred_revenue_category_id.company_id @api.onchange('asset_category_id') def onchange_asset(self): From 78058259419157ae22a8fe485adafc82b6de7f3a Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Tue, 10 Apr 2018 11:36:43 -0700 Subject: [PATCH 3/5] [FIX] pos_mercury: allow test transactions again It used to be possible to run test transactions against mercurypay.com using a regular swiper device, test credentials and test cards provided by Mercury. Mercury has recently disabled this saying this feature did not adhere to certain PCI regulations. It means that currently on the regular mercurypay.com network only real cards (and thus real money) can be used. Because we require a way to test without spending money this commit allows to switch to the test network (mercurycert.net). It uses a system parameter because we cannot introduce a Boolean on pos_mercury.configuration in a stable release. It also changes the test credentials to some that work on mercurycert.net. Note that the regular 'production' swiper devices can not be used on this test environment. This results in: Error 004118: Failed to decrypt The swiper contains embedded cryptographic keys specific to mercury*pay*.net. Instead a specific 'development' swiper device with embedded keys for mercurycert.net is required. opw-1832156 (this is necessary to test that issue) --- addons/pos_mercury/data/pos_mercury_demo.xml | 4 ++-- addons/pos_mercury/models/pos_mercury_transaction.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/pos_mercury/data/pos_mercury_demo.xml b/addons/pos_mercury/data/pos_mercury_demo.xml index fad7adac136..e54bb6ab5b8 100644 --- a/addons/pos_mercury/data/pos_mercury_demo.xml +++ b/addons/pos_mercury/data/pos_mercury_demo.xml @@ -5,8 +5,8 @@ Mercury Demo - 334160 - 81303DUR + 755847002 + xyz diff --git a/addons/pos_mercury/models/pos_mercury_transaction.py b/addons/pos_mercury/models/pos_mercury_transaction.py index ab0415ae9eb..47cf97edc86 100644 --- a/addons/pos_mercury/models/pos_mercury_transaction.py +++ b/addons/pos_mercury/models/pos_mercury_transaction.py @@ -60,7 +60,11 @@ class MercuryTransaction(models.Model): 'SOAPAction': 'http://www.mercurypay.com/CreditTransaction', } - r = urllib2.Request('https://w1.mercurypay.com/ws/ws.asmx', data=xml_transaction, headers=headers) + url = 'https://w1.mercurypay.com/ws/ws.asmx' + if self.env['ir.config_parameter'].sudo().get_param('pos_mercury.enable_test_env'): + url = 'https://w1.mercurycert.net/ws/ws.asmx' + + r = urllib2.Request(url, data=xml_transaction, headers=headers) try: u = urllib2.urlopen(r, timeout=65) response = werkzeug.utils.unescape(u.read()) From c09b89596e71b657d16fec15f6950e2e58afe42b Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Wed, 11 Apr 2018 11:44:39 +0200 Subject: [PATCH 4/5] [FIX] website: keep query strings when redirecting 'website.' page Urls like `/page/website.XXX` are redirected to `/page/XXX`. Before this commit, the redirection would not keep query strings: `/page/website.XXX?rde=1` would redirect to `/page/XXX`. Now, we keep the query strings: `/page/website.XXX?rde=1` will redirect to `/page/XXX?rde=1` Closes #24140 Courtesy of @MTantin --- addons/website/controllers/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 45940ac4cc4..49041b42844 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -76,7 +76,10 @@ class Website(openerp.addons.web.controllers.main.Home): } # /page/website.XXX --> /page/XXX if page.startswith('website.'): - return request.redirect('/page/' + page[8:], code=301) + url = '/page/' + page[8:] + if request.httprequest.query_string: + url += '?' + request.httprequest.query_string + return request.redirect(url, code=301) elif '.' not in page: page = 'website.%s' % page From 8c0b23c23925ecadeb753ed93919dbe2cbea4370 Mon Sep 17 00:00:00 2001 From: Adrien Dieudonne Date: Thu, 12 Apr 2018 09:41:17 +0200 Subject: [PATCH 5/5] [FIX] mrp: quick create bom on new mo Before this commit, an error was raised when you tried to create a new bill of material on a new manufacturing order. In fact, the name_create RPC returned 'false' and slow_create() wasn't executed. By adding _rec_name (as in 10.0) on the corresponding model, the RPC call will raise an error that will be caught by quick_create and forces slow_create(). Closes #9761 --- addons/mrp/mrp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index e427e0f45e4..72cdf5380b3 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -148,6 +148,7 @@ class mrp_bom(osv.osv): _name = 'mrp.bom' _description = 'Bill of Material' _inherit = ['mail.thread'] + _rec_name = 'product_tmpl_id' _columns = { 'code': fields.char('Reference', size=16),