Adapt to remove create_invoice_credit_with_refund patch

This commit is contained in:
Raimon Esteve 2020-11-30 11:42:39 +01:00
parent 7352bb7ac2
commit 76f364ed23
4 changed files with 8 additions and 10 deletions

View File

@ -1,7 +1,6 @@
# This file is part account_invoice_posted2draft module for Tryton.
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
from trytond.model import Workflow
from trytond.pyson import Eval
from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction
@ -65,13 +64,12 @@ class Invoice(metaclass=PoolMeta):
return super(Invoice, cls).draft(invoices)
@classmethod
@Workflow.transition('cancel')
def cancel(cls, invoices):
for invoice in invoices:
if invoice.type == 'out' and invoice.number:
raise UserError(gettext(
'account_invoice_posted2draft.msg_cancel_invoice_with_number'))
raise UserError(
gettext('account_invoice_posted2draft.msg_cancel_invoice_with_number',
invoice=invoice.rec_name))
return super(Invoice, cls).cancel(invoices)

View File

@ -3,8 +3,8 @@ msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "model:ir.message,text:msg_cancel_invoice_with_number"
msgid "You cannot cancel an invoice with number"
msgstr "No podeu cancel·lar una factura amb un número assignat."
msgid "You cannot cancel invoice "%(invoice)s" because it already has a number."
msgstr "No podeu cancel·lar la factura "%(invoice)s\" amb un número assignat."
msgctxt "model:ir.message,text:msg_draft_closed_period"
msgid ""

View File

@ -3,8 +3,8 @@ msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "model:ir.message,text:msg_cancel_invoice_with_number"
msgid "You cannot cancel an invoice with number"
msgstr "No puede cancelar una factura con un número asignado."
msgid "You cannot cancel invoice "%(invoice)s" because it already has a number."
msgstr "No puede cancelar la factura "%(invoice)s\" con un número asignado."
msgctxt "model:ir.message,text:msg_draft_closed_period"
msgid ""

View File

@ -7,7 +7,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="text">You can not set to draft invoice "%(invoice)s" because period "%(period)s" is closed.</field>
</record>
<record model="ir.message" id="msg_cancel_invoice_with_number">
<field name="text">You cannot cancel an invoice with number</field>
<field name="text">You cannot cancel invoice "%(invoice)s" because it already has a number.</field>
</record>
<record model="ir.message" id="msg_modify_closed_journal_period">
<field name="text">You can not set to draft invoice "%(invoice)s" on closed journal-period "%(journal_period)s".</field>