Commit a96b478d authored by Luca Cristaldi's avatar Luca Cristaldi

initial commit

parents
clone:
hg:
image: plugins/hg
pipeline:
tox:
image: ${IMAGE}
environment:
- CFLAGS=-O0
- DB_CACHE=/cache
- TOX_TESTENV_PASSENV=CFLAGS DB_CACHE
- POSTGRESQL_URI=postgresql://postgres@postgresql:5432/
commands:
- pip install tox
- tox -e "${TOXENV}-${DATABASE}"
volumes:
- cache:/root/.cache
services:
postgresql:
image: postgres
when:
matrix:
DATABASE: postgresql
matrix:
include:
- IMAGE: python:3.4
TOXENV: py34
DATABASE: sqlite
- IMAGE: python:3.4
TOXENV: py34
DATABASE: postgresql
- IMAGE: python:3.5
TOXENV: py35
DATABASE: sqlite
- IMAGE: python:3.5
TOXENV: py35
DATABASE: postgresql
- IMAGE: python:3.6
TOXENV: py36
DATABASE: sqlite
- IMAGE: python:3.6
TOXENV: py36
DATABASE: postgresql
- IMAGE: python:3.7
TOXENV: py37
DATABASE: sqlite
- IMAGE: python:3.7
TOXENV: py37
DATABASE: postgresql
id,name,code,kind,type,deferral,reconcile,party_required,parent
16,Mittelab,,view,mittelab_aps,,,,
40,RENDICONTO DI GESTIONE,,view,,,,,16
84,STATO PATRIMONIALE,,view,,,,,16
41,ONERI,,view,,,,,40
76,PROVENTI,,view,,,,,40
17,ATTIVITÀ,,view,,,,,84
35,PASSIVITÀ,,view,,,,,84
18,CREDITI VERSO ASSOCIATI PER VERSAMENTO QUOTE,01/00/00/00,receivable,crediti_verso_soci_quote,True,True,True,17
28,DISPONIBILITÀ LIQUIDE,03/00/00/00,view,,,,,17
29,Depositi bancari e postali,03/10/00/00,other,disponibilita_liquide,True,True,False,28
30,Assegni,03/20/00/00,other,disponibilita_liquide,True,True,False,28
31,Denaro e valori in cassa,03/30/00/00,other,disponibilita_liquide,True,True,False,28
19,IMMOBILIZZAZIONI,05/00/00/00,view,,,,,17
20,Immobilizzazioni immateriali,05/10/00/00,view,,,,,19
21,Costi di impianto e di ampliamento,05/10/10/00,expense,immobilizzazioni,True,True,False,20
22,Diritti di brevetto industriale e diritti di utilizzazione delle opere dell’ingegno,05/10/20/00,expense,immobilizzazioni,True,True,False,20
23,Immobilizzazioni materiali,05/20/00/00,view,,,,,19
24,Impianti e attrezzature,05/20/10/00,expense,immobilizzazioni,True,True,False,23
25,Altri beni,05/20/20/00,expense,immobilizzazioni,True,True,False,23
26,Immobilizzazioni finanziarie,05/30/00/00,view,,,,,19
27,Partecipazioni in imprese diverse,05/30/10/00,stock,immobilizzazioni,True,True,False,26
32,CREDITI,07/00/00/00,view,,,,,17
33,Verso soci,07/10/00/00,receivable,crediti,True,True,True,32
34,Verso altri,07/20/00/00,receivable,crediti,True,True,True,32
36,PATRIMONIO NETTO,31/00/00/00,view,,,,,35
37,DEBITI,33/00/00/00,view,,,,,35
38,Verso fornitori,33/10/00/00,payable,debiti,True,True,True,37
39,Altri debiti,33/20/00/00,payable,debiti,True,True,True,37
87,Verso soci per rimborso spese,33/30/00/00,payable,debiti,True,True,True,37
42,Oneri da attività tipiche,71/00/00/00,view,,,,,41
43,Godimento beni di terzi,71/10/00/00,view,,,,,42
52,Infrastruttura esterna,71/10/10/00,view,,,,,43
47,Dominio,71/10/10/10,expense,oneri,False,True,False,52
48,Canone Server,71/10/10/20,expense,oneri,False,True,False,52
46,Oneri diversi di gestione,71/20/00/00,view,,,,,42
53,Amministrazione,71/20/10/00,view,,,,,46
49,Assicurazione RCT,71/20/10/10,expense,oneri,False,True,False,53
50,Oneri bancari,71/20/10/20,expense,oneri,False,True,False,53
54,Media,71/20/20/00,view,,,,,46
58,Pubblicità online,71/20/20/10,expense,oneri,False,True,False,54
59,Materiale pubblicitario,71/20/20/20,expense,oneri,False,True,False,54
55,Eventi e corsi,71/20/30/00,view,,,,,46
61,Contributo relatori ospiti,71/20/30/10,expense,oneri,False,True,False,55
60,Rinfreschi,71/20/30/20,expense,oneri,False,True,False,55
56,Materiale di consumo,71/20/40/00,view,,,,,46
62,Consumabili elettrici,71/20/40/10,expense,oneri,False,True,False,56
63,Consumabili informatici,71/20/40/20,expense,oneri,False,True,False,56
64,Cosumabili meccanici,71/20/40/30,expense,oneri,False,True,False,56
65,Cancelleria,71/20/40/40,expense,oneri,False,True,False,56
66,Altro materiale di consumo,71/20/40/50,expense,oneri,False,True,False,56
57,Trasferte,71/20/50/00,view,,,,,46
67,Viaggio,71/20/50/10,expense,oneri,False,True,False,57
68,Parcheggio,71/20/50/20,expense,oneri,False,True,False,57
72,Ammortamenti,71/30/00/00,view,,,,,42
69,Beni immateriali,71/30/10/00,expense,oneri,False,True,False,72
73,Beni materiali,71/30/20/00,expense,oneri,False,True,False,72
77,Proventi da attività tipiche,91/00/00/00,view,,,,,76
79,Da contributi su progetti,91/10/00/00,revenue,proventi,False,True,False,77
80,Da contributi enti pubblici,91/20/00/00,revenue,proventi,False,True,False,77
81,Erogazioni liberali degli associati,91/30/00/00,revenue,proventi,False,True,False,77
82,Erogazioni liberali da non soci,91/40/00/00,revenue,proventi,False,True,False,77
86,Quote associative versate,91/50/00/00,revenue,proventi,False,True,False,77
88,Affitto immobili,71/10/20/00,expense,oneri,False,True,False,43
89,Noleggio,71/10/30/00,expense,oneri,False,True,False,43
90,Fondo ammortamento,35/00/00/00,view,,,,,35
91,Fondo impianti e attrezzature,35/10/00/00,other,fondo_ammortamento,True,True,False,90
92,Fondo altri beni,35/20/00/00,other,fondo_ammortamento,True,True,False,90
93,Fondo costi impianto e di ampiamento,35/30/00/00,other,fondo_ammortamento,True,True,False,90
id,name,sequence,income_statement,balance_sheet,display_balance,parent
mittelab_aps,Mittelab APS,10,True,False,debit-credit,
rendiconto_di_gestione,RENDICONTO DI GESTIONE,20,True,False,debit-credit,mittelab_aps
oneri,ONERI,30,True,False,debit-credit,rendiconto_di_gestione
proventi,PROVENTI,40,True,False,credit-debit,rendiconto_di_gestione
stato_patrimoniale,STATO PATRIMONIALE,50,False,True,debit-credit,mittelab_aps
attivita,ATTIVITÀ,60,False,True,debit-credit,stato_patrimoniale
crediti_verso_soci_quote,CREDITI VERSO ASSOCIATI PER VERSAMENTO QUOTE,70,False,True,debit-credit,attivita
disponibilita_liquide,DISPONIBILITÀ LIQUIDE,80,False,True,debit-credit,attivita
immobilizzazioni,IMMOBILIZZAZIONI,90,False,True,debit-credit,attivita
crediti,CREDITI,100,False,True,credit-debit,attivita
passivita,PASSIVITÀ,110,False,True,credit-debit,stato_patrimoniale
debiti,DEBITI,120,False,True,credit-debit,passivita
fondo_ammortamento,FODO AMMORTAMENTO,130,False,True,credit-debit,passivita
patrimonio_netto,PATRIMONIO NETTO,140,True,False,debit-credit,passivita
Copyright (C) 2018 Luca Cristaldi
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Installing mittelab_account_mittelab_aps
========================================
Prerequisites
-------------
* Python 3.4 or later (http://www.python.org/)
* trytond (http://www.tryton.org/)
Installation
------------
Once you've downloaded and unpacked the mittelab_account_mittelab_aps source
release, enter the directory where the archive was unpacked, and run:
python setup.py install
Note that you may need administrator/root privileges for this step, as
this command will by default attempt to install module to the Python
site-packages directory on your system.
For advanced options, please refer to the easy_install and/or the distutils
documentation:
http://setuptools.readthedocs.io/en/latest/easy_install.html
http://docs.python.org/inst/inst.html
To use without installation, extract the archive into ``trytond/modules`` with
the directory name account_mittelab_aps.
This diff is collapsed.
include INSTALL
include README
include COPYRIGHT
include CHANGELOG
include LICENSE
include doc/*
mittelab_account_mittelab_aps
=============================
The account_mittelab_aps module of the Tryton application platform.
Installing
----------
See INSTALL
License
-------
See LICENSE
Copyright
---------
See COPYRIGHT
from trytond.pool import Pool
__all__ = ['register']
def register():
Pool.register(
module='account_mittelab_aps', type_='model')
Pool.register(
module='account_mittelab_aps', type_='wizard')
Pool.register(
module='account_mittelab_aps', type_='report')
This diff is collapsed.
#!/usr/bin/env python
import csv
import xml.dom.minidom as xmd
import xml.etree.ElementTree as ET
from argparse import ArgumentParser, FileType
def pretty_print(xmlstring):
"""
Returns a pretty-printed version of the given `xmlstring`.
"""
return '/n'.join(line for line in xmd.parseString(xmlstring).toprettyxml(indent=" ").split('/n'))
def appendAccountTemplate(structure, id, name, code='', kind='view', type='',deferral='True', reconcile='False',party_required='False', parent=''):
"""
Appends an account template to `structure`.
"""
record = ET.Element('record', id=id, model='account.account.template')
n = ET.SubElement(record, 'field', name='name')
n.text = name
if code:
c = ET.SubElement(record, 'field', name='code')
c.text = code
k = ET.SubElement(record, 'field', name='kind')
k.text = kind
if type:
t = ET.SubElement(record, 'field', name='type', ref=type)
if kind != 'view':
d = ET.SubElement(record, 'field', name='deferral', eval=deferral)
r = ET.SubElement(record, 'field', name='reconcile', eval=reconcile)
pr = ET.SubElement(record, 'field', name='party_required', eval=party_required)
if parent:
p = ET.SubElement(record, 'field', name='parent', ref=parent)
structure.append(record)
def appendAccountType(structure, id, name, sequence='', income_statement='False', balance_sheet='False', display_balance='credit-debit', parent=''):
"""
Appends an account type template to `structure`
"""
record = ET.Element('record', id=id, model='account.account.type.template')
n = ET.SubElement(record, 'field', name='name')
n.text = name
if sequence:
c = ET.SubElement(record, 'field', name='sequence', eval=sequence)
i = ET.SubElement(record, 'field', name='income_statement', eval=income_statement)
b = ET.SubElement(record, 'field', name='balance_sheet', eval=balance_sheet)
d = ET.SubElement(record, 'field', name='display_balance')
d.text = display_balance
if parent:
p = ET.SubElement(record, 'field', name='parent', ref=parent)
structure.append(record)
def createXML(type_file='', account_file=''):
"""
Take the path to the csv files and create a xml structure.
If both file path are present it will concatenate.
"""
tryton = ET.Element('tryton')
data = ET.SubElement(tryton, 'data')
if not (type_file or account_file):
raise AttributeError('Pass atleast one path to a csv file')
if type_file:
csv_reader = csv.DictReader(type_file)
data.append(ET.Comment('=== Account Type Template ==='))
for row in csv_reader:
try:
appendAccountType(data, **row)
except TypeError as err:
raise TypeError('{0}\n' \
'Collumn in the Type table must be named:\n' \
'- id\n' \
'- name\n' \
'- sequence\n' \
'- income_statement\n' \
'- balance_sheet\n' \
'- display_balance\n' \
'- parent'.format(err))
if account_file:
csv_reader = csv.DictReader(account_file)
data.append(ET.Comment('=== Account Template ==='))
for row in csv_reader:
try:
appendAccountTemplate(data, **row)
except TypeError as err:
raise TypeError('{0}\n' \
'Collumn in the Account table must be named:\n' \
'- id\n' \
'- name\n' \
'- code\n' \
'- kind\n' \
'- type\n' \
'- deferral\n'\
'- reconcile\n'\
'- party_required'\
'- parent'.format(err))
return tryton
def main():
parser = ArgumentParser()
parser.add_argument('--type-template', type=FileType())
parser.add_argument('--template', type=FileType())
parser.add_argument('--output', required=True, type=FileType('w'))
args = parser.parse_args()
trytonxml = createXML(type_file=args.type_template, account_file=args.template)
outstring = pretty_print(ET.tostring(trytonxml, encoding='UTF-8', method='xml'))
args.output.write(outstring)
if __name__ == "__main__":
main()
Account Mittelab Aps Module
###########################
#!/usr/bin/env python3
import io
import os
import re
from configparser import ConfigParser
from setuptools import setup, find_packages
MODULE2PREFIX = {}
def read(fname):
return io.open(
os.path.join(os.path.dirname(__file__), fname),
'r', encoding='utf-8').read()
def get_require_version(name):
if minor_version % 2:
require = '%s >= %s.%s.dev0, < %s.%s'
else:
require = '%s >= %s.%s, < %s.%s'
require %= (name, major_version, minor_version,
major_version, minor_version + 1)
return require
config = ConfigParser()
config.read_file(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()
version = info.get('version', '0.0.1')
major_version, minor_version, _ = version.split('.', 2)
major_version = int(major_version)
minor_version = int(minor_version)
name = 'mittelab_account_mittelab_aps'
requires = []
for dep in info.get('depends', []):
if not re.match(r'(ir|res)(\W|$)', dep):
prefix = MODULE2PREFIX.get(dep, 'trytond')
requires.append(get_require_version('%s_%s' % (prefix, dep)))
requires.append(get_require_version('trytond'))
tests_require = []
dependency_links = []
if minor_version % 2:
dependency_links.append('https://trydevpi.tryton.org/')
setup(name=name,
version=version,
description='',
long_description=read('README'),
author='wifasoi',
author_email='wifasoi@gmail.com',
url='http://www.tryton.org/',
keywords='',
package_dir={'trytond.modules.account_mittelab_aps': '.'},
packages=(
['trytond.modules.account_mittelab_aps'] +
['trytond.modules.account_mittelab_aps.%s' % p for p in find_packages()]
),
package_data={
'trytond.modules.account_mittelab_aps': (info.get('xml', [])
+ ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.fodt',
'icons/*.svg', 'tests/*.rst']),
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Plugins',
'Framework :: Tryton',
'Intended Audience :: Developers',
'Intended Audience :: Financial and Insurance Industry',
'Intended Audience :: Legal Industry',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Natural Language :: Bulgarian',
'Natural Language :: Catalan',
'Natural Language :: Chinese (Simplified)',
'Natural Language :: Czech',
'Natural Language :: Dutch',
'Natural Language :: English',
'Natural Language :: French',
'Natural Language :: German',
'Natural Language :: Hungarian',
'Natural Language :: Italian',
'Natural Language :: Persian',
'Natural Language :: Polish',
'Natural Language :: Portuguese (Brazilian)',
'Natural Language :: Russian',
'Natural Language :: Slovenian',
'Natural Language :: Spanish',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Office/Business',
],
license='GPL-3',
python_requires='>=3.4',
install_requires=requires,
dependency_links=dependency_links,
zip_safe=False,
entry_points="""
[trytond.modules]
account_mittelab_aps = trytond.modules.account_mittelab_aps
""",
test_suite='tests',
test_loader='trytond.test_loader:Loader',
tests_require=tests_require,
)
try:
from trytond.modules.account_mittelab_aps.tests.test_account_mittelab_aps import suite
except ImportError:
from .test_account_mittelab_aps import suite
__all__ = ['suite']
import unittest
from trytond.tests.test_tryton import ModuleTestCase
from trytond.tests.test_tryton import suite as test_suite
class AccountMittelabApsTestCase(ModuleTestCase):
'Test Account Mittelab Aps module'
module = 'account_mittelab_aps'
def suite():
suite = test_suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
AccountMittelabApsTestCase))
return suite
[tox]
envlist = {py34,py35,py36,py37}-{sqlite,postgresql},pypy3-{sqlite,postgresql}
[testenv]
commands = {envpython} setup.py test
deps =
{py34,py35,py36,py37}-postgresql: psycopg2 >= 2.5
pypy3-postgresql: psycopg2cffi >= 2.5
{py34,py35,py36}-sqlite: sqlitebck
setenv =
sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}
postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}
sqlite: DB_NAME={env:SQLITE_NAME::memory:}
postgresql: DB_NAME={env:POSTGRESQL_NAME:test}
install_command = pip install --pre --process-dependency-links {opts} {packages}
[tryton]
version=5.0.0
depends:
ir
xml:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment