minor fix

This commit is contained in:
wilsongomez 2022-08-19 11:46:49 -05:00
parent ec8da7b068
commit 66b0990391
3 changed files with 22 additions and 0 deletions

View File

@ -11,6 +11,7 @@ from . import product
from . import voucher
from . import purchase
from . import ir
from . import move
def register():
@ -35,6 +36,7 @@ def register():
purchase.Purchase,
purchase.Line,
ir.Cron,
move.Move,
module='laboratory', type_='model')
Pool.register(
service_order.CreateInvoice,

19
move.py Normal file
View File

@ -0,0 +1,19 @@
from trytond.pool import PoolMeta
from trytond.modules.analytic_co.exceptions import AnalyticError
class Move(metaclass=PoolMeta):
__name__ = 'account.move'
@classmethod
def validate_move(cls, moves):
super(Move, cls).validate_move(moves)
for move in moves:
if move.state != 'draft' and move.period.type != 'adjustment':
for line in move.lines:
if line.account and line.account.type.statement != 'balance' and \
not line.analytic_lines and not line.account.code.startswith('4'):
raise AnalyticError(
gettext('analytic_co.msg_analytic_error',
line=line.rec_name, account=line.account.rec_name)
)

View File

@ -6,6 +6,7 @@ depends:
product
sale
company_operation
analytic_co
# log
xml:
laboratory.xml