From e9ed86c177c78f05528cadb0b1a80819be995ade Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 21 Apr 2016 15:23:44 +0200 Subject: [PATCH 1/4] [FIX] account: terminology 'Write-Off' is not an appropriate label when the payment is reconciled. A write off (aka. bad debt) is when I emitted an invoice, delivered a service, and never got paid for it entirely. opw-672716 --- addons/account/models/account_payment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index 8d610f5584f..b08a17092a9 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -371,7 +371,7 @@ class account_payment(models.Model): if self.payment_difference_handling == 'reconcile' and self.payment_difference: writeoff_line = self._get_shared_move_line_vals(0, 0, 0, move.id, False) debit_wo, credit_wo, amount_currency_wo, currency_id = aml_obj.with_context(date=self.payment_date).compute_amount_fields(self.payment_difference, self.currency_id, self.company_id.currency_id, invoice_currency) - writeoff_line['name'] = _('Write-Off') + writeoff_line['name'] = _('Counterpart') writeoff_line['account_id'] = self.writeoff_account_id.id writeoff_line['debit'] = debit_wo writeoff_line['credit'] = credit_wo From 6f8030a6f7e918de7a2a45e85a09607ad03948b9 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 21 Apr 2016 16:21:03 +0200 Subject: [PATCH 2/4] [FIX] sale: keep all client ref During batch invoicing, the client reference kept is only the reference of the first invoice. opw-673188 --- addons/sale/sale.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index c9cdc6a5507..02b00c9680c 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -241,7 +241,6 @@ class SaleOrder(models.Model): 'name': self.client_order_ref or '', 'origin': self.name, 'type': 'out_invoice', - 'reference': self.client_order_ref or self.name, 'account_id': self.partner_invoice_id.property_account_receivable_id.id, 'partner_id': self.partner_invoice_id.id, 'journal_id': journal_id, @@ -308,8 +307,13 @@ class SaleOrder(models.Model): inv_data = order._prepare_invoice() invoice = inv_obj.create(inv_data) invoices[group_key] = invoice - elif group_key in invoices and order.name not in invoices[group_key].origin.split(', '): - invoices[group_key].write({'origin': invoices[group_key].origin + ', ' + order.name}) + elif group_key in invoices: + vals = {} + if order.name not in invoices[group_key].origin.split(', '): + vals['origin'] = invoices[group_key].origin + ', ' + order.name + if order.client_order_ref and order.client_order_ref not in invoices[group_key].name.split(', '): + vals['name'] = invoices[group_key].name + ', ' + order.client_order_ref + invoices[group_key].write(vals) if line.qty_to_invoice > 0: line.invoice_line_create(invoices[group_key].id, line.qty_to_invoice) elif line.qty_to_invoice < 0 and final: From 7c6c1880315233e9d288853d1c916797f3071b31 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 22 Apr 2016 10:44:59 +0200 Subject: [PATCH 3/4] [FIX] account_extra_report: operator precedence typo opw-675734 --- .../account_extra_reports/report/account_partner_ledger.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account_extra_reports/report/account_partner_ledger.py b/addons/account_extra_reports/report/account_partner_ledger.py index a5ca5ed2a3c..12ddab4e451 100644 --- a/addons/account_extra_reports/report/account_partner_ledger.py +++ b/addons/account_extra_reports/report/account_partner_ledger.py @@ -28,9 +28,9 @@ class ReportPartnerLedger(models.AbstractModel): sum = 0.0 for r in res: r['displayed_name'] = '-'.join( - r['move_name'] not in ['', '/'] and [r['move_name']] or [] + - r['ref'] not in ['', '/'] and [r['ref']] or [] + - r['name'] not in ['', '/'] and [r['name']] or [] + (r['move_name'] not in ['', '/'] and [r['move_name']] or []) + + (r['ref'] not in ['', '/'] and [r['ref']] or []) + + (r['name'] not in ['', '/'] and [r['name']] or []) ) sum += r['debit'] - r['credit'] r['progress'] = sum From d29ca90c7513014d323bc70ad21118212dc617ea Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 9 Mar 2016 10:20:21 +0100 Subject: [PATCH 4/4] [FIX] im_livechat,mail: address livechat sessions with their unique ID --- addons/im_livechat/models/im_livechat_channel.py | 2 +- addons/im_livechat/models/mail_channel.py | 7 ++++++- addons/mail/static/src/js/chat_manager.js | 6 ++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/im_livechat/models/im_livechat_channel.py b/addons/im_livechat/models/im_livechat_channel.py index 731118d31c4..b657f770c6e 100644 --- a/addons/im_livechat/models/im_livechat_channel.py +++ b/addons/im_livechat/models/im_livechat_channel.py @@ -176,7 +176,7 @@ class ImLivechatChannel(models.Model): 'anonymous_name': anonymous_name, 'channel_type': 'livechat', 'name': ', '.join([anonymous_name, user.name]), - 'public': 'public', + 'public': 'private', 'email_send': False, }) return mail_channel.sudo().with_context(im_livechat_operator_partner_id=operator_partner_id).channel_info()[0] diff --git a/addons/im_livechat/models/mail_channel.py b/addons/im_livechat/models/mail_channel.py index eded0ff17da..8fb014f0b8f 100644 --- a/addons/im_livechat/models/mail_channel.py +++ b/addons/im_livechat/models/mail_channel.py @@ -24,6 +24,11 @@ class MailChannel(models.Model): should be added to the notification, since the user cannot be listining to the channel. """ notifications = super(MailChannel, self)._channel_message_notifications(message) + message_values_dict = notifications[0][1] if len(notifications) else dict(message.message_format()[0]) + for channel in self: + # add uuid for private livechat channels to allow anonymous to listen + if channel.channel_type == 'livechat': + notifications.append([channel.uuid, message_values_dict]) if not message.author_id: unpinned_channel_partner = self.mapped('channel_last_seen_partner_ids').filtered(lambda cp: not cp.is_pinned) if unpinned_channel_partner: @@ -53,7 +58,7 @@ class MailChannel(models.Model): def channel_fetch_slot(self): values = super(MailChannel, self).channel_fetch_slot() pinned_channels = self.env['mail.channel.partner'].search([('partner_id', '=', self.env.user.partner_id.id), ('is_pinned', '=', True)]).mapped('channel_id') - values['channel_livechat'] = self.search([('channel_type', '=', 'livechat'), ('public', 'in', ['public']), ('id', 'in', pinned_channels.ids)]).channel_info() + values['channel_livechat'] = self.search([('channel_type', '=', 'livechat'), ('id', 'in', pinned_channels.ids)]).channel_info() return values @api.model diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js index 87f7fbdf0fb..ce77ea1f6d4 100644 --- a/addons/mail/static/src/js/chat_manager.js +++ b/addons/mail/static/src/js/chat_manager.js @@ -336,10 +336,8 @@ function make_channel (data, options) { messages: [], }}, }; - if (channel.type === "channel" && data.public !== "private") { - channel.type = "public"; - } else if (data.public === "private") { - channel.type = "private"; + if (channel.type === "channel") { + channel.type = data.public !== "private" ? "public" : "private"; } if (_.size(data.direct_partner) > 0) { channel.type = "dm";