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
|
||||
* Add es_ES locale
|
||||
* Add ca_ES locale
|
||||
|
|
|
@ -5,5 +5,4 @@ include COPYRIGHT
|
|||
include CHANGELOG
|
||||
include LICENSE
|
||||
include *.xml
|
||||
include *.odt
|
||||
include locale/*.po
|
||||
|
|
19
README
19
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/
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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 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()
|
||||
|
||||
|
|
20
setup.py
20
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',
|
||||
|
|
|
@ -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