Control to not allow cancell a account move from the wizard if the
account move came from an origin. It has to be done from the origin.
This commit is contained in:
parent
f42d8db074
commit
b4a99d218c
|
@ -8,6 +8,7 @@ from . import invoice
|
|||
from . import party
|
||||
from . import product
|
||||
from . import tax
|
||||
from . import move
|
||||
|
||||
|
||||
def register():
|
||||
|
@ -33,4 +34,5 @@ def register():
|
|||
module='account_es', type_='model')
|
||||
Pool.register(
|
||||
account.CreateChart,
|
||||
move.CancelMoves,
|
||||
module='account_es', type_='wizard')
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the full
|
||||
# copyright notices and license terms.
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.i18n import gettext
|
||||
from trytond.exceptions import UserError
|
||||
|
@ -27,7 +29,7 @@ class Invoice(metaclass=PoolMeta):
|
|||
continue
|
||||
if invoice.move.state != 'posted':
|
||||
raise UserError(gettext(
|
||||
'account_es.cancel_invoice_with_move_post'))
|
||||
'account_es.msg_cancel_invoice_with_move_post'))
|
||||
|
||||
return super(Invoice, cls).cancel(invoices)
|
||||
|
||||
|
|
10
locale/ca.po
10
locale/ca.po
|
@ -215,3 +215,13 @@ msgstr "Codis"
|
|||
msgctxt "view:company.company:"
|
||||
msgid "Registration Data"
|
||||
msgstr "Dades Registrals"
|
||||
|
||||
msgctxt "model:ir.message,text:msg_cancel_invoice_with_move_post"
|
||||
msgid "You cannot cancel an invoice with a posted move."
|
||||
msgstr "No es pot cancel·lar una factura amb un assentament comptabilitzat."
|
||||
|
||||
msgctxt "model:ir.message,text:msg_cancel_move_with_origin"
|
||||
msgid "The move \"%(move)s\" colud not be cancelled because came from origin "
|
||||
"\"%(origin)s\". To cancel it has to be done througth the origin."
|
||||
msgstr "L'assentament \"%(move)s\" no pot ser cancel·lat perquè té un origen "
|
||||
"\"%(origin)s\". Per cancel·lar-lo cal fer-ho des l'origen."
|
||||
|
|
10
locale/es.po
10
locale/es.po
|
@ -215,3 +215,13 @@ msgstr "Códigos"
|
|||
msgctxt "view:company.company:"
|
||||
msgid "Registration Data"
|
||||
msgstr "Datos Registrales"
|
||||
|
||||
msgctxt "model:ir.message,text:msg_cancel_invoice_with_move_post"
|
||||
msgid "You cannot cancel an invoice with a posted move."
|
||||
msgstr "No se puede cancelar una factura con un asiento contabilizado."
|
||||
|
||||
msgctxt "model:ir.message,text:msg_cancel_move_with_origin"
|
||||
msgid "The move \"%(move)s\" colud not be cancelled because came from origin "
|
||||
"\"%(origin)s\". To cancel it has to be done througth the origin."
|
||||
msgstr "El asiento \"%(move)s\" no se puede cancelar porque tiene un origen "
|
||||
"\"%(origin)s\". Para cancelarlo se debe hacer desde el origen."
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="cancel_invoice_with_move_post">
|
||||
<field name="text">You cannot cancel an invoice with a draft move.</field>
|
||||
<record model="ir.message" id="msg_cancel_invoice_with_move_post">
|
||||
<field name="text">You cannot cancel an invoice with a posted move.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_cancel_move_with_origin">
|
||||
<field name="text">The move "%(move)s" colud not be cancelled because came from origin "%(origin)s". To cancel it has to be done througth the origin.</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
Loading…
Reference in New Issue