Active Record
This commit is contained in:
parent
cf7bba2572
commit
cc4f61a0b7
|
@ -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
|
* Change 2.4.0 version
|
||||||
* Add es_ES locale
|
* Add es_ES locale
|
||||||
* Add ca_ES locale
|
* Add ca_ES locale
|
||||||
|
|
|
@ -5,5 +5,4 @@ include COPYRIGHT
|
||||||
include CHANGELOG
|
include CHANGELOG
|
||||||
include LICENSE
|
include LICENSE
|
||||||
include *.xml
|
include *.xml
|
||||||
include *.odt
|
|
||||||
include locale/*.po
|
include locale/*.po
|
||||||
|
|
19
README
19
README
|
@ -1,6 +1,8 @@
|
||||||
account_invoice_taxes_required
|
account_invoice_taxes_required
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
|
The account_invoice_taxes_required module of the Tryton application platform.
|
||||||
|
|
||||||
Installing
|
Installing
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
@ -9,9 +11,13 @@ See INSTALL
|
||||||
Support
|
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
|
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:
|
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/
|
http://wiki.tryton.org/
|
||||||
irc://irc.freenode.net/tryton
|
irc://irc.freenode.net/tryton
|
||||||
|
|
||||||
Documentation
|
|
||||||
-------------
|
|
||||||
|
|
||||||
See the doc/ directory.
|
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -36,3 +37,7 @@ Copyright
|
||||||
|
|
||||||
See COPYRIGHT
|
See COPYRIGHT
|
||||||
|
|
||||||
|
|
||||||
|
For more information please visit the Tryton web site:
|
||||||
|
|
||||||
|
http://www.tryton.org/
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
#This file is part account_invoice_taxes_required module for Tryton.
|
#This file is part account_invoice_taxes_required module for Tryton.
|
||||||
#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 .invoice import *
|
from .invoice import *
|
||||||
|
|
||||||
|
def register():
|
||||||
|
Pool.register(
|
||||||
|
InvoiceLine,
|
||||||
|
module='account_invoice_taxes_required', type_='model')
|
||||||
|
|
|
@ -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',
|
|
||||||
]
|
|
||||||
}
|
|
35
invoice.py
35
invoice.py
|
@ -2,31 +2,30 @@
|
||||||
#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.
|
||||||
import copy
|
import copy
|
||||||
from trytond.model import ModelView, ModelSQL
|
|
||||||
from trytond.pyson import Eval
|
from trytond.pyson import Eval
|
||||||
|
from trytond.pool import PoolMeta
|
||||||
|
|
||||||
|
__all__ = ['InvoiceLine']
|
||||||
|
__metaclass__ = PoolMeta
|
||||||
|
|
||||||
class InvoiceLine(ModelSQL, ModelView):
|
class InvoiceLine:
|
||||||
_name = 'account.invoice.line'
|
'Invoice Line'
|
||||||
|
__name__ = 'account.invoice.line'
|
||||||
|
|
||||||
def __init__(self):
|
@classmethod
|
||||||
super(InvoiceLine, self).__init__()
|
def __setup__(cls):
|
||||||
self._constraints += [
|
super(InvoiceLine, cls).__setup__()
|
||||||
|
cls._constraints += [
|
||||||
('check_tax_required', 'tax_required')
|
('check_tax_required', 'tax_required')
|
||||||
]
|
]
|
||||||
self.taxes = copy.copy(self.taxes)
|
cls.taxes = copy.copy(cls.taxes)
|
||||||
self.taxes.states = self.taxes.states.copy()
|
cls.taxes.states = cls.taxes.states.copy()
|
||||||
self.taxes.states['required'] = Eval('type') == 'line'
|
cls.taxes.states['required'] = Eval('type') == 'line'
|
||||||
self._reset_columns()
|
cls._error_messages.update({
|
||||||
self._error_messages.update({
|
|
||||||
'tax_required': 'All invoice lines must have at least one tax.',
|
'tax_required': 'All invoice lines must have at least one tax.',
|
||||||
})
|
})
|
||||||
|
|
||||||
def check_tax_required(self, ids):
|
def check_tax_required(self):
|
||||||
for line in self.browse(ids):
|
if not self.taxes:
|
||||||
if not line.taxes:
|
return False
|
||||||
return False
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
InvoiceLine()
|
|
||||||
|
|
||||||
|
|
20
setup.py
20
setup.py
|
@ -5,12 +5,20 @@
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
import re
|
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, minor_version, _ = info.get('version', '0.0.1').split('.', 2)
|
||||||
major_version = int(major_version)
|
major_version = int(major_version)
|
||||||
minor_version = int(minor_version)
|
minor_version = int(minor_version)
|
||||||
|
|
||||||
|
|
||||||
requires = ['python-dateutil']
|
requires = ['python-dateutil']
|
||||||
for dep in info.get('depends', []):
|
for dep in info.get('depends', []):
|
||||||
if not re.match(r'(ir|res|workflow|webdav)(\W|$)', dep):
|
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',
|
setup(name='trytond_account_invoice_taxes_required',
|
||||||
version=info.get('version', '0.0.1'),
|
version=info.get('version', '0.0.1'),
|
||||||
description=info.get('description', ''),
|
description='Account Invoice Taxes Required',
|
||||||
author=info.get('author', ''),
|
author='NaN·tic',
|
||||||
author_email=info.get('email', ''),
|
author_email='info@NaN-tic.com',
|
||||||
url=info.get('website', ''),
|
url='http://www.nan-tic.com',
|
||||||
download_url=("https://bitbucket.org/albertnan/account_invoice_taxes_required" +
|
download_url=("https://bitbucket.org/albertnan/account_invoice_taxes_required" +
|
||||||
info.get('version', '0.0.1').rsplit('.', 1)[0] + '/'),
|
info.get('version', '0.0.1').rsplit('.', 1)[0] + '/'),
|
||||||
package_dir={'trytond.modules.account_invoice_taxes_required': '.'},
|
package_dir={'trytond.modules.account_invoice_taxes_required': '.'},
|
||||||
|
@ -35,7 +43,7 @@ setup(name='trytond_account_invoice_taxes_required',
|
||||||
],
|
],
|
||||||
package_data={
|
package_data={
|
||||||
'trytond.modules.account_invoice_taxes_required': info.get('xml', []) \
|
'trytond.modules.account_invoice_taxes_required': info.get('xml', []) \
|
||||||
+ info.get('translation', []),
|
+ ['tryton.cfg', 'locale/*.po'],
|
||||||
},
|
},
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 5 - Production/Stable',
|
'Development Status :: 5 - Production/Stable',
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
[tryton]
|
||||||
|
version=2.6.0
|
||||||
|
depends:
|
||||||
|
ir
|
||||||
|
account
|
||||||
|
company
|
||||||
|
party
|
||||||
|
product
|
||||||
|
res
|
||||||
|
currency
|
||||||
|
account_product
|
||||||
|
account_invoice
|
||||||
|
xml:
|
Loading…
Reference in New Issue