lims, lims_account_invoice: allow to delete all services when editing samples

This commit is contained in:
Adrián Bernardi 2022-11-08 13:06:17 -03:00
parent 8ebf379d5d
commit 3509e3548b
2 changed files with 5 additions and 4 deletions

View File

@ -4569,7 +4569,7 @@ class AddSampleServiceStart(ModelView):
analysis_domain = fields.Many2Many('lims.analysis', None, None,
'Analysis domain')
services = fields.One2Many('lims.create_sample.service', None, 'Services',
required=True, depends=['analysis_domain', 'product_type', 'matrix'],
depends=['analysis_domain', 'product_type', 'matrix'],
context={
'analysis_domain': Eval('analysis_domain'),
'product_type': Eval('product_type'), 'matrix': Eval('matrix'),
@ -4732,7 +4732,7 @@ class EditSampleServiceStart(ModelView):
analysis_domain = fields.Many2Many('lims.analysis', None, None,
'Analysis domain')
services = fields.One2Many('lims.create_sample.service', None, 'Services',
required=True, depends=['analysis_domain', 'product_type', 'matrix'],
depends=['analysis_domain', 'product_type', 'matrix'],
context={
'analysis_domain': Eval('analysis_domain'),
'product_type': Eval('product_type'), 'matrix': Eval('matrix'),

View File

@ -290,8 +290,9 @@ class InvoiceLine(metaclass=PoolMeta):
@classmethod
def check_service_invoice(cls, lines):
for line in lines:
if (line.origin and line.origin.__name__ == 'lims.service' and not
line.economic_offer):
if (line.origin and line.origin.__name__ == 'lims.service' and
(not hasattr(line, 'economic_offer') or
not line.economic_offer)):
raise UserError(
gettext('lims_account_invoice.msg_delete_service_invoice',
service=line.origin.rec_name))