Migrate to python 3.
This commit is contained in:
parent
d18aac08af
commit
3bfc3a6018
|
@ -2,8 +2,8 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains
|
||||
# the full copyright notices and license terms.
|
||||
from trytond.pool import Pool
|
||||
import account
|
||||
import payment
|
||||
from . import account
|
||||
from . import payment
|
||||
|
||||
|
||||
def register():
|
||||
|
|
20
account.py
20
account.py
|
@ -23,8 +23,7 @@ ACCOUNT_BANK_KIND = [
|
|||
]
|
||||
|
||||
|
||||
class PaymentType:
|
||||
__metaclass__ = PoolMeta
|
||||
class PaymentType(metaclass=PoolMeta):
|
||||
__name__ = 'account.payment.type'
|
||||
account_bank = fields.Selection(ACCOUNT_BANK_KIND, 'Account Bank Kind',
|
||||
select=True, required=True)
|
||||
|
@ -58,8 +57,7 @@ class PaymentType:
|
|||
return 'none'
|
||||
|
||||
|
||||
class BankAccount:
|
||||
__metaclass__ = PoolMeta
|
||||
class BankAccount(metaclass=PoolMeta):
|
||||
__name__ = 'bank.account'
|
||||
|
||||
@classmethod
|
||||
|
@ -114,8 +112,7 @@ class BankAccount:
|
|||
error_args)
|
||||
|
||||
|
||||
class Party:
|
||||
__metaclass__ = PoolMeta
|
||||
class Party(metaclass=PoolMeta):
|
||||
__name__ = 'party.party'
|
||||
|
||||
@classmethod
|
||||
|
@ -217,8 +214,7 @@ class BankMixin(object):
|
|||
return payment_type.party.id
|
||||
|
||||
|
||||
class Invoice(BankMixin):
|
||||
__metaclass__ = PoolMeta
|
||||
class Invoice(BankMixin, metaclass=PoolMeta):
|
||||
__name__ = 'account.invoice'
|
||||
|
||||
@classmethod
|
||||
|
@ -271,8 +267,7 @@ class Invoice(BankMixin):
|
|||
super(Invoice, cls).post(invoices)
|
||||
|
||||
|
||||
class Reconciliation:
|
||||
__metaclass__ = PoolMeta
|
||||
class Reconciliation(metaclass=PoolMeta):
|
||||
__name__ = 'account.move.reconciliation'
|
||||
|
||||
@classmethod
|
||||
|
@ -307,8 +302,7 @@ class Reconciliation:
|
|||
Invoice.process(invoices)
|
||||
|
||||
|
||||
class Line:
|
||||
__metaclass__ = PoolMeta
|
||||
class Line(metaclass=PoolMeta):
|
||||
__name__ = 'account.move.line'
|
||||
|
||||
reverse_moves = fields.Function(fields.Boolean('With Reverse Moves'),
|
||||
|
@ -580,7 +574,7 @@ class CompensationMove(Wizard):
|
|||
extra_line.credit = abs(amount)
|
||||
|
||||
origin = None
|
||||
for line_origin, line_amount in sorted(origins.iteritems(),
|
||||
for line_origin, line_amount in sorted(origins.items(),
|
||||
key=lambda x: x[1]):
|
||||
if abs(amount) < line_amount:
|
||||
origin = line_origin
|
||||
|
|
12
payment.py
12
payment.py
|
@ -11,8 +11,7 @@ __all__ = ['Journal', 'Group', 'Payment', 'PayLine']
|
|||
_ZERO = Decimal('0.0')
|
||||
|
||||
|
||||
class Journal:
|
||||
__metaclass__ = PoolMeta
|
||||
class Journal(metaclass=PoolMeta):
|
||||
__name__ = 'account.payment.journal'
|
||||
|
||||
payment_type = fields.Many2One('account.payment.type', 'Payment Type',
|
||||
|
@ -22,8 +21,7 @@ class Journal:
|
|||
'the company.'))
|
||||
|
||||
|
||||
class Group:
|
||||
__metaclass__ = PoolMeta
|
||||
class Group(metaclass=PoolMeta):
|
||||
__name__ = 'account.payment.group'
|
||||
|
||||
payment_type = fields.Function(fields.Many2One('account.payment.type',
|
||||
|
@ -60,8 +58,7 @@ class Group:
|
|||
return amount
|
||||
|
||||
|
||||
class Payment:
|
||||
__metaclass__ = PoolMeta
|
||||
class Payment(metaclass=PoolMeta):
|
||||
__name__ = 'account.payment'
|
||||
bank_account = fields.Many2One('bank.account', 'Bank Account',
|
||||
states={
|
||||
|
@ -149,8 +146,7 @@ class Payment:
|
|||
return mandates2
|
||||
|
||||
|
||||
class PayLine:
|
||||
__metaclass__ = PoolMeta
|
||||
class PayLine(metaclass=PoolMeta):
|
||||
__name__ = 'account.move.line.pay'
|
||||
|
||||
def get_payment(self, line, journals):
|
||||
|
|
5
setup.py
5
setup.py
|
@ -7,10 +7,7 @@ from setuptools import setup
|
|||
import re
|
||||
import os
|
||||
import io
|
||||
try:
|
||||
from configparser import ConfigParser
|
||||
except ImportError:
|
||||
from ConfigParser import ConfigParser
|
||||
from configparser import ConfigParser
|
||||
|
||||
MODULE = 'account_bank'
|
||||
PREFIX = 'trytonspain'
|
||||
|
|
|
@ -125,7 +125,7 @@ Create invoice::
|
|||
>>> Invoice.post([invoice.id], config.context)
|
||||
>>> invoice.reload()
|
||||
>>> invoice.state
|
||||
u'posted'
|
||||
'posted'
|
||||
>>> invoice.amount_to_pay == Decimal(240)
|
||||
True
|
||||
|
||||
|
@ -153,7 +153,7 @@ Create credit note::
|
|||
>>> Invoice.post([credit_note.id], config.context)
|
||||
>>> credit_note.reload()
|
||||
>>> credit_note.state
|
||||
u'posted'
|
||||
'posted'
|
||||
>>> credit_note.amount_to_pay == Decimal(-44)
|
||||
True
|
||||
|
||||
|
@ -213,4 +213,4 @@ Create a move that pays the pending amount::
|
|||
>>> invoice.amount_to_pay
|
||||
Decimal('0.0')
|
||||
>>> invoice.state
|
||||
u'paid'
|
||||
'paid'
|
||||
|
|
Loading…
Reference in New Issue