Migrate to python 3.
This commit is contained in:
parent
09223f79c8
commit
dafa817433
|
@ -43,8 +43,7 @@ REPORT_TYPES = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class TaxTemplate:
|
class TaxTemplate(metaclass=PoolMeta):
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
__name__ = 'account.tax.template'
|
__name__ = 'account.tax.template'
|
||||||
|
|
||||||
report_type = fields.Selection(REPORT_TYPES, 'Report Type', sort=False)
|
report_type = fields.Selection(REPORT_TYPES, 'Report Type', sort=False)
|
||||||
|
@ -57,8 +56,7 @@ class TaxTemplate:
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
class Tax():
|
class Tax(metaclass=PoolMeta):
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
__name__ = 'account.tax'
|
__name__ = 'account.tax'
|
||||||
|
|
||||||
report_type = fields.Selection(REPORT_TYPES, 'Report Type', sort=False)
|
report_type = fields.Selection(REPORT_TYPES, 'Report Type', sort=False)
|
||||||
|
|
|
@ -6,9 +6,8 @@ from trytond.pool import PoolMeta
|
||||||
__all__ = ['Company']
|
__all__ = ['Company']
|
||||||
|
|
||||||
|
|
||||||
class Company:
|
class Company(metaclass=PoolMeta):
|
||||||
__name__ = 'company.company'
|
__name__ = 'company.company'
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
facturae_certificate = fields.Binary('Factura-e Certificate',
|
facturae_certificate = fields.Binary('Factura-e Certificate',
|
||||||
help='The certificate to generate the XAdES electronic firm for '
|
help='The certificate to generate the XAdES electronic firm for '
|
||||||
'invoices.')
|
'invoices.')
|
||||||
|
|
20
invoice.py
20
invoice.py
|
@ -110,10 +110,10 @@ _slugify_hyphenate_re = re.compile(r'[-\s]+')
|
||||||
|
|
||||||
|
|
||||||
def slugify(value):
|
def slugify(value):
|
||||||
if not isinstance(value, unicode):
|
if not isinstance(value, str):
|
||||||
value = unicode(value)
|
value = str(value)
|
||||||
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore')
|
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore')
|
||||||
value = unicode(_slugify_strip_re.sub('', value).strip().lower())
|
value = str(_slugify_strip_re.sub('', value).strip().lower())
|
||||||
return _slugify_hyphenate_re.sub('-', value)
|
return _slugify_hyphenate_re.sub('-', value)
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,9 +121,8 @@ def module_path():
|
||||||
return os.path.dirname(os.path.abspath(__file__))
|
return os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
|
||||||
class Invoice:
|
class Invoice(metaclass=PoolMeta):
|
||||||
__name__ = 'account.invoice'
|
__name__ = 'account.invoice'
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
credited_invoices = fields.Function(fields.One2Many('account.invoice',
|
credited_invoices = fields.Function(fields.One2Many('account.invoice',
|
||||||
None, 'Credited Invoices'),
|
None, 'Credited Invoices'),
|
||||||
'get_credited_invoices', searcher='search_credited_invoices')
|
'get_credited_invoices', searcher='search_credited_invoices')
|
||||||
|
@ -435,7 +434,7 @@ class Invoice:
|
||||||
facturae_schema.assertValid(etree.fromstring(xml_string))
|
facturae_schema.assertValid(etree.fromstring(xml_string))
|
||||||
logger.debug("Factura-e XML of invoice %s validated",
|
logger.debug("Factura-e XML of invoice %s validated",
|
||||||
self.rec_name)
|
self.rec_name)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
logger.warning("Error validating generated Factura-e file",
|
logger.warning("Error validating generated Factura-e file",
|
||||||
exc_info=True)
|
exc_info=True)
|
||||||
logger.debug(xml_string)
|
logger.debug(xml_string)
|
||||||
|
@ -508,9 +507,8 @@ class Invoice:
|
||||||
return signed_file_content
|
return signed_file_content
|
||||||
|
|
||||||
|
|
||||||
class InvoiceLine:
|
class InvoiceLine(metaclass=PoolMeta):
|
||||||
__name__ = 'account.invoice.line'
|
__name__ = 'account.invoice.line'
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def taxes_outputs(self):
|
def taxes_outputs(self):
|
||||||
|
@ -544,17 +542,15 @@ class InvoiceLine:
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
class CreditInvoiceStart:
|
class CreditInvoiceStart(metaclass=PoolMeta):
|
||||||
__name__ = 'account.invoice.credit.start'
|
__name__ = 'account.invoice.credit.start'
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
rectificative_reason_code = fields.Selection(
|
rectificative_reason_code = fields.Selection(
|
||||||
[(x[0], x[1]) for x in RECTIFICATIVE_REASON_CODES],
|
[(x[0], x[1]) for x in RECTIFICATIVE_REASON_CODES],
|
||||||
'Rectificative Reason Code', required=True, sort=False)
|
'Rectificative Reason Code', required=True, sort=False)
|
||||||
|
|
||||||
|
|
||||||
class CreditInvoice:
|
class CreditInvoice(metaclass=PoolMeta):
|
||||||
__name__ = 'account.invoice.credit'
|
__name__ = 'account.invoice.credit'
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
|
|
||||||
def do_credit(self, action):
|
def do_credit(self, action):
|
||||||
with Transaction().set_context(
|
with Transaction().set_context(
|
||||||
|
|
3
party.py
3
party.py
|
@ -6,9 +6,8 @@ from trytond.pool import PoolMeta
|
||||||
__all__ = ['Party']
|
__all__ = ['Party']
|
||||||
|
|
||||||
|
|
||||||
class Party:
|
class Party(metaclass=PoolMeta):
|
||||||
__name__ = 'party.party'
|
__name__ = 'party.party'
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
facturae_person_type = fields.Selection([
|
facturae_person_type = fields.Selection([
|
||||||
(None, ''),
|
(None, ''),
|
||||||
('J', 'Legal Entity'),
|
('J', 'Legal Entity'),
|
||||||
|
|
|
@ -6,9 +6,8 @@ from trytond.pool import PoolMeta
|
||||||
__all__ = ['PaymentType']
|
__all__ = ['PaymentType']
|
||||||
|
|
||||||
|
|
||||||
class PaymentType:
|
class PaymentType(metaclass=PoolMeta):
|
||||||
__name__ = 'account.payment.type'
|
__name__ = 'account.payment.type'
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
facturae_type = fields.Selection([
|
facturae_type = fields.Selection([
|
||||||
(None, ''),
|
(None, ''),
|
||||||
('01', 'In cash'),
|
('01', 'In cash'),
|
||||||
|
|
5
setup.py
5
setup.py
|
@ -5,10 +5,7 @@ from setuptools import setup
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import io
|
import io
|
||||||
try:
|
from configparser import ConfigParser
|
||||||
from configparser import ConfigParser
|
|
||||||
except ImportError:
|
|
||||||
from ConfigParser import ConfigParser
|
|
||||||
|
|
||||||
MODULE = 'account_invoice_facturae'
|
MODULE = 'account_invoice_facturae'
|
||||||
PREFIX = 'nantic'
|
PREFIX = 'nantic'
|
||||||
|
|
Loading…
Reference in New Issue