2
0

Improvements as per feedback

This commit is contained in:
Andrea 2018-12-27 09:48:11 +01:00 committed by Andrea Stirpe
parent 85584004f0
commit 319b4c4110
2 changed files with 16 additions and 7 deletions

View File

@ -419,13 +419,22 @@ class AccountSpread(models.Model):
for spread in self:
spread_mls = spread.line_ids.mapped('move_id.line_ids')
spread_mls.remove_move_reconcile()
inv_link = '<a href=# data-oe-model=account.invoice ' \
'data-oe-id=%d>%s</a>' % (spread.invoice_id.id, _("Invoice"))
msg_body = _("Unlinked invoice line '%s' (view %s).") % (
spread.invoice_line_id.name, inv_link)
spread.message_post(body=msg_body)
spread._message_post_unlink_invoice_line()
spread.write({'invoice_line_ids': [(5, 0, 0)]})
def _message_post_unlink_invoice_line(self):
self.ensure_one()
inv_link = '<a href=# data-oe-model=account.invoice ' \
'data-oe-id=%d>%s</a>' % (self.invoice_id.id, _("Invoice"))
msg_body = _("Unlinked invoice line '%s' (view %s).") % (
self.invoice_line_id.name, inv_link)
self.message_post(body=msg_body)
spread_link = '<a href=# data-oe-model=account.spread ' \
'data-oe-id=%d>%s</a>' % (self.id, _("Spread Board"))
msg_body = _("Unlinked '%s' (invoice line %s).") % (
spread_link, self.invoice_line_id.name)
self.invoice_id.message_post(body=msg_body)
@api.multi
def unlink(self):
for spread in self:
@ -437,7 +446,7 @@ class AccountSpread(models.Model):
lambda x: x.move_id.state == 'posted')
if posted_line_ids:
raise ValidationError(
_('Cannot delete spread(s): there are some '
_('Cannot delete spread(s): there are '
'posted Journal Entries.'))
return super().unlink()

View File

@ -102,7 +102,7 @@ class AccountInvoiceSpreadLine(models.Model):
})]
return {
'name': self.spread_id and self.spread_id.name or "/",
'name': self.name or "/",
'ref': self.name,
'date': spread_date,
'journal_id': spread.journal_id.id,