Change some parts about code rules

This commit is contained in:
Raimon Esteve 2017-06-12 23:29:26 +02:00
parent e3ab3cfe26
commit 711d9c662c
12 changed files with 268 additions and 313 deletions

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0"?>
<!-- The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="aeat_sii_tax_form_view">

32
aeat.py
View File

@ -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
"""

View File

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0"?>
<!-- The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license terms. -->
<tryton>
<data>
<record model="res.group" id="group_aeat_sii_admin">
<field name="name">AEAT SII Administration</field>
</record>
@ -57,7 +56,6 @@
<field name="perm_delete" eval="True"/>
</record>
<!-- aeat.sii.report.issued -->
<record model="ir.ui.view" id="aeat_sii_report_line_form_view">
<field name="model">aeat.sii.report.lines</field>
@ -87,7 +85,6 @@
<field name="act_window" ref="act_aeat_sii_report_line"/>
</record>
<record model="ir.model.access" id="access_aeat_sii_report_line">
<field name="model" search="[('model', '=', 'aeat.sii.report.lines')]"/>
<field name="perm_read" eval="True"/>
@ -196,6 +193,5 @@
id="menu_aeat_sii_report"
parent="menu_aeat_sii_report_menu" sequence="10"
name="AEAT SII Report Lines"/>
</data>
</tryton>

View File

@ -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

View File

@ -3,7 +3,6 @@
copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="company_view_form">
<field name="model">company.company</field>
<field name="inherit" ref="company.company_view_form"/>
@ -61,6 +60,5 @@
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
</tryton>

View File

@ -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

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0"?>
<!-- The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license terms. -->
<tryton>
@ -15,5 +15,4 @@
<field name="name">account_invoice_list</field>
</record>
</data>
</tryton>

View File

@ -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

View File

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0"?>
<!-- The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="load_pkcs12_start_view">
<field name="model">aeat.sii.load_pkcs12.start</field>
<field name="type">form</field>
@ -18,6 +17,5 @@
<field name="keyword">form_action</field>
<field name="model">company.company,-1</field>
</record>
</data>
</tryton>

View File

@ -8,22 +8,18 @@
<field name="company_vat"/>
<label name="currency"/>
<field name="currency"/>
<label name="book"/>
<field name="book"/>
<label name="operation_type"/>
<field name="operation_type"/>
<label name="version"/>
<field name="version"/>
<label name="fiscalyear"/>
<field name="fiscalyear"/>
<label name="period"/>
<field name="period"/>
<button string="Load Invoices" name="load_invoices" colspan="2"/>
<field name="lines" colspan="6"/>
<label name="state"/>
<field name="state"/>
<label name="communication_state"/>

View File

@ -12,7 +12,6 @@ contains the full copyright notices and license terms. -->
<field name="sii_received_key"/>
<label name="sii_intracomunity_key"/>
<field name="sii_intracomunity_key"/>
<label name="sii_subjected_key"/>
<field name="sii_subjected_key"/>
<label name="sii_excemption_key"/>