diff --git a/CHANGELOG b/CHANGELOG index d769b14..a98a8ee 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +Version 2.6.0 - 2012-10-17 +* Active Record +* Simplify module information with python configuration + +Version 2.4.0 - 2012-08-27 * Change 2.4.0 version * Add es_ES locale * Add ca_ES locale diff --git a/MANIFEST.in b/MANIFEST.in index 7f5d5fd..c30f8cf 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,5 +5,4 @@ include COPYRIGHT include CHANGELOG include LICENSE include *.xml -include *.odt include locale/*.po diff --git a/README b/README index 784892a..5ae20f3 100644 --- a/README +++ b/README @@ -1,6 +1,8 @@ account_invoice_taxes_required ============================== +The account_invoice_taxes_required module of the Tryton application platform. + Installing ---------- @@ -9,9 +11,13 @@ See INSTALL Support ------- -If you encounter any problems please use bitbucket bugtracker: +For more information or if you encounter any problems with this module, +please contact the programmers at - https://bitbucket.org/albertnan/account_invoice_taxes_required/issues + Nan-Tic + -------------- + website: http://www.nan-tic.com/ + email: info@nan-tic.com If you encounter any problems with Tryton, please don't hesitate to ask questions on the Tryton bug tracker, mailing list, wiki or IRC channel: @@ -21,11 +27,6 @@ questions on the Tryton bug tracker, mailing list, wiki or IRC channel: http://wiki.tryton.org/ irc://irc.freenode.net/tryton -Documentation -------------- - -See the doc/ directory. - License ------- @@ -36,3 +37,7 @@ Copyright See COPYRIGHT + +For more information please visit the Tryton web site: + + http://www.tryton.org/ diff --git a/__init__.py b/__init__.py index caab68c..4062bb7 100644 --- a/__init__.py +++ b/__init__.py @@ -1,5 +1,10 @@ #This file is part account_invoice_taxes_required module for Tryton. #The COPYRIGHT file at the top level of this repository contains #the full copyright notices and license terms. - +from trytond.pool import Pool from .invoice import * + +def register(): + Pool.register( + InvoiceLine, + module='account_invoice_taxes_required', type_='model') diff --git a/__tryton__.py b/__tryton__.py deleted file mode 100644 index 1df04c2..0000000 --- a/__tryton__.py +++ /dev/null @@ -1,28 +0,0 @@ -#This file is part account_invoice_taxes_required module for Tryton. -#The COPYRIGHT file at the top level of this repository contains -#the full copyright notices and license terms. -{ - 'name': 'Account Invoice Taxes Required', - 'version': '2.4.0', - 'author': 'NaN·tic', - 'email': 'info@NaN-tic.com', - 'website': 'http://www.tryton.org/', - 'description': 'This module ensures all invoice lines have at least one' - 'tax assigned.', - 'depends': [ - 'ir', - 'account', - 'company', - 'party', - 'product', - 'res', - 'currency', - 'account_product', - 'account_invoice', - ], - 'xml': [ - ], - 'translation': [ - 'locale/ca_ES.po', - ] -} diff --git a/invoice.py b/invoice.py index ee28f03..81af523 100644 --- a/invoice.py +++ b/invoice.py @@ -2,31 +2,30 @@ #The COPYRIGHT file at the top level of this repository contains #the full copyright notices and license terms. import copy -from trytond.model import ModelView, ModelSQL from trytond.pyson import Eval +from trytond.pool import PoolMeta +__all__ = ['InvoiceLine'] +__metaclass__ = PoolMeta -class InvoiceLine(ModelSQL, ModelView): - _name = 'account.invoice.line' +class InvoiceLine: + 'Invoice Line' + __name__ = 'account.invoice.line' - def __init__(self): - super(InvoiceLine, self).__init__() - self._constraints += [ + @classmethod + def __setup__(cls): + super(InvoiceLine, cls).__setup__() + cls._constraints += [ ('check_tax_required', 'tax_required') ] - self.taxes = copy.copy(self.taxes) - self.taxes.states = self.taxes.states.copy() - self.taxes.states['required'] = Eval('type') == 'line' - self._reset_columns() - self._error_messages.update({ + cls.taxes = copy.copy(cls.taxes) + cls.taxes.states = cls.taxes.states.copy() + cls.taxes.states['required'] = Eval('type') == 'line' + cls._error_messages.update({ 'tax_required': 'All invoice lines must have at least one tax.', }) - def check_tax_required(self, ids): - for line in self.browse(ids): - if not line.taxes: - return False + def check_tax_required(self): + if not self.taxes: + return False return True - -InvoiceLine() - diff --git a/setup.py b/setup.py index 8bdb450..b93e293 100644 --- a/setup.py +++ b/setup.py @@ -5,12 +5,20 @@ from setuptools import setup import re +import os +import ConfigParser -info = eval(open('__tryton__.py').read()) +config = ConfigParser.ConfigParser() +config.readfp(open('tryton.cfg')) +info = dict(config.items('tryton')) +for key in ('depends', 'extras_depend', 'xml'): + if key in info: + info[key] = info[key].strip().splitlines() major_version, minor_version, _ = info.get('version', '0.0.1').split('.', 2) major_version = int(major_version) minor_version = int(minor_version) + requires = ['python-dateutil'] for dep in info.get('depends', []): if not re.match(r'(ir|res|workflow|webdav)(\W|$)', dep): @@ -22,10 +30,10 @@ requires.append('trytond >= %s.%s, < %s.%s' % setup(name='trytond_account_invoice_taxes_required', version=info.get('version', '0.0.1'), - description=info.get('description', ''), - author=info.get('author', ''), - author_email=info.get('email', ''), - url=info.get('website', ''), + description='Account Invoice Taxes Required', + author='NaN·tic', + author_email='info@NaN-tic.com', + url='http://www.nan-tic.com', download_url=("https://bitbucket.org/albertnan/account_invoice_taxes_required" + info.get('version', '0.0.1').rsplit('.', 1)[0] + '/'), package_dir={'trytond.modules.account_invoice_taxes_required': '.'}, @@ -35,7 +43,7 @@ setup(name='trytond_account_invoice_taxes_required', ], package_data={ 'trytond.modules.account_invoice_taxes_required': info.get('xml', []) \ - + info.get('translation', []), + + ['tryton.cfg', 'locale/*.po'], }, classifiers=[ 'Development Status :: 5 - Production/Stable', diff --git a/tryton.cfg b/tryton.cfg new file mode 100644 index 0000000..3939bec --- /dev/null +++ b/tryton.cfg @@ -0,0 +1,13 @@ +[tryton] +version=2.6.0 +depends: + ir + account + company + party + product + res + currency + account_product + account_invoice +xml: