diff --git a/account.xml b/account.xml index 284d60a..f91587c 100644 --- a/account.xml +++ b/account.xml @@ -1,15 +1,17 @@ - + + - - account.tax - - tax_form - - - account.tax.template - - template_tax_form - + + account.tax + + tax_form + + + account.tax.template + + template_tax_form + diff --git a/aeat.py b/aeat.py index 943be5a..5df4f51 100644 --- a/aeat.py +++ b/aeat.py @@ -1,14 +1,6 @@ # -*- coding: utf-8 -*- # The COPYRIGHT file at the top level of this repository contains the full # copyright notices and license terms. - -__all__ = [ - 'SIIReport', - 'SIIReportLine', - 'IssuedTrytonInvoiceMapper', - 'RecievedTrytonInvoiceMapper', -] - import unicodedata from logging import getLogger from decimal import Decimal @@ -24,6 +16,8 @@ from trytond.pyson import Eval from trytond.pool import Pool from trytond.transaction import Transaction +__all__ = ['SIIReport', 'SIIReportLine', + 'IssuedTrytonInvoiceMapper', 'RecievedTrytonInvoiceMapper'] _logger = getLogger(__name__) _ZERO = Decimal('0.0') @@ -253,24 +247,20 @@ class SIIReport(Workflow, ModelSQL, ModelView): 'required': Eval('state').in_(['confirmed', 'done']), 'readonly': ~Eval('state').in_(['draft', 'confirmed']), }, depends=['state']) - period = fields.Many2One('account.period', 'Period', required=True, domain=[('fiscalyear', '=', Eval('fiscalyear'))], states={ 'readonly': Eval('state') != 'draft', }, depends=['state', 'fiscalyear']) - operation_type = fields.Selection(COMMUNICATION_TYPE, 'Operation Type', required=True, states={ 'readonly': ~Eval('state').in_(['draft', 'confirmed']), }, depends=['state']) - book = fields.Selection(BOOK_KEY, 'Book', required=True, states={ 'readonly': ~Eval('state').in_(['draft', 'confirmed']), }, depends=['state']) - state = fields.Selection([ ('draft', 'Draft'), ('confirmed', 'Confirmed'), @@ -281,16 +271,11 @@ class SIIReport(Workflow, ModelSQL, ModelView): communication_state = fields.Selection(AEAT_COMMUNICATION_STATE, 'Communication State', readonly=True) - - csv = fields.Char( - 'CSV', readonly=True - ) - + csv = fields.Char('CSV', readonly=True) version = fields.Selection([ ('0.7', '0.7'), ], 'Version', required=True, states={ }, depends=['state']) - lines = fields.One2Many('aeat.sii.report.lines', 'report', 'Lines', states={ 'readonly': ~Eval('state').in_(['draft']), @@ -322,7 +307,6 @@ class SIIReport(Workflow, ModelSQL, ModelView): Eval('operation_type').in_(['A0', 'A1'])), } }) - cls._transitions |= set(( ('draft', 'confirmed'), ('draft', 'cancelled'), @@ -697,9 +681,8 @@ class BaseTrytonInvoiceMapper(object): ]) -class IssuedTrytonInvoiceMapper( - mapping.IssuedInvoiceMapper, BaseTrytonInvoiceMapper -): +class IssuedTrytonInvoiceMapper(mapping.IssuedInvoiceMapper, + BaseTrytonInvoiceMapper): """ Tryton Issued Invoice to AEAT mapper """ @@ -707,9 +690,8 @@ class IssuedTrytonInvoiceMapper( specialkey_or_trascendence = attrgetter('sii_issued_key') -class RecievedTrytonInvoiceMapper( - mapping.RecievedInvoiceMapper, BaseTrytonInvoiceMapper -): +class RecievedTrytonInvoiceMapper(mapping.RecievedInvoiceMapper, + BaseTrytonInvoiceMapper): """ Tryton Recieved Invoice to AEAT mapper """ diff --git a/aeat.xml b/aeat.xml index 287dd87..cdfbbe5 100644 --- a/aeat.xml +++ b/aeat.xml @@ -1,201 +1,197 @@ - + + + AEAT SII Administration + + + + + + + + + - - AEAT SII Administration - - - - - - - - - + + aeat.sii.report + form + sii_report_form + + + aeat.sii.report + tree + sii_report_list + + + SII Report + aeat.sii.report + + + + + + + + + + + + + + + + + + + + + + + + + + + - - aeat.sii.report - form - sii_report_form - - - aeat.sii.report - tree - sii_report_list - - - SII Report - aeat.sii.report - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + aeat.sii.report.lines + form + sii_report_lines_form + + + + aeat.sii.report.lines + tree + sii_report_lines_list + + + + AEAT SII Report Lines + aeat.sii.report.lines + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - aeat.sii.report.lines - form - sii_report_lines_form - + + load_invoices + + - - aeat.sii.report.lines - tree - sii_report_lines_list - - - - AEAT SII Report Lines - aeat.sii.report.lines - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - + - - - - - - - - + - - - - - - - - + + SII Report Issued + aeat.sii.report + + + + + + SII Report Invest + aeat.sii.report + + + + - - load_invoices - - + + SII Report Received + aeat.sii.report + - - - - + + + + + SII Report Intracommunity + aeat.sii.report + + + + - - - - - - SII Report Issued - aeat.sii.report - - - - - - - SII Report Invest - aeat.sii.report - - - - - - - SII Report Received - aeat.sii.report - - - - - - - - SII Report Intracommunity - aeat.sii.report - - - - - - - SII Report Lines - aeat.sii.report.lines - - - - + + SII Report Lines + aeat.sii.report.lines + + + diff --git a/company.py b/company.py index 4f6753f..a178fa8 100644 --- a/company.py +++ b/company.py @@ -1,6 +1,5 @@ # The COPYRIGHT file at the top level of this repository contains # the full copyright notices and license terms. - from logging import getLogger from contextlib import contextmanager from tempfile import NamedTemporaryFile @@ -20,6 +19,11 @@ class Company: __name__ = 'company.company' __metaclass__ = PoolMeta + pem_certificate = fields.Binary('PEM Certificate') + encrypted_private_key = fields.Binary('Encrypted Private Key') + private_key = fields.Function(fields.Binary('Private Key'), + 'get_private_key', 'set_private_key') + @classmethod def __setup__(cls): super(Company, cls).__setup__() @@ -29,22 +33,6 @@ class Company: 'missing_pem_cert': "Missing PEM certificate" }) - pem_certificate = fields.Binary( - 'PEM Certificate' - ) - - encrypted_private_key = fields.Binary( - 'Encrypted Private Key' - ) - - private_key = fields.Function( - fields.Binary( - 'Private Key' - ), - 'get_private_key', - 'set_private_key', - ) - @classmethod def get_private_key(cls, companies, name=None): converter = buffer diff --git a/company.xml b/company.xml index 39b33d1..833ec6c 100644 --- a/company.xml +++ b/company.xml @@ -3,64 +3,62 @@ copyright notices and license terms. --> + + company.company + + company_form + - - company.company - - company_form - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/invoice.py b/invoice.py index 451fdfe..8832475 100644 --- a/invoice.py +++ b/invoice.py @@ -1,6 +1,5 @@ # The COPYRIGHT file at the top level of this repository contains the full # copyright notices and license terms. - from trytond.model import fields from trytond.pool import Pool, PoolMeta from trytond.pyson import Eval diff --git a/invoice.xml b/invoice.xml index 91d95fc..2cdba5c 100644 --- a/invoice.xml +++ b/invoice.xml @@ -1,4 +1,4 @@ - + @@ -15,5 +15,4 @@ account_invoice_list - diff --git a/load_pkcs12.py b/load_pkcs12.py index 2aa041d..614a479 100644 --- a/load_pkcs12.py +++ b/load_pkcs12.py @@ -1,6 +1,5 @@ # The COPYRIGHT file at the top level of this repository contains the full # copyright notices and license terms. - from io import BytesIO from logging import getLogger @@ -10,7 +9,6 @@ from OpenSSL.crypto import dump_privatekey from OpenSSL.crypto import FILETYPE_PEM from OpenSSL.crypto import Error as CryptoError - from trytond.transaction import Transaction from trytond.pool import Pool from trytond.model import ModelView diff --git a/load_pkcs12.xml b/load_pkcs12.xml index 372f6b9..7e42689 100644 --- a/load_pkcs12.xml +++ b/load_pkcs12.xml @@ -1,9 +1,8 @@ - + - aeat.sii.load_pkcs12.start form @@ -18,6 +17,5 @@ form_action company.company,-1 - diff --git a/view/sii_report_form.xml b/view/sii_report_form.xml index a5f7abf..fb35271 100644 --- a/view/sii_report_form.xml +++ b/view/sii_report_form.xml @@ -8,22 +8,18 @@