Mercurial > hgweb > health
changeset 5041:119ef55d6900
Fix bug #61848: Created Invoices menu taking too long to get invoices from database. Lint
| author | Luis Falcon <falcon@gnuhealth.org> |
|---|---|
| date | Fri, 28 Jan 2022 16:53:13 +0000 |
| parents | bed672499f01 |
| children | 2b2b20e3c9da |
| files | tryton/health_services/health_services_view.xml tryton/health_services/invoice.py |
| diffstat | 2 files changed, 37 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/tryton/health_services/health_services_view.xml +++ b/tryton/health_services/health_services_view.xml @@ -82,12 +82,12 @@ action="gnuhealth_action_health_service" id="gnuhealth_health_service_menu" icon="gnuhealth-list"/> -<!-- Simple view of created health service invoices --> +<!-- Simple view of created health service invoices in the last month --> <record model="ir.action.act_window" id="gnuhealth_action_health_service_invoices"> - <field name="name">Created invoices</field> + <field name="name">Service invoices (last month)</field> <field name="res_model">account.invoice</field> - <field name="domain" eval="[('health_service', '!=', None)]" pyson="1"/> + <field name="domain" eval="[('health_service', '!=', None), ('invoice_date', '>=', Date(delta_months=-1))]" pyson="1"/> </record> <menuitem parent="gnuhealth_services_menu"
--- a/tryton/health_services/invoice.py +++ b/tryton/health_services/invoice.py @@ -1,23 +1,43 @@ -#This file is part of Tryton. The COPYRIGHT file at the top level of -#this repository contains the full copyright notices and license terms. +############################################################################## +# +# GNU Health: The Free Health and Hospital Information System +# Copyright (C) 2008-2022 Luis Falcon <lfalcon@gnusolidario.org> +# Copyright (C) 2011-2022 GNU Solidario <health@gnusolidario.org> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## from trytond.model import fields from trytond.pool import PoolMeta -from trytond import backend __all__ = ['Invoice', 'InvoiceLine'] + class Invoice(metaclass=PoolMeta): __name__ = 'account.invoice' patient = fields.Function( - fields.Many2One('gnuhealth.patient', 'Patient', - help="Patient in the invoice"), - 'get_patient') + fields.Many2One( + 'gnuhealth.patient', 'Patient', + help="Patient in the invoice"), + 'get_patient') health_service = fields.Function( - fields.Many2One('gnuhealth.health_service', 'Health Service', - help="The service entry"), - 'get_health_service', searcher='search_health_service') + fields.Many2One( + 'gnuhealth.health_service', 'Health Service', + help="The service entry"), + 'get_health_service', searcher='search_health_service') def get_patient(self, name): try: @@ -33,10 +53,11 @@ @classmethod def search_health_service(cls, name, clause): - return [('lines.origin.name.id', - clause[1], - clause[2], - 'gnuhealth.health_service.line')] + return [ + ('lines.origin.name.id', + clause[1], + clause[2], + 'gnuhealth.health_service.line')] class InvoiceLine(metaclass=PoolMeta):
