From 3c998acaaf5ca8d745e5dc3af13c32e84c339de2 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Fri, 12 Jan 2018 13:56:30 +0100 Subject: [PATCH 1/4] [FIX] website_blog: archive multiple blog.post throws a server error Step to reproduce: - Go to 'Blog' > 'Blog Posts' in the 'Website Admin' module - Select several blog.post on the list view - Click on 'Archive' in the 'Action' dropdown This will throw a server error since write() is overriden for blog.post and do an ensure_one() This commit closes #22208 --- addons/website_blog/models/website_blog.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/website_blog/models/website_blog.py b/addons/website_blog/models/website_blog.py index c2747094b62..e5c39e8b594 100644 --- a/addons/website_blog/models/website_blog.py +++ b/addons/website_blog/models/website_blog.py @@ -207,11 +207,12 @@ class BlogPost(models.Model): @api.multi def write(self, vals): - self.ensure_one() - if 'website_published' in vals and 'published_date' not in vals: - if self.published_date <= fields.Datetime.now(): - vals['published_date'] = vals['website_published'] and fields.Datetime.now() - result = super(BlogPost, self).write(vals) + result = True + for post in self: + copy_vals = vals + if 'website_published' in vals and 'published_date' not in vals and post.published_date <= fields.Datetime.now(): + copy_vals['published_date'] = vals['website_published'] and fields.Datetime.now() or False + result &= super(BlogPost, self).write(copy_vals) self._check_for_publication(vals) return result From 7dd3ab9c55c0faa7929d6377063dfe64c11cc4db Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 27 Dec 2017 11:34:13 +0100 Subject: [PATCH 2/4] [FIX] website_sale: pending message do not disappear On the payment confirmation page, when the payment is still pending. Before this commit: the user friendly message disappeared and a warning icon took its place After this commit, the warning icon is prepended to the message. OPW 787799 --- addons/website_sale/static/src/js/website_sale_validate.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/website_sale/static/src/js/website_sale_validate.js b/addons/website_sale/static/src/js/website_sale_validate.js index 614e8901484..3bef4bc4f9a 100644 --- a/addons/website_sale/static/src/js/website_sale_validate.js +++ b/addons/website_sale/static/src/js/website_sale_validate.js @@ -21,7 +21,10 @@ $(document).ready(function () { setTimeout(function () { payment_transaction_poll_status(); }, Math.ceil(_poll_nbr / 3) * 1000); } else { - result.message = ""; + var $message = $(result.message); + $message.find('span:first').prepend($( + "")); + result.message = $message.html(); } } $('div.oe_website_sale_tx_status').html(result.message); From adad192cc0018ce6838feb2a954044ee0b623841 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 19 Jan 2018 12:02:04 +0100 Subject: [PATCH 3/4] [FIX] account: reconciliation on payment terms The case: create an invoice of 2000 euros. Payment terms have been configured as: 1) fixed amount 150, 0 days after invoice date. 2) fixed amount 200, 10 days after invoice date. 3) fixed amount 200, 20 days after invoice date. 4) balance, 30 days after invoice date Before this commit, when issuing a payment of 150 at day 0, that payment got reconciled with the balance line. After this commit, the payment is reconciled with the right payment term line OPW 805006 --- addons/account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index a31acf43e84..a3c37846348 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -799,7 +799,7 @@ class AccountMoveLine(models.Model): elif self._context.get('skip_full_reconcile_check') == 'amount_currency_only': field = 'amount_residual_currency' #target the pair of move in self that are the oldest - sorted_moves = sorted(self, key=lambda a: a.date) + sorted_moves = sorted(self, key=lambda a: a.date_maturity or a.date) debit = credit = False for aml in sorted_moves: if credit and debit: From d29c2dbbddb2e7407e714b0bb11ffdf6fa317672 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Mon, 22 Jan 2018 16:19:23 +0100 Subject: [PATCH 4/4] [FIX] account: no payment terms on refund In the case where: create an invoice with payment terms that contains at least 2 term lines Validate create a refund by clicking cancel and reconcile Before this commit, the refund move lines were wrongly created and reconciled with the invoice's move lines After this commit, since payment terms are irrelevant on refunds, we set it to false and the problem doesn't raise OPW 804752 --- addons/account/models/account_invoice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 5b09af3be43..f653941e7b6 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -985,6 +985,7 @@ class AccountInvoice(models.Model): values['state'] = 'draft' values['number'] = False values['origin'] = invoice.number + values['payment_term_id'] = False if date: values['date'] = date @@ -1365,6 +1366,7 @@ class AccountPaymentTerm(models.Model): def compute(self, value, date_ref=False): date_ref = date_ref or fields.Date.today() amount = value + sign = value < 0 and -1 or 1 result = [] if self.env.context.get('currency_id'): currency = self.env['res.currency'].browse(self.env.context['currency_id']) @@ -1373,7 +1375,7 @@ class AccountPaymentTerm(models.Model): prec = currency.decimal_places for line in self.line_ids: if line.value == 'fixed': - amt = round(line.value_amount, prec) + amt = sign * round(line.value_amount, prec) elif line.value == 'percent': amt = round(value * (line.value_amount / 100.0), prec) elif line.value == 'balance':