Add origin in warning of missing analytics when post an account move

This commit is contained in:
carlosgalvez-nan 2020-03-10 16:03:33 +01:00
parent 8f143b0a68
commit 9c58c3f2f4
4 changed files with 184 additions and 33 deletions

View File

@ -121,12 +121,16 @@ class Account(metaclass=PoolMeta):
class Move(metaclass=PoolMeta):
__name__ = 'account.move'
@classmethod
@ModelView.button
def post(cls, moves):
super(Move, cls).post(moves)
for move in moves:
origin = ''
origin_model = ''
if move.origin:
origin = move.origin.rec_name
origin_model = move.origin.__names__().get('model')
if move.period.type == 'adjustment':
continue
for line in move.lines:
@ -139,8 +143,9 @@ class Move(metaclass=PoolMeta):
line.account.name),
roots=', '.join(r.rec_name
for r in required_roots),
origin=origin,
origin_model=origin_model,
))
for analytic_line in line.analytic_lines:
if analytic_line.account.root in required_roots:
required_roots.remove(analytic_line.account.root)
@ -162,6 +167,8 @@ class Move(metaclass=PoolMeta):
line.account.name),
roots=', '.join(r.rec_name
for r in required_roots),
origin=origin,
origin_model=origin_model,
))

View File

@ -47,6 +47,31 @@ msgctxt ""
msgid "Analytic Account"
msgstr "Compte analític"
msgctxt ""
"field:analytic_account.account-forbidden-account.account,create_date:"
msgid "Create Date"
msgstr "Data de creació"
msgctxt "field:analytic_account.account-forbidden-account.account,create_uid:"
msgid "Create User"
msgstr "Usuari de creació"
msgctxt "field:analytic_account.account-forbidden-account.account,id:"
msgid "ID"
msgstr "Identificació"
msgctxt "field:analytic_account.account-forbidden-account.account,rec_name:"
msgid "Name"
msgstr "Nom registre"
msgctxt "field:analytic_account.account-forbidden-account.account,write_date:"
msgid "Write Date"
msgstr "Data de modificació"
msgctxt "field:analytic_account.account-forbidden-account.account,write_uid:"
msgid "Write User"
msgstr "Usuari de modificació"
msgctxt "field:analytic_account.account-optional-account.account,account:"
msgid "Account"
msgstr "Compte"
@ -56,6 +81,30 @@ msgctxt ""
msgid "Analytic Account"
msgstr "Compte analític"
msgctxt "field:analytic_account.account-optional-account.account,create_date:"
msgid "Create Date"
msgstr "Data de creació"
msgctxt "field:analytic_account.account-optional-account.account,create_uid:"
msgid "Create User"
msgstr "Usuari de creació"
msgctxt "field:analytic_account.account-optional-account.account,id:"
msgid "ID"
msgstr "Identificació"
msgctxt "field:analytic_account.account-optional-account.account,rec_name:"
msgid "Name"
msgstr "Nom registre"
msgctxt "field:analytic_account.account-optional-account.account,write_date:"
msgid "Write Date"
msgstr "Data de modificació"
msgctxt "field:analytic_account.account-optional-account.account,write_uid:"
msgid "Write User"
msgstr "Usuari de modificació"
msgctxt "field:analytic_account.account-required-account.account,account:"
msgid "Account"
msgstr "Compte"
@ -65,6 +114,30 @@ msgctxt ""
msgid "Analytic Account"
msgstr "Compte analític"
msgctxt "field:analytic_account.account-required-account.account,create_date:"
msgid "Create Date"
msgstr "Data de creació"
msgctxt "field:analytic_account.account-required-account.account,create_uid:"
msgid "Create User"
msgstr "Usuari de creació"
msgctxt "field:analytic_account.account-required-account.account,id:"
msgid "ID"
msgstr "Identificació"
msgctxt "field:analytic_account.account-required-account.account,rec_name:"
msgid "Name"
msgstr "Nom registre"
msgctxt "field:analytic_account.account-required-account.account,write_date:"
msgid "Write Date"
msgstr "Data de modificació"
msgctxt "field:analytic_account.account-required-account.account,write_uid:"
msgid "Write User"
msgstr "Usuari de modificació"
msgctxt "field:analytic_account.line,company:"
msgid "Company"
msgstr "Empresa"
@ -107,7 +180,7 @@ msgstr "Compte analític - Compte - Requerit"
msgctxt "model:ir.message,text:account_analytic_not_configured"
msgid ""
"The Move Line \"%(line)s\" is related to the Account \"%(account)s\" which "
"Move Line \"%(line)s\" is related to the Account \"%(account)s\" which "
"is not configured for all Analytic hierarchies"
msgstr ""
"L'apunt \"%(line)s\" està associat al compte \"%(account)s\" el qual no està"
@ -115,7 +188,7 @@ msgstr ""
msgctxt "model:ir.message,text:analytic_account_forbidden_optional"
msgid ""
"The Account \"%(account)s\" has configured the next Analytic Roots as "
"Account \"%(account)s\" has configured the next Analytic Roots as "
"Forbidden and Optional at once: %(roots)s."
msgstr ""
"El compte \"%(account)s\" té configurades les següents jerarquies "
@ -123,7 +196,7 @@ msgstr ""
msgctxt "model:ir.message,text:analytic_account_required_forbidden"
msgid ""
"The Account \"%(account)s\" has configured the next Analytic Roots as "
"Account \"%(account)s\" has configured the next Analytic Roots as "
"Required and Forbidden at once: %(roots)s."
msgstr ""
"El compte \"%(account)s\" té configurades les següents jerarquies "
@ -131,7 +204,7 @@ msgstr ""
msgctxt "model:ir.message,text:analytic_account_required_optional"
msgid ""
"The Account \"%(account)s\" has configured the next Analytic Roots as "
"Account \"%(account)s\" has configured the next Analytic Roots as "
"Required and Optional at once: %(roots)s."
msgstr ""
"El compte \"%(account)s\" té configurades les següents jerarquies "
@ -139,7 +212,7 @@ msgstr ""
msgctxt "model:ir.message,text:invalid_analytic_to_post_move"
msgid ""
"The Account Move \"%(move)s\" can't be posted because the Analytic Lines of "
"Account Move \"%(move)s\" can't be posted because the Analytic Lines of "
"hierachy \"%(root)s\" related to Move Line \"%(line)s\" are not valid."
msgstr ""
"L'assentament \"%(move)s\" no pot ser confirmat perque les línies "
@ -148,17 +221,16 @@ msgstr ""
msgctxt "model:ir.message,text:missing_analytic_lines"
msgid ""
"The Account Move \"%(move)s\" can't be posted because it doesn't have "
"analytic lines for the next required analytic hierachies: %(roots)s."
"\nFor the account %(account)s"
"Account Move \"%(move)s\" with origin %(origin_model)s \"%(origin)s\" can't be posted because it doesn't have analytic lines for the next required analytic hierachies: %(roots)s.\n"
" For the account %(account)s."
msgstr ""
"L'assentament \"%(move)s\" no es pot validar perquè no te línies analítiques"
" de les següents jerarquies obligatories \"%(roots)s\"."
"\nPer la compte %(account)s"
"L'assentament \"%(move)s\" amb origen %(origin_model)s %(origin)s no es pot "
"validar perquè no te línies analítiques de les següents jerarquies "
"obligatories \"%(roots)s\".Pel compte %(account)s"
msgctxt "model:ir.message,text:move_line_account_analytic_forbidden"
msgid ""
"The Analytic Line \"%(line)s\" is related to an Account Move Line of Account"
"Analytic Line \"%(line)s\" is related to an Account Move Line of Account"
" \"%(account)s\" which has the analytics forbidden for the Line\\'s Analytic"
" hierarchy."
msgstr ""

