[MERGE] Forward-port 9.0 up to d29ca90c75

This commit is contained in:
Olivier Dony
2016-04-22 13:52:14 +02:00
6 changed files with 20 additions and 13 deletions
+1 -1
View File
@@ -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
@@ -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
@@ -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]
+6 -1
View File
@@ -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
+2 -4
View File
@@ -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";
+7 -3
View File
@@ -240,7 +240,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,
@@ -307,8 +306,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: