lims: choose address for results report
This commit is contained in:
parent
f2db170252
commit
c57e18ba78
|
@ -6554,8 +6554,8 @@ msgid "Invoice contact by default"
|
|||
msgstr "Contacto facturación por defecto"
|
||||
|
||||
msgctxt "field:party.address,report:"
|
||||
msgid "Report"
|
||||
msgstr "Informe"
|
||||
msgid "Results Report"
|
||||
msgstr "Informe de resultados"
|
||||
|
||||
msgctxt "field:party.address,report_contact:"
|
||||
msgid "Report contact"
|
||||
|
|
|
@ -96,11 +96,40 @@ class Party(metaclass=PoolMeta):
|
|||
def default_no_acknowledgment_of_receipt():
|
||||
return False
|
||||
|
||||
def get_results_report_address(self):
|
||||
pool = Pool()
|
||||
Address = pool.get('party.address')
|
||||
|
||||
address = Address.search([
|
||||
('party', '=', self.id),
|
||||
('report', '=', True),
|
||||
])
|
||||
if address:
|
||||
return address[0]
|
||||
|
||||
try:
|
||||
address = Address.search([
|
||||
('party', '=', self.id),
|
||||
('invoice', '=', True),
|
||||
])
|
||||
if address:
|
||||
return address[0]
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
address = Address.search([
|
||||
('party', '=', self.id),
|
||||
])
|
||||
if address:
|
||||
return address[0]
|
||||
|
||||
return None
|
||||
|
||||
|
||||
class Address(metaclass=PoolMeta):
|
||||
__name__ = 'party.address'
|
||||
|
||||
report = fields.Boolean('Report')
|
||||
report = fields.Boolean('Results Report')
|
||||
email = fields.Char('Email',
|
||||
states={
|
||||
'required': Or(
|
||||
|
|
|
@ -3879,15 +3879,8 @@ class ResultReport(Report):
|
|||
report_context['replace_number'] = (
|
||||
gettext('lims.msg_replace_number', report=prev_number))
|
||||
report_context['print_date'] = get_print_date()
|
||||
report_context['party'] = (
|
||||
report.report_version.results_report.party.rec_name)
|
||||
try:
|
||||
party_address = (
|
||||
report.report_version.results_report.party.address_get(
|
||||
type='invoice'))
|
||||
except AttributeError:
|
||||
party_address = (
|
||||
report.report_version.results_report.party.address_get())
|
||||
report_context['party'] = report.party.rec_name
|
||||
party_address = report.party.get_results_report_address()
|
||||
|
||||
report_context['party_address'] = party_address.full_address.replace(
|
||||
'\n', ' - ')
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
<field name="acknowledgment_contact_default"/>
|
||||
<field name="invoice_contact"/>
|
||||
<field name="invoice_contact_default"/>
|
||||
<field name="report"/>
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
Loading…
Reference in New Issue