View File

@ -47,6 +47,31 @@ msgctxt ""
msgid "Analytic Account"
msgstr "Cuenta analítica"
msgctxt ""
"field:analytic_account.account-forbidden-account.account,create_date:"
msgid "Create Date"
msgstr "Fecha de creación"
msgctxt "field:analytic_account.account-forbidden-account.account,create_uid:"
msgid "Create User"
msgstr "Usuario de creación"
msgctxt "field:analytic_account.account-forbidden-account.account,id:"
msgid "ID"
msgstr "Identificador"
msgctxt "field:analytic_account.account-forbidden-account.account,rec_name:"
msgid "Name"
msgstr "Nombre registro"
msgctxt "field:analytic_account.account-forbidden-account.account,write_date:"
msgid "Write Date"
msgstr "Fecha modificación"
msgctxt "field:analytic_account.account-forbidden-account.account,write_uid:"
msgid "Write User"
msgstr "Usuario modificación"
msgctxt "field:analytic_account.account-optional-account.account,account:"
msgid "Account"
msgstr "Cuenta"
@ -56,6 +81,30 @@ msgctxt ""
msgid "Analytic Account"
msgstr "Cuenta analítica"
msgctxt "field:analytic_account.account-optional-account.account,create_date:"
msgid "Create Date"
msgstr "Fecha de creación"
msgctxt "field:analytic_account.account-optional-account.account,create_uid:"
msgid "Create User"
msgstr "Usuario de creación"
msgctxt "field:analytic_account.account-optional-account.account,id:"
msgid "ID"
msgstr "Identificador"
msgctxt "field:analytic_account.account-optional-account.account,rec_name:"
msgid "Name"
msgstr "Nombre registro"
msgctxt "field:analytic_account.account-optional-account.account,write_date:"
msgid "Write Date"
msgstr "Fecha modificación"
msgctxt "field:analytic_account.account-optional-account.account,write_uid:"
msgid "Write User"
msgstr "Usuario modificación"
msgctxt "field:analytic_account.account-required-account.account,account:"
msgid "Account"
msgstr "Cuenta"
@ -65,6 +114,30 @@ msgctxt ""
msgid "Analytic Account"
msgstr "Cuenta analítica"
msgctxt "field:analytic_account.account-required-account.account,create_date:"
msgid "Create Date"
msgstr "Fecha de creación"
msgctxt "field:analytic_account.account-required-account.account,create_uid:"
msgid "Create User"
msgstr "Usuario de creación"
msgctxt "field:analytic_account.account-required-account.account,id:"
msgid "ID"
msgstr "Identificador"
msgctxt "field:analytic_account.account-required-account.account,rec_name:"
msgid "Name"
msgstr "Nombre registro"
msgctxt "field:analytic_account.account-required-account.account,write_date:"
msgid "Write Date"
msgstr "Fecha modificación"
msgctxt "field:analytic_account.account-required-account.account,write_uid:"
msgid "Write User"
msgstr "Usuario modificación"
msgctxt "field:analytic_account.line,company:"
msgid "Company"
msgstr "Empresa"
@ -107,7 +180,7 @@ msgstr "Cuenta analítica - Cuenta - Requerida"
msgctxt "model:ir.message,text:account_analytic_not_configured"
msgid ""
"The Move Line \"%(line)s\" is related to the Account \"%(account)s\" which "
"Move Line \"%(line)s\" is related to the Account \"%(account)s\" which "
"is not configured for all Analytic hierarchies"
msgstr ""
"El apunte \"%(line)s\" está asociado a la cuenta \"%(account)s\" la cual no "
@ -115,7 +188,7 @@ msgstr ""
msgctxt "model:ir.message,text:analytic_account_forbidden_optional"
msgid ""
"The Account \"%(account)s\" has configured the next Analytic Roots as "
"Account \"%(account)s\" has configured the next Analytic Roots as "
"Forbidden and Optional at once: %(roots)s."
msgstr ""
"La cuenta \"%(account)s\" tiene configuradas las siguientes jerarquías "
@ -123,7 +196,7 @@ msgstr ""
msgctxt "model:ir.message,text:analytic_account_required_forbidden"
msgid ""
"The Account \"%(account)s\" has configured the next Analytic Roots as "
"Account \"%(account)s\" has configured the next Analytic Roots as "
"Required and Forbidden at once: %(roots)s."
msgstr ""
"La cuenta \"%(account)s\" tiene configuradas las siguientes jerarquías "
@ -131,7 +204,7 @@ msgstr ""
msgctxt "model:ir.message,text:analytic_account_required_optional"
msgid ""
"The Account \"%(account)s\" has configured the next Analytic Roots as "
"Account \"%(account)s\" has configured the next Analytic Roots as "
"Required and Optional at once: %(roots)s."
msgstr ""
"La cuenta \"%(account)s\" tiene configuradas las siguientes jerarquías "
@ -139,7 +212,7 @@ msgstr ""
msgctxt "model:ir.message,text:invalid_analytic_to_post_move"
msgid ""
"The Account Move \"%(move)s\" can't be posted because the Analytic Lines of "
"Account Move \"%(move)s\" can't be posted because the Analytic Lines of "
"hierachy \"%(root)s\" related to Move Line \"%(line)s\" are not valid."
msgstr ""
"El asiento \"%(move)s\" no se puede confirmar porque las líneas analíticas "
@ -148,17 +221,15 @@ msgstr ""
msgctxt "model:ir.message,text:missing_analytic_lines"
msgid ""
"The Account Move \"%(move)s\" can't be posted because it doesn't have "
"analytic lines for the next required analytic hierachies: %(roots)s."
"\nFor the account %(account)s"
"Account Move \"%(move)s\" with origin %(origin_model)s \"%(origin)s\" can't be posted because it doesn't have analytic lines for the next required analytic hierachies: %(roots)s.\n"
" For the account %(account)s."
msgstr ""
"El asiento \"%(move)s\" no se puede validar porqué no tiene líneas "
"analíticas para las siguientes jerarquías obligatorias: %(roots)s."
"\nPara la cuenta %(account)s"
"El asiento \"%(move)s\" con origen %(origin_model)s \"%(origin)s\" no se puede validar porqué no tiene líneas analíticas para las siguientes jerarquías obligatorias: %(roots)s.\n"
"Para la cuenta %(account)s"
msgctxt "model:ir.message,text:move_line_account_analytic_forbidden"
msgid ""
"The Analytic Line \"%(line)s\" is related to an Account Move Line of Account"
"Analytic Line \"%(line)s\" is related to an Account Move Line of Account"
" \"%(account)s\" which has the analytics forbidden for the Line\\'s Analytic"
" hierarchy."
msgstr ""

