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