View File

@ -4,25 +4,26 @@ this repository contains the full copyright notices and license terms. -->
<tryton>
<data grouped="1">
<record model="ir.message" id="analytic_account_required_forbidden">
<field name="text">The Account "%(account)s" has configured the next Analytic Roots as Required and Forbidden at once: %(roots)s.</field>
<field name="text">Account "%(account)s" has configured the next Analytic Roots as Required and Forbidden at once: %(roots)s.</field>
</record>
<record model="ir.message" id="analytic_account_required_optional">
<field name="text">The Account "%(account)s" has configured the next Analytic Roots as Required and Optional at once: %(roots)s.</field>
<field name="text">Account "%(account)s" has configured the next Analytic Roots as Required and Optional at once: %(roots)s.</field>
</record>
<record model="ir.message" id="analytic_account_forbidden_optional">
<field name="text">The Account "%(account)s" has configured the next Analytic Roots as Forbidden and Optional at once: %(roots)s.</field>
<field name="text">Account "%(account)s" has configured the next Analytic Roots as Forbidden and Optional at once: %(roots)s.</field>
</record>
<record model="ir.message" id="missing_analytic_lines">
<field name="text">The Account Move "%(move)s" can't be posted because it doesn't have analytic lines for the next required analytic hierachies: %(roots)s.\nFor the account %(account)s.</field>
<field name="text">Account Move "%(move)s" with origin %(origin_model)s "%(origin)s" can't be posted because it doesn't have analytic lines for the next required analytic hierachies: %(roots)s.
For the account %(account)s.</field>
</record>
<record model="ir.message" id="invalid_analytic_to_post_move">
<field name="text">The Account Move "%(move)s" can't be posted because the Analytic Lines of hierachy "%(root)s" related to Move Line "%(line)s" are not valid.</field>
<field name="text">Account Move "%(move)s" can't be posted because the Analytic Lines of hierachy "%(root)s" related to Move Line "%(line)s" are not valid.</field>
</record>
<record model="ir.message" id="account_analytic_not_configured">
<field name="text">The Move Line "%(line)s" is related to the Account "%(account)s" which is not configured for all Analytic hierarchies</field>
<field name="text">Move Line "%(line)s" is related to the Account "%(account)s" which is not configured for all Analytic hierarchies</field>
</record>
<record model="ir.message" id="move_line_account_analytic_forbidden">
<field name="text">The Analytic Line "%(line)s" is related to an Account Move Line of Account "%(account)s" which has the analytics forbidden for the Line\'s Analytic hierarchy.</field>
<field name="text">Analytic Line "%(line)s" is related to an Account Move Line of Account "%(account)s" which has the analytics forbidden for the Line\'s Analytic hierarchy.</field>
</record>
</data>
</tryton>