├── report_aeroo
├── .gitignore
├── barcode
│ ├── courB08.pbm
│ ├── courB08.pil
│ ├── FreeMonoBold.ttf
│ ├── __init__.py
│ ├── barcode.py
│ ├── code39.py
│ ├── code128.py
│ └── EANBarCode.py
├── ctt_languages
│ ├── __init__.py
│ ├── en_US
│ │ ├── currencies
│ │ │ ├── __init__.py
│ │ │ ├── eur.py
│ │ │ ├── lvl.py
│ │ │ ├── usd.py
│ │ │ ├── mxn.py
│ │ │ ├── trl.py
│ │ │ └── ltl.py
│ │ └── __init__.py
│ ├── es_ES
│ │ ├── currencies
│ │ │ ├── __init__.py
│ │ │ ├── eur.py
│ │ │ ├── mxn.py
│ │ │ └── usd.py
│ │ └── __init__.py
│ ├── lt_LT
│ │ ├── currencies
│ │ │ ├── __init__.py
│ │ │ ├── eur.py
│ │ │ ├── ltl.py
│ │ │ ├── lvl.py
│ │ │ ├── usd.py
│ │ │ └── uah.py
│ │ └── __init__.py
│ ├── lv_LV
│ │ ├── currencies
│ │ │ ├── __init__.py
│ │ │ ├── eur.py
│ │ │ ├── mxn.py
│ │ │ ├── ltl.py
│ │ │ ├── lvl.py
│ │ │ ├── uah.py
│ │ │ ├── rub.py
│ │ │ ├── trl.py
│ │ │ └── usd.py
│ │ └── __init__.py
│ ├── ru_RU
│ │ ├── currencies
│ │ │ ├── __init__.py
│ │ │ ├── eur.py
│ │ │ ├── ltl.py
│ │ │ ├── lvl.py
│ │ │ ├── uah.py
│ │ │ ├── rub.py
│ │ │ └── usd.py
│ │ └── __init__.py
│ ├── tr_TR
│ │ ├── currencies
│ │ │ ├── __init__.py
│ │ │ ├── usd.py
│ │ │ ├── eur.py
│ │ │ ├── trl.py
│ │ │ └── lvl.py
│ │ └── __init__.py
│ └── uk_UA
│ │ ├── currencies
│ │ ├── __init__.py
│ │ ├── eur.py
│ │ ├── ltl.py
│ │ ├── lvl.py
│ │ ├── rub.py
│ │ ├── uah.py
│ │ └── usd.py
│ │ └── __init__.py
├── static
│ └── description
│ │ └── icon.png
├── config_pixmaps
│ └── module_banner.png
├── README.md
├── security
│ └── ir.model.access.csv
├── data
│ └── report_aeroo_data.xml
├── wizard
│ ├── __init__.py
│ ├── remove_print_button_view.xml
│ ├── add_print_button_view.xml
│ ├── report_print_by_action.py
│ ├── remove_print_button.py
│ ├── add_print_button.py
│ ├── report_actions.py
│ ├── report_import_wizard.py
│ └── report_print_actions.py
├── report_controller.py
├── __init__.py
├── check_deps.py
├── report.py
├── installer.xml
├── installer.py
├── __openerp__.py
└── ctt_objects.py
├── report_aeroo_ooo
├── .gitignore
├── test_temp.odt
├── config_pixmaps
│ └── module_banner.png
├── README.md
├── report_view.xml
├── data
│ └── report_aeroo_data.xml
├── check_deps.py
├── __init__.py
├── __openerp__.py
├── report.py
├── installer.xml
├── installer.py
└── DocumentConverter.py
├── report_aeroo_sample
├── .gitignore
├── report
│ ├── template.odt
│ ├── report_sample.xml
│ ├── __init__.py
│ └── parser.py
├── README.md
├── wizard
│ ├── __init__.py
│ ├── sample_report_view.xml
│ └── sample_report.py
├── __init__.py
└── __openerp__.py
├── README.md
└── .gitignore
/report_aeroo/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 |
--------------------------------------------------------------------------------
/report_aeroo_ooo/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 |
--------------------------------------------------------------------------------
/report_aeroo_sample/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 |
--------------------------------------------------------------------------------
/report_aeroo_ooo/test_temp.odt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamotion/aeroo/HEAD/report_aeroo_ooo/test_temp.odt
--------------------------------------------------------------------------------
/report_aeroo/barcode/courB08.pbm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamotion/aeroo/HEAD/report_aeroo/barcode/courB08.pbm
--------------------------------------------------------------------------------
/report_aeroo/barcode/courB08.pil:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamotion/aeroo/HEAD/report_aeroo/barcode/courB08.pil
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # Please do not edit this file!
4 |
--------------------------------------------------------------------------------
/report_aeroo/barcode/FreeMonoBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamotion/aeroo/HEAD/report_aeroo/barcode/FreeMonoBold.ttf
--------------------------------------------------------------------------------
/report_aeroo_sample/report/template.odt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamotion/aeroo/HEAD/report_aeroo_sample/report/template.odt
--------------------------------------------------------------------------------
/report_aeroo/static/description/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamotion/aeroo/HEAD/report_aeroo/static/description/icon.png
--------------------------------------------------------------------------------
/report_aeroo/config_pixmaps/module_banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamotion/aeroo/HEAD/report_aeroo/config_pixmaps/module_banner.png
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/en_US/currencies/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # Please do not edit this file!
4 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/es_ES/currencies/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # Please do not edit this file!
4 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lt_LT/currencies/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # Please do not edit this file!
4 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lv_LV/currencies/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # Please do not edit this file!
4 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/ru_RU/currencies/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # Please do not edit this file!
4 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/tr_TR/currencies/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # Please do not edit this file!
4 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/uk_UA/currencies/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # Please do not edit this file!
4 |
--------------------------------------------------------------------------------
/report_aeroo_ooo/config_pixmaps/module_banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamotion/aeroo/HEAD/report_aeroo_ooo/config_pixmaps/module_banner.png
--------------------------------------------------------------------------------
/report_aeroo/README.md:
--------------------------------------------------------------------------------
1 | report_aeroo
2 | ============
3 |
4 | Aeroo Reports for Odoo (8.0)
5 |
6 | For further Informations on Aeroo Reports please visit the main repository containing all plugins.
7 |
8 | Main Repository https://github.com/jamotion/aeroo.git
9 |
--------------------------------------------------------------------------------
/report_aeroo_sample/README.md:
--------------------------------------------------------------------------------
1 | report_aeroo_sample
2 | ===================
3 |
4 | Sample Aeroo Report for Odoo (8.0)
5 |
6 | For further Informations on Aeroo Reports please visit the main repository containing all plugins.
7 |
8 | Main Repository https://github.com/jamotion/aeroo.git
9 |
--------------------------------------------------------------------------------
/report_aeroo_ooo/README.md:
--------------------------------------------------------------------------------
1 | report_aeroo_ooo
2 | ================
3 |
4 | Aeroo Reports OpenOffice Connector for Odoo (8.0)
5 |
6 | For further Informations on Aeroo Reports please visit the main repository containing all plugins.
7 |
8 | Main Repository https://github.com/jamotion/aeroo.git
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Aeroo Reports for OpenERP / Odoo 8.0
2 | ====================================
3 |
4 | The official release of aeroo reports for Odoo 8.0 is available
5 | ----------------------------------------------------------------
6 |
7 | So please call all your questions, issues and pull request on https://github.com/aeroo.
8 |
9 | Thanks for all your help!
10 |
11 | Kind Regards
12 |
13 | Renzo
14 |
--------------------------------------------------------------------------------
/report_aeroo/security/ir.model.access.csv:
--------------------------------------------------------------------------------
1 | "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
2 | "report_stylesheets","report.stylesheets","model_report_stylesheets","base.group_system",1,1,1,1
3 | "report_stylesheets_user","report.stylesheets.user","model_report_stylesheets",,1,0,0,0
4 | "report_mimetypes_system","report.mimetypes.system","model_report_mimetypes","base.group_system",1,1,1,1
5 | "report_mimetypes_user","report.mimetypes.user","model_report_mimetypes","base.group_user",1,0,0,0
6 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/en_US/currencies/eur.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class eur(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'en_US'
9 | self.code = u'EUR'
10 | self.fractions = 100
11 | self.cur_singular = u' euro'
12 | self.cur_plural = u' euro'
13 | self.frc_singular = u' cent'
14 | self.frc_plural = u' cents'
15 | # grammatical genders: f - feminine, m - masculine, n -neuter
16 | self.cur_gram_gender = 'm'
17 | self.frc_gram_gender = 'm'
18 |
19 | eur()
20 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/en_US/currencies/lvl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class lvl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'en_US'
9 | self.code = u'LVL'
10 | self.fractions = 100
11 | self.cur_singular = u' lat'
12 | self.cur_plural = u' lats'
13 | self.frc_singular = u' santim'
14 | self.frc_plural = u' santims'
15 | # grammatical genders: f - feminine, m - masculine, n -neuter
16 | self.cur_gram_gender = 'm'
17 | self.frc_gram_gender = 'm'
18 |
19 | lvl()
20 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/es_ES/currencies/eur.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class eur(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'es_ES'
9 | self.code = u'EUR'
10 | self.fractions = 100
11 | self.cur_singular = u' euro'
12 | self.cur_plural = u' euros'
13 | self.frc_singular = u' centavo'
14 | self.frc_plural = u' centavos'
15 | # grammatical genders: f - feminine, m - masculine, n -neuter
16 | self.cur_gram_gender = 'm'
17 | self.frc_gram_gender = 'm'
18 |
19 | eur()
20 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/es_ES/currencies/mxn.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class mxn(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'es_ES'
9 | self.code = u'MXN'
10 | self.fractions = 100
11 | self.cur_singular = u' peso'
12 | self.cur_plural = u' pesos'
13 | self.frc_singular = u' centavo'
14 | self.frc_plural = u' centavos'
15 | # grammatical genders: f - feminine, m - masculine, n -neuter
16 | self.cur_gram_gender = 'm'
17 | self.frc_gram_gender = 'm'
18 |
19 | mxn()
20 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/en_US/currencies/usd.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class usd(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'en_US'
9 | self.code = u'USD'
10 | self.fractions = 100
11 | self.cur_singular = u' US dollar'
12 | self.cur_plural = u' US dollars'
13 | self.frc_singular = u' cent'
14 | self.frc_plural = u' cents'
15 | # grammatical genders: f - feminine, m - masculine, n -neuter
16 | self.cur_gram_gender = 'm'
17 | self.frc_gram_gender = 'm'
18 |
19 | usd()
20 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/en_US/currencies/mxn.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class mxn(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'en_US'
9 | self.code = u'MXN'
10 | self.fractions = 100
11 | self.cur_singular = u' Mexican peso'
12 | self.cur_plural = u' Mexican pesos'
13 | self.frc_singular = u' cent'
14 | self.frc_plural = u' cents'
15 | # grammatical genders: f - feminine, m - masculine, n -neuter
16 | self.cur_gram_gender = 'm'
17 | self.frc_gram_gender = 'm'
18 |
19 | mxn()
20 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/en_US/currencies/trl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class trl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'en_US'
9 | self.code = u'TRL'
10 | self.fractions = 100
11 | self.cur_singular = u' Turkish lira'
12 | self.cur_plural = u' Turkish Liras'
13 | self.frc_singular = u' kurus'
14 | self.frc_plural = u' kuruss'
15 | # grammatical genders: f - feminine, m - masculine, n -neuter
16 | self.cur_gram_gender = 'm'
17 | self.frc_gram_gender = 'm'
18 |
19 | trl()
20 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/en_US/currencies/ltl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class ltl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'en_US'
9 | self.code = u'LTL'
10 | self.fractions = 100
11 | self.cur_singular = u' Lithuanian litas'
12 | self.cur_plural = u' Lithuanian litas'
13 | self.frc_singular = u' cent'
14 | self.frc_plural = u' cents'
15 | # grammatical genders: f - feminine, m - masculine, n -neuter
16 | self.cur_gram_gender = 'm'
17 | self.frc_gram_gender = 'm'
18 |
19 | ltl()
20 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/es_ES/currencies/usd.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class usd(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'es_ES'
9 | self.code = u'USD'
10 | self.fractions = 100
11 | self.cur_singular = u' dólar Américano'
12 | self.cur_plural = u' dólares Américanos'
13 | self.frc_singular = u' centavo'
14 | self.frc_plural = u' centavos'
15 | # grammatical genders: f - feminine, m - masculine, n -neuter
16 | self.cur_gram_gender = 'm'
17 | self.frc_gram_gender = 'm'
18 |
19 | usd()
20 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/tr_TR/currencies/usd.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class usd(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'tr_TR'
9 | self.code = u'USD'
10 | self.fractions = 100
11 | self.cur_singular = u' USD'
12 | # default plural form for currency
13 | self.cur_plural = u' USD'
14 | self.frc_singular = u' sent'
15 | # default plural form for fractions
16 | self.frc_plural = u' sent'
17 | # grammatical genders: f - feminine, m - masculine, n -neuter
18 | self.cur_gram_gender = 'm'
19 | self.frc_gram_gender = 'm'
20 |
21 | usd()
22 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/tr_TR/currencies/eur.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class eur(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'tr_TR'
9 | self.code = u'EUR'
10 | self.fractions = 100
11 | self.cur_singular = u' Euro'
12 | # default plural form for currency
13 | self.cur_plural = u' Euro'
14 | self.frc_singular = u' sent'
15 | # default plural form for fractions
16 | self.frc_plural = u' sent'
17 | # grammatical genders: f - feminine, m - masculine, n -neuter
18 | self.cur_gram_gender = 'm'
19 | self.frc_gram_gender = 'm'
20 |
21 | eur()
22 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/tr_TR/currencies/trl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class trl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'tr_TR'
9 | self.code = u'TRL'
10 | self.fractions = 100
11 | self.cur_singular = u' Lira'
12 | # default plural form for currency
13 | self.cur_plural = u' Lira'
14 | self.frc_singular = u' kuruş'
15 | # default plural form for fractions
16 | self.frc_plural = u' kuruş'
17 | # grammatical genders: f - feminine, m - masculine, n -neuter
18 | self.cur_gram_gender = 'm'
19 | self.frc_gram_gender = 'm'
20 |
21 | trl()
22 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/uk_UA/currencies/eur.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class eur(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'uk_UA'
9 | self.code = u'EUR'
10 | self.fractions = 100
11 | self.cur_singular = u' евро'
12 | self.cur_plural = u' евро'
13 | self.frc_singular = u' цент'
14 | # default plural form for fractions
15 | self.frc_plural = u' центов'
16 | self.frc_plural_2to4 = u' цента'
17 | # grammatical genders: f - feminine, m - masculine, n -neuter
18 | self.cur_gram_gender = 'm'
19 | self.frc_gram_gender = 'm'
20 |
21 | eur()
22 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/ru_RU/currencies/eur.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class eur(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'ru_RU'
9 | self.code = u'EUR'
10 | self.fractions = 100
11 | self.cur_singular = u' евро'
12 | self.cur_plural = u' евро'
13 | self.frc_singular = u' цент'
14 | # default plural form for fractions
15 | self.frc_plural = u' центов'
16 | self.frc_plural_2_to4 = u' цента'
17 |
18 | # grammatical genders: f - feminine, m - masculine, n -neuter
19 | self.cur_gram_gender = 'm'
20 | self.frc_gram_gender = 'm'
21 |
22 | eur()
23 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/tr_TR/currencies/lvl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class lvl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'tr_TR'
9 | self.code = u'LVL'
10 | self.fractions = 100
11 | self.cur_singular = u' Litvanya Liatası'
12 | # default plural form for currency
13 | self.cur_plural = u' Litvanya Liatası'
14 | self.frc_singular = u' santim'
15 | # default plural form for fractions
16 | self.frc_plural = u' santims'
17 | # grammatical genders: f - feminine, m - masculine, n -neuter
18 | self.cur_gram_gender = 'm'
19 | self.frc_gram_gender = 'm'
20 |
21 | lvl()
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 |
5 | # C extensions
6 | *.so
7 |
8 | # Distribution / packaging
9 | .Python
10 | env/
11 | bin/
12 | build/
13 | develop-eggs/
14 | dist/
15 | eggs/
16 | lib/
17 | lib64/
18 | parts/
19 | sdist/
20 | var/
21 | *.egg-info/
22 | .installed.cfg
23 | *.egg
24 |
25 | # Installer logs
26 | pip-log.txt
27 | pip-delete-this-directory.txt
28 |
29 | # Unit test / coverage reports
30 | htmlcov/
31 | .tox/
32 | .coverage
33 | .cache
34 | nosetests.xml
35 | coverage.xml
36 |
37 | # Translations
38 | *.mo
39 |
40 | # Mr Developer
41 | .mr.developer.cfg
42 | .project
43 | .pydevproject
44 |
45 | # Rope
46 | .ropeproject
47 |
48 | # Django stuff:
49 | *.log
50 | *.pot
51 |
52 | # Sphinx documentation
53 | docs/_build/
54 |
55 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lv_LV/currencies/eur.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class eur(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'lv_LV'
9 | self.code = u'EUR'
10 | self.fractions = 100
11 | self.cur_singular = u' eiro'
12 | self.cur_plural = u' eiro'
13 | self.frc_singular = u' cents'
14 | # default plural form for fractions
15 | self.frc_plural = u' centu'
16 | # betwean 1 and 10 yields different plural form, if defined
17 | self.frc_plural_2to10 = u' centi'
18 | # grammatical genders: f - feminine, m - masculine, n -neuter
19 | self.cur_gram_gender = 'm'
20 | self.frc_gram_gender = 'm'
21 |
22 | eur()
23 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lv_LV/currencies/mxn.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class mxn(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'lv_LV'
9 | self.code = u'MXN'
10 | self.fractions = 100
11 | self.cur_singular = u' Meksikas peso'
12 | self.cur_plural = self.cur_singular
13 | self.frc_singular = u' cents'
14 | # default plural form for fractions
15 | self.frc_plural = u' centu'
16 | # betwean 1 and 10 yields different plural form, if defined
17 | self.frc_plural_2to10 = u' centi'
18 | # grammatical genders: f - feminine, m - masculine, n -neuter
19 | self.cur_gram_gender = 'm'
20 | self.frc_gram_gender = 'm'
21 |
22 | mxn()
23 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/ru_RU/currencies/ltl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class ltl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'ru_RU'
9 | self.code = u'LTL'
10 | self.fractions = 100
11 | self.cur_singular = u' лит'
12 | # default plural form for currency
13 | self.cur_plural = u' литов'
14 | self.cur_plural_2to4 = u' лита'
15 | self.frc_singular = u' цент'
16 | # default plural form for fractions
17 | self.frc_plural = u' центов'
18 | self.frc_plural_2to4 = u' цента'
19 | # grammatical genders: f - feminine, m - masculine, n -neuter
20 | self.cur_gram_gender = 'm'
21 | self.frc_gram_gender = 'm'
22 |
23 | ltl()
24 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/uk_UA/currencies/ltl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class ltl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'uk_UA'
9 | self.code = u'LTL'
10 | self.fractions = 100
11 | self.cur_singular = u' лит'
12 | # default plural form for currency
13 | self.cur_plural = u' литов'
14 | self.cur_plural_2to4 = u' лита'
15 | self.frc_singular = u' цент'
16 | # default plural form for fractions
17 | self.frc_plural = u' центов'
18 | self.frc_plural_2to4 = u' цента'
19 | # grammatical genders: f - feminine, m - masculine, n -neuter
20 | self.cur_gram_gender = 'm'
21 | self.frc_gram_gender = 'm'
22 |
23 | ltl()
24 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/ru_RU/currencies/lvl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class lvl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'ru_RU'
9 | self.code = u'LVL'
10 | self.fractions = 100
11 | self.cur_singular = u' лат'
12 | # default plural form for currency
13 | self.cur_plural = u' латов'
14 | self.cur_plural_2to4 = u' лата'
15 | self.frc_singular = u' сантим'
16 | # default plural form for fractions
17 | self.frc_plural = u' сантимов'
18 | self.frc_plural_2to4 = u' сантима'
19 | # grammatical genders: f - feminine, m - masculine, n -neuter
20 | self.cur_gram_gender = 'm'
21 | self.frc_gram_gender = 'm'
22 |
23 | lvl()
24 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/ru_RU/currencies/uah.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class uah(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'ru_RU'
9 | self.code = u'UAH'
10 | self.fractions = 100
11 | self.cur_singular = u' гривна'
12 | # default plural form for currency
13 | self.cur_plural = u' гривен'
14 | self.cur_plural_2to4 = u' гривны'
15 | self.frc_singular = u' копeйка'
16 | # default plural form for fractions
17 | self.frc_plural = u' копeек'
18 | self.frc_plural_2to4 = u' копeйки'
19 | # grammatical genders: f - feminine, m - masculine, n -neuter
20 | self.cur_gram_gender = 'f'
21 | self.frc_gram_gender = 'f'
22 |
23 | uah()
24 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/uk_UA/currencies/lvl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class lvl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'uk_UA'
9 | self.code = u'LVL'
10 | self.fractions = 100
11 | self.cur_singular = u' лат'
12 | # default plural form for currency
13 | self.cur_plural = u' латов'
14 | self.cur_plural_2to3 = u' лата'
15 | self.frc_singular = u' сантим'
16 | # default plural form for fractions
17 | self.frc_plural = u' сантимов'
18 | self.frc_plural_2to3 = u' сантима'
19 | # grammatical genders: f - feminine, m - masculine, n -neuter
20 | self.cur_gram_gender = 'm'
21 | self.frc_gram_gender = 'm'
22 |
23 | lvl()
24 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/uk_UA/currencies/rub.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class rub(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'uk_UA'
9 | self.code = u'RUB'
10 | self.fractions = 100
11 | self.cur_singular = u' рубль'
12 | # default plural form for currency
13 | self.cur_plural = u' рублiв'
14 | self.cur_plural_2to4 = u' рубля'
15 | self.frc_singular = u' копійка'
16 | # default plural form for fractions
17 | self.frc_plural = u' копійок'
18 | self.frc_plural_2to4 = u' копійки'
19 | # grammatical genders: f - feminine, m - masculine, n -neuter
20 | self.cur_gram_gender = 'm'
21 | self.frc_gram_gender = 'f'
22 |
23 | rub()
24 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/uk_UA/currencies/uah.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class uah(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'uk_UA'
9 | self.code = u'UAH'
10 | self.fractions = 100
11 | self.cur_singular = u' гривня'
12 | # default plural form for currency
13 | self.cur_plural = u' гривень'
14 | self.cur_plural_2to4 = u' гривні'
15 | self.frc_singular = u' копійка'
16 | # default plural form for fractions
17 | self.frc_plural = u' копійок'
18 | self.frc_plural_2to4 = u' копійки'
19 | # grammatical genders: f - feminine, m - masculine, n -neuter
20 | self.cur_gram_gender = 'f'
21 | self.frc_gram_gender = 'f'
22 |
23 | uah()
24 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/ru_RU/currencies/rub.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class rub(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'ru_RU'
9 | self.code = u'RUB'
10 | self.fractions = 100
11 | self.cur_singular = u' рубль'
12 | # default plural form for currency
13 | self.cur_plural = u' рублей'
14 | self.cur_plural_2to4 = u' рубля'
15 | self.frc_singular = u' копейка'
16 | # default plural form for fractions
17 | self.frc_plural = u' копеек'
18 | self.frc_plural_2to4 = u' копейки'
19 | # grammatical genders: f - feminine, m - masculine, n -neuter
20 | self.cur_gram_gender = 'm'
21 | self.frc_gram_gender = 'f'
22 |
23 | rub()
24 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/uk_UA/currencies/usd.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class usd(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'uk_UA'
9 | self.code = u'USD'
10 | self.fractions = 100
11 | self.cur_singular = u' доллара США'
12 | # default plural form for currency
13 | self.cur_plural = u' долларов США'
14 | self.cur_plural_2to4 = u' доллара США'
15 | self.frc_singular = u' цент'
16 | # default plural form for fractions
17 | self.frc_plural = u' центов'
18 | self.frc_plural_2to4 = u' цента'
19 | # grammatical genders: f - feminine, m - masculine, n -neuter
20 | self.cur_gram_gender = 'm'
21 | self.frc_gram_gender = 'm'
22 |
23 | usd()
24 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/ru_RU/currencies/usd.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class usd(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'ru_RU'
9 | self.code = u'USD'
10 | self.fractions = 100
11 | self.cur_singular = u' доллара США'
12 | # default plural form for currency
13 | self.cur_plural = u' долларов США'
14 | self.cur_frc_plural_2to4 = u' доллара США'
15 | self.frc_singular = u' цент'
16 | # default plural form for fractions
17 | self.frc_plural = u' центов'
18 | self.frc_plural_2to4 = u' цента'
19 | # grammatical genders: f - feminine, m - masculine, n -neuter
20 | self.cur_gram_gender = 'm'
21 | self.frc_gram_gender = 'm'
22 |
23 | usd()
24 |
--------------------------------------------------------------------------------
/report_aeroo/data/report_aeroo_data.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | ODF Text Document (.odt)
7 | oo-odt
8 | oo-odt
9 |
10 |
11 |
12 | ODF Spreadsheet (.ods)
13 | oo-ods
14 | oo-ods
15 |
16 |
17 |
18 | Generic
19 | genshi-raw
20 | genshi-raw
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lv_LV/currencies/ltl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class ltl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'lv_LV'
9 | self.code = u'LTL'
10 | self.fractions = 100
11 | self.cur_singular = u' lits'
12 | # default plural form for currency
13 | self.cur_plural = u' litu'
14 | # betwean 1 and 10 yields different plural form, if defined
15 | self.cur_plural_2to10 = u' liti'
16 | self.frc_singular = u' cents'
17 | # default plural form for fractions
18 | self.frc_plural = u' centu'
19 | # betwean 1 and 10 yields different plural form, if defined
20 | self.frc_plural_2to10 = u' centi'
21 | # grammatical genders: f - feminine, m - masculine, n -neuter
22 | self.cur_gram_gender = 'm'
23 | self.frc_gram_gender = 'm'
24 |
25 | ltl()
26 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lt_LT/currencies/eur.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class eur(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'lt_LT'
9 | self.code = u'EUR'
10 | self.fractions = 100
11 | self.cur_singular = u' euras'
12 | # default plural form for currency
13 | self.cur_plural = u' eurų'
14 | # betwean 1 and 10 yields different plural form, if defined
15 | self.cur_plural_2to10 = u' eurai'
16 | self.frc_singular = u' centas'
17 | # default plural form for fractions
18 | self.frc_plural = u' centų'
19 | # betwean 1 and 10 yields different plural form, if defined
20 | self.frc_plural_2to10 = u' centai'
21 | # grammatical genders: f - feminine, m - masculine, n -neuter
22 | self.cur_gram_gender = 'm'
23 | self.frc_gram_gender = 'm'
24 |
25 | eur()
26 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lt_LT/currencies/ltl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class ltl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'lt_LT'
9 | self.code = u'LTL'
10 | self.fractions = 100
11 | self.cur_singular = u' litas'
12 | # default plural form for currency
13 | self.cur_plural = u' litų'
14 | # betwean 1 and 10 yields different plural form, if defined
15 | self.cur_plural_2to10 = u' litai'
16 | self.frc_singular = u' centas'
17 | # default plural form for fractions
18 | self.frc_plural = u' centų'
19 | # betwean 1 and 10 yields different plural form, if defined
20 | self.frc_plural_2to10 = u' centai'
21 | # grammatical genders: f - feminine, m - masculine, n -neuter
22 | self.cur_gram_gender = 'm'
23 | self.frc_gram_gender = 'm'
24 |
25 | ltl()
26 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lv_LV/currencies/lvl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class lvl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'lv_LV'
9 | self.code = u'LVL'
10 | self.fractions = 100
11 | self.cur_singular = u' lats'
12 | # default plural form for currency
13 | self.cur_plural = u' latu'
14 | # betwean 1 and 10 yields different plural form, if defined
15 | self.cur_plural_2to10 = u' lati'
16 | self.frc_singular = u' santīms'
17 | # default plural form for fractions
18 | self.frc_plural = u' santīmi'
19 | # betwean 1 and 10 yields different plural form, if defined
20 | self.frc_plural_2to10 = u' santīmu'
21 | # grammatical genders: f - feminine, m - masculine, n -neuter
22 | self.cur_gram_gender = 'm'
23 | self.frc_gram_gender = 'm'
24 |
25 | lvl()
26 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lv_LV/currencies/uah.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class uah(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'lv_LV'
9 | self.code = u'UAH'
10 | self.fractions = 100
11 | self.cur_singular = u' grivna'
12 | # default plural form for currency
13 | self.cur_plural = u' grivnu'
14 | # betwean 1 and 10 yields different plural form, if defined
15 | self.cur_plural_2to10 = u' grivnas'
16 | self.frc_singular = u' kapeika'
17 | # default plural form for fractions
18 | self.frc_plural = u' kapeiku'
19 | # betwean 1 and 10 yields different plural form, if defined
20 | self.frc_plural_2to10 = u' kapeikas'
21 | # grammatical genders: f - feminine, m - masculine, n -neuter
22 | self.cur_gram_gender = 'f'
23 | self.frc_gram_gender = 'f'
24 | uah()
25 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lt_LT/currencies/lvl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class lvl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'lt_LT'
9 | self.code = u'LVL'
10 | self.fractions = 100
11 | self.cur_singular = u' latas'
12 | # default plural form for currency
13 | self.cur_plural = u' latų'
14 | # betwean 1 and 10 yields different plural form, if defined
15 | self.cur_plural_2to10 = u' latai'
16 | self.frc_singular = u' santimas'
17 | # default plural form for fractions
18 | self.frc_plural = u' santimų'
19 | # betwean 1 and 10 yields different plural form, if defined
20 | self.frc_plural_2to10 = u' santimai'
21 | # grammatical genders: f - feminine, m - masculine, n -neuter
22 | self.cur_gram_gender = 'm'
23 | self.frc_gram_gender = 'm'
24 |
25 | lvl()
26 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lt_LT/currencies/usd.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class usd(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'lt_LT'
9 | self.code = u'USD'
10 | self.fractions = 100
11 | self.cur_singular = u' doleris'
12 | # default plural form for currency
13 | self.cur_plural = u' dolerių'
14 | # betwean 1 and 10 yields different plural form, if defined
15 | self.cur_plural_2to10 = u' doleriai'
16 | self.frc_singular = u' centas'
17 | # default plural form for fractions
18 | self.frc_plural = u' centų'
19 | # betwean 1 and 10 yields different plural form, if defined
20 | self.frc_plural_2to10 = u' centai'
21 | # grammatical genders: f - feminine, m - masculine, n -neuter
22 | self.cur_gram_gender = 'm'
23 | self.frc_gram_gender = 'm'
24 |
25 | usd()
26 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lv_LV/currencies/rub.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class rub(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'lv_LV'
9 | self.code = u'RUB'
10 | self.fractions = 100
11 | self.cur_singular = u' rublis'
12 | # default plural form for currency
13 | self.cur_plural = u' rubļu'
14 | # betwean 1 and 10 yields different plural form, if defined
15 | self.cur_plural_2to10 = u' rubļi'
16 | self.frc_singular = u' kapeika'
17 | # default plural form for fractions
18 | self.frc_plural = u' kapeiku'
19 | # betwean 1 and 10 yields different plural form, if defined
20 | self.frc_plural_2to10 = u' kapeikas'
21 | # grammatical genders: f - feminine, m - masculine, n -neuter
22 | self.cur_gram_gender = 'm'
23 | self.frc_gram_gender = 'f'
24 |
25 | rub()
26 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lt_LT/currencies/uah.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class uah(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'lt_LT'
9 | self.code = u'UAH'
10 | self.fractions = 100
11 | self.cur_singular = u' grivna'
12 | # default plural form for currency
13 | self.cur_plural = u' grivnų'
14 | # betwean 1 and 10 yields different plural form, if defined
15 | self.cur_plural_2to10 = u' grivnai'
16 | self.frc_singular = u' kapeika'
17 | # default plural form for fractions
18 | self.frc_plural = u' kapeikų'
19 | # betwean 1 and 10 yields different plural form, if defined
20 | self.frc_plural_2to10 = u' kapeikos'
21 | # grammatical genders: f - feminine, m - masculine, n -neuter
22 | self.cur_gram_gender = 'm'
23 | self.frc_gram_gender = 'm'
24 |
25 | uah()
26 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lv_LV/currencies/trl.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class trl(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'lv_LV'
9 | self.code = u'TRL'
10 | self.fractions = 100
11 | self.cur_singular = u' Turku lira'
12 | # default plural form for currency
13 | self.cur_plural = u' Turku liru'
14 | # betwean 1 and 10 yields different plural form, if defined
15 | self.cur_plural_2to10 = u' Turku liras'
16 | self.frc_singular = u' kurušs'
17 | # default plural form for fractions
18 | self.frc_plural = u' kurušu'
19 | # betwean 1 and 10 yields different plural form, if defined
20 | self.frc_plural_2to10 = u' kuruši'
21 | # grammatical genders: f - feminine, m - masculine, n -neuter
22 | self.cur_gram_gender = 'f'
23 | self.frc_gram_gender = 'm'
24 |
25 | trl()
26 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lv_LV/currencies/usd.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 |
4 | from openerp.addons.report_aeroo.ctt_objects import ctt_currency
5 |
6 | class usd(ctt_currency):
7 | def _init_currency(self):
8 | self.language = u'lv_LV'
9 | self.code = u'USD'
10 | self.fractions = 100
11 | self.cur_singular = u' ASV dolārs'
12 | # default plural form for currency
13 | self.cur_plural = u' ASV dolāru'
14 | # betwean 1 and 10 yields different plural form, if defined
15 | self.cur_plural_2to10 = u' ASV dolāri'
16 | self.frc_singular = u' cents'
17 | # default plural form for fractions
18 | self.frc_plural = u' centu'
19 | # betwean 1 and 10 yields different plural form, if defined
20 | self.frc_plural_2to10 = u' centi'
21 | # grammatical genders: f - feminine, m - masculine, n -neuter
22 | self.cur_gram_gender = 'm'
23 | self.frc_gram_gender = 'm'
24 |
25 | usd()
26 |
--------------------------------------------------------------------------------
/report_aeroo_sample/wizard/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # OpenERP, Open Source Management Solution
5 | # Copyright (C) 2004-2010 Tiny SPRL ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 | import sample_report
--------------------------------------------------------------------------------
/report_aeroo_sample/report/report_sample.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Sample Report
7 | ir.actions.report.xml
8 | res.partner
9 | sample_report
10 | aeroo
11 | oo-odt
12 | report_aeroo_sample/report/parser.py
13 | report_aeroo_sample/report/template.odt
14 | loc
15 | file
16 |
17 |
18 |
19 |
20 |
21 |
22 | Sample Report
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/report_aeroo_ooo/report_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | ir.actions.report.xml.aeroo.form1
7 | ir.actions.report.xml
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | 8
16 |
17 |
18 |
19 |
20 |
21 |
22 | Configure OpenOffice.org connection
23 | ir.actions.act_window
24 | aeroo_config.installer
25 |
26 | form
27 | form
28 | new
29 | {'menu':True}
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/report_aeroo/barcode/__init__.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2011 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | import barcode
33 |
34 |
--------------------------------------------------------------------------------
/report_aeroo_sample/report/__init__.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2011 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | import parser
33 |
34 |
--------------------------------------------------------------------------------
/report_aeroo_sample/__init__.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2011 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | from report import parser
33 | import wizard
--------------------------------------------------------------------------------
/report_aeroo_sample/wizard/sample_report_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Sample Report
7 | sample.report
8 |
9 |
21 |
22 |
23 |
24 |
25 | Sample Report
26 | sample.report
27 | ir.actions.act_window
28 | form
29 | form
30 |
31 | new
32 |
33 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/report_aeroo/wizard/__init__.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2012 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | import add_print_button
33 | import remove_print_button
34 | import report_print_actions
35 | import report_print_by_action
36 | import report_import_wizard
37 |
--------------------------------------------------------------------------------
/report_aeroo_sample/wizard/sample_report.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # OpenERP, Open Source Management Solution
5 | # Copyright (C) 2004-2010 Tiny SPRL ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 |
22 | from openerp.osv import fields, osv
23 |
24 | class sample_report(osv.osv_memory):
25 | _name = "sample.report"
26 | _description = "Sample Report"
27 |
28 | _columns = {
29 | 'partner_id' : fields.many2one('res.partner', 'Partner'),
30 | 'title': fields.char('Report Title'),
31 | }
32 |
33 | _defaults = {
34 | 'title': 'Test Titel',
35 | }
36 |
37 | def print_report(self, cr, uid, ids, context=None):
38 | if context is None:
39 | context = {}
40 | data = {}
41 | data['form'] = self.read(cr, uid, ids, ['title', 'partner_id'])[0]
42 | return self.pool['report'].get_action(cr, uid, [], 'sample_report', data=data, context=context)
43 |
44 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
--------------------------------------------------------------------------------
/report_aeroo/wizard/remove_print_button_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Remove Print Button
6 | aeroo.remove_print_button
7 | form
8 |
9 |
26 |
27 |
28 |
29 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/report_aeroo_ooo/data/report_aeroo_data.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | localhost
7 | 8100
8 |
9 |
10 |
11 | PDF - Portable Document Format (.pdf)
12 | oo-pdf
13 | oo-odt
14 | writer_pdf_Export
15 |
16 |
17 |
18 | PDF - Portable Document Format (.pdf)
19 | oo-pdf
20 | oo-ods
21 | calc_pdf_Export
22 |
23 |
24 |
25 | Microsoft Word 97/2000/XP (.doc)
26 | oo-doc
27 | oo-odt
28 | MS Word 97
29 |
30 |
31 |
32 | Microsoft Excel 97/2000/XP (.xls)
33 | oo-xls
34 | oo-ods
35 | MS Excel 97
36 |
37 |
38 |
39 | Text CSV (.csv)
40 | oo-csv
41 | oo-ods
42 | Text - txt - csv (StarCalc)
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/report_aeroo/report_controller.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # OpenERP, Open Source Management Solution
5 | # This module copyright (C) 2014 Therp BV ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 | from openerp.addons.report.controllers.main import ReportController
22 | from openerp.addons.web.http import route
23 | import simplejson
24 |
25 | class ReportController(ReportController):
26 |
27 | @route([
28 | '/report//',
29 | '/report///',
30 | ], type='http', auth='user', website=True, multilang=True)
31 | def report_routes(self, reportname, docids=None, converter=None, **data):
32 | context = data.get('context')
33 | if context and not docids:
34 | data_context = simplejson.loads(context)
35 | docids_list = data_context.get('active_ids')
36 | docids = ",".join(str(x) for x in docids_list)
37 |
38 | return super(ReportController, self).report_routes(
39 | reportname, docids=docids, converter=converter, **data)
40 |
41 |
--------------------------------------------------------------------------------
/report_aeroo/wizard/add_print_button_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Add Print Button
6 | aeroo.add_print_button
7 | form
8 |
9 |
28 |
29 |
30 |
31 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/report_aeroo_sample/report/parser.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2011 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | from openerp.report import report_sxw
33 |
34 | class Parser(report_sxw.rml_parse):
35 | def __init__(self, cr, uid, name, context):
36 | super(Parser, self).__init__(cr, uid, name, context)
37 | self.localcontext.update({
38 | 'hello_world': self._hello_world,
39 | })
40 |
41 | def _hello_world(self, name):
42 | return "Hello guy, %s!" % self.datas['form']['partner_id']
43 |
44 |
45 |
--------------------------------------------------------------------------------
/report_aeroo/__init__.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2009-2012 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | import aeroolib
33 | from genshi.template import NewTextTemplate
34 |
35 | check_list = [
36 | 'import aeroolib',
37 | 'import genshi',
38 | 'from genshi.template import NewTextTemplate',
39 | 'from xml.dom import minidom',
40 | ]
41 |
42 | from check_deps import check_deps
43 | check_deps(check_list)
44 |
45 | import installer
46 | import translate
47 | import report_xml
48 | import report_aeroo
49 | import wizard
50 | from . import report_controller
51 | from . import report
52 |
--------------------------------------------------------------------------------
/report_aeroo_sample/__openerp__.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2011 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | {
33 | "name" : "Aeroo Reports - Sample",
34 | "version" : "1.2",
35 | "description" : "Report sample for report_aeroo module",
36 | "author" : "Alistek Ltd",
37 | 'website': 'http://www.alistek.com',
38 | "depends" : ["base", "report_aeroo"],
39 | "category" : "Generic Modules/Aeroo Reporting",
40 | "init_xml" : [],
41 | "demo_xml" : [],
42 | "data" : ["report/report_sample.xml", "wizard/sample_report_view.xml"],
43 | "installable": True,
44 | "license" : "GPL-3 or any later version",
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/report_aeroo/check_deps.py:
--------------------------------------------------------------------------------
1 | # -*- encoding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Copyright (c) 2009-2011 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
5 | # General contacts
6 | #
7 | # WARNING: This program as such is intended to be used by professional
8 | # programmers who take the whole responsability of assessing all potential
9 | # consequences resulting from its eventual inadequacies and bugs
10 | # End users who are looking for a ready-to-use solution with commercial
11 | # garantees and support are strongly adviced to contract a Free Software
12 | # Service Company
13 | #
14 | # This program is Free Software; you can redistribute it and/or
15 | # modify it under the terms of the GNU General Public License
16 | # as published by the Free Software Foundation; either version 3
17 | # of the License, or (at your option) any later version.
18 | #
19 | # This module is GPLv3 or newer and incompatible
20 | # with OpenERP SA "AGPL + Private Use License"!
21 | #
22 | # This program is distributed in the hope that it will be useful,
23 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | # GNU General Public License for more details.
26 | #
27 | # You should have received a copy of the GNU General Public License
28 | # along with this program; if not, write to the Free Software
29 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 | #
31 | ##############################################################################
32 |
33 | from openerp.osv import osv
34 | from openerp.tools.translate import _
35 |
36 | __all__ = [
37 | 'check_deps',
38 | ]
39 |
40 | def check_deps(check_list):
41 | error = False
42 | import_errors = []
43 | for imp in check_list:
44 | try:
45 | exec imp in {}
46 | except ImportError,e:
47 | error = True
48 | import_errors.append(str(e))
49 | if error:
50 | raise osv.except_osv(_('Warning!')+' '+_('Unmet python dependencies!'), '\n'.join(import_errors))
51 |
52 |
--------------------------------------------------------------------------------
/report_aeroo_ooo/check_deps.py:
--------------------------------------------------------------------------------
1 | # -*- encoding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Copyright (c) 2008-2012 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
5 | # General contacts
6 | #
7 | # WARNING: This program as such is intended to be used by professional
8 | # programmers who take the whole responsability of assessing all potential
9 | # consequences resulting from its eventual inadequacies and bugs
10 | # End users who are looking for a ready-to-use solution with commercial
11 | # garantees and support are strongly adviced to contract a Free Software
12 | # Service Company
13 | #
14 | # This program is Free Software; you can redistribute it and/or
15 | # modify it under the terms of the GNU General Public License
16 | # as published by the Free Software Foundation; either version 3
17 | # of the License, or (at your option) any later version.
18 | #
19 | # This module is GPLv3 or newer and incompatible
20 | # with OpenERP SA "AGPL + Private Use License"!
21 | #
22 | # This program is distributed in the hope that it will be useful,
23 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | # GNU General Public License for more details.
26 | #
27 | # You should have received a copy of the GNU General Public License
28 | # along with this program; if not, write to the Free Software
29 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 | #
31 | ##############################################################################
32 |
33 | from openerp.osv import osv
34 | from openerp.tools.translate import _
35 |
36 | __all__ = [
37 | 'check_deps',
38 | ]
39 |
40 | def check_deps(check_list):
41 | error = False
42 | import_errors = []
43 | for imp in check_list:
44 | try:
45 | exec imp in {}
46 | except ImportError,e:
47 | error = True
48 | import_errors.append(str(e))
49 | if error:
50 | raise osv.except_osv(_('Warning!')+' '+_('Unmet python dependencies!'), '\n'.join(import_errors))
51 |
52 |
--------------------------------------------------------------------------------
/report_aeroo/report.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # OpenERP, Open Source Management Solution
5 | # This module copyright (C) 2014 Therp BV ().
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 | #
20 | ##############################################################################
21 | from openerp.osv.orm import Model
22 | from openerp.osv import fields
23 | from openerp import api
24 |
25 | class Report(Model):
26 | _inherit = 'report'
27 |
28 | def _get_replacing_report(self, cr, report_name):
29 | cr.execute('''
30 | select report_replace.report_name
31 | from ir_act_report_xml report_org
32 | join ir_act_report_xml report_replace
33 | on report_org.id = report_replace.replace_report_id
34 | where report_org.report_name=%s''', (report_name,))
35 | new_report_name = report_name
36 | for name, in cr.fetchall():
37 | new_report_name = name
38 | return new_report_name
39 |
40 | @api.v7
41 | def get_action(self, cr, uid, ids, report_name, data=None, context=None):
42 | if data is None:
43 | data = {}
44 | replacing_report = self._get_replacing_report(cr, report_name)
45 | action = super(Report, self).get_action(cr, uid, ids, replacing_report, data=data, context=context)
46 | action['datas'] = action['data']
47 | return action
48 |
49 | @api.v8
50 | def get_action(self, records, report_name, data=None):
51 | return self._model.get_action(
52 | self._cr, self._uid, records.ids, report_name,
53 | data=data, context=self._context)
54 |
--------------------------------------------------------------------------------
/report_aeroo/installer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | report.aeroo.installer.view
6 | report.aeroo.installer
7 | form
8 |
9 |
10 |
11 |
14 |
21 |
22 |
23 | Aeroo Reports for OpenERP is a comprehensive reporting engine based on Aeroo Library.
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | Aeroo Reports Installation
40 | ir.actions.act_window
41 | report.aeroo.installer
42 |
43 | form
44 | form
45 | new
46 |
47 |
48 |
49 |
50 | always
51 | 3
52 | automatic
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/report_aeroo/barcode/barcode.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2011 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | from code128 import get_code
33 | from code39 import create_c39
34 | from EANBarCode import EanBarCode
35 | try:
36 | from cStringIO import StringIO
37 | except ImportError:
38 | from StringIO import StringIO
39 |
40 | def make_barcode(code, code_type='ean13', rotate=None, height=50, xw=1):
41 | if code:
42 | if code_type.lower()=='ean13':
43 | bar=EanBarCode()
44 | im = bar.getImage(code,height)
45 | elif code_type.lower()=='code128':
46 | im = get_code(code, xw, height)
47 | elif code_type.lower()=='code39':
48 | im = create_c39(height, xw, code)
49 | else:
50 | return StringIO(), 'image/png'
51 |
52 | tf = StringIO()
53 | try:
54 | if rotate!=None:
55 | im=im.rotate(int(rotate))
56 | except Exception, e:
57 | pass
58 | im.save(tf, 'png')
59 | size_x = str(im.size[0]/96.0)+'in'
60 | size_y = str(im.size[1]/96.0)+'in'
61 | return tf, 'image/png', size_x, size_y
62 |
63 |
--------------------------------------------------------------------------------
/report_aeroo_ooo/__init__.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2013 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | DEFAULT_OPENOFFICE_PATH = [
33 | "C:\Program Files\OpenOffice.org 3\Basis\program",
34 | "C:\Program Files\OpenOffice.org 3\program",
35 | "C:\Program Files\OpenOffice.org 3\URE\bin"]
36 |
37 | DEFAULT_OPENOFFICE_PATH_AMD64 = [
38 | "C:\Program Files (x86)\OpenOffice.org 3\Basis\program",
39 | "C:\Program Files (x86)\OpenOffice.org 3\program",
40 | "C:\Program Files (x86)\OpenOffice.org 3\URE\bin"]
41 |
42 | import sys
43 |
44 | if sys.platform=='win32':
45 | import _winreg
46 | import platform
47 | try:
48 | key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment')
49 | python_path = _winreg.QueryValueEx(key, "PYTHONPATH")[0].split(';')
50 | if python_path:
51 | sys.path.extend(python_path)
52 | else:
53 | sys.path.extend(platform.machine()=='x86' and DEFAULT_OPENOFFICE_PATH or DEFAULT_OPENOFFICE_PATH_AMD64)
54 | except WindowsError, e:
55 | sys.path.extend(platform.machine()=='x86' and DEFAULT_OPENOFFICE_PATH or DEFAULT_OPENOFFICE_PATH_AMD64)
56 |
57 | import installer
58 | import report
59 |
--------------------------------------------------------------------------------
/report_aeroo_ooo/__openerp__.py:
--------------------------------------------------------------------------------
1 | # -*- encoding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Copyright (c) 2008-2013 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
5 | # General contacts
6 | #
7 | # WARNING: This program as such is intended to be used by professional
8 | # programmers who take the whole responsability of assessing all potential
9 | # consequences resulting from its eventual inadequacies and bugs
10 | # End users who are looking for a ready-to-use solution with commercial
11 | # garantees and support are strongly adviced to contract a Free Software
12 | # Service Company
13 | #
14 | # This program is Free Software; you can redistribute it and/or
15 | # modify it under the terms of the GNU General Public License
16 | # as published by the Free Software Foundation; either version 3
17 | # of the License, or (at your option) any later version.
18 | #
19 | # This module is GPLv3 or newer and incompatible
20 | # with OpenERP SA "AGPL + Private Use License"!
21 | #
22 | # This program is distributed in the hope that it will be useful,
23 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | # GNU General Public License for more details.
26 | #
27 | # You should have received a copy of the GNU General Public License
28 | # along with this program; if not, write to the Free Software
29 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 | #
31 | ##############################################################################
32 |
33 | {
34 | 'name': 'Aeroo Reports - OpenOffice Helper Addon',
35 | 'version': '1.2',
36 | 'category': 'Generic Modules/Aeroo Reporting',
37 | 'description': """
38 | Aeroo Reports OpenOffice.org helper adds following features:
39 |
40 | * Additional output formats for ODF reports;
41 | * ODF subreport feature;
42 | * Include external ODF documents feature;
43 | * Process each object separately or in group;
44 |
45 | Supported output format combinations (Template -> Output):
46 | =================================================================
47 | odt -> pdf
48 | odt -> doc
49 | ods -> pdf
50 | ods -> xls
51 | ods -> csv
52 | """,
53 | 'author': 'Alistek Ltd',
54 | 'website': 'http://www.alistek.com',
55 | 'complexity': "easy",
56 | 'depends': ['base','report_aeroo'],
57 | "init_xml" : [],
58 | 'update_xml': ["installer.xml", "report_view.xml", "data/report_aeroo_data.xml"],
59 | "license" : "GPL-3 or any later version",
60 | 'installable': True,
61 | 'active': False,
62 | "external_dependencies": {
63 | 'python': ['uno', 'unohelper'],
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/report_aeroo/wizard/report_print_by_action.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2012 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 |
33 | from openerp.osv import osv
34 | from openerp.osv import fields
35 |
36 | class report_print_by_action(osv.osv_memory):
37 | _name = 'aeroo.print_by_action'
38 |
39 | def to_print(self, cr, uid, ids, context=None):
40 | this = self.browse(cr, uid, ids[0], context=context)
41 | report_xml = self.pool.get(context['active_model']).browse(cr, uid, context['active_id'], context=context)
42 | print_ids = eval("[%s]" % this.object_ids, {})
43 | data = {'model':report_xml.model, 'ids':print_ids, 'id':print_ids[0], 'report_type': 'aeroo'}
44 | return {
45 | 'type': 'ir.actions.report.xml',
46 | 'report_name': report_xml.report_name,
47 | 'datas': data,
48 | 'context':context
49 | }
50 |
51 | _columns = {
52 | 'name':fields.text('Object Model', readonly=True),
53 | 'object_ids':fields.char('Object IDs', size=250, required=True, help="Comma separated records ID"),
54 |
55 | }
56 |
57 | def _get_model(self, cr, uid, context):
58 | return self.pool.get(context['active_model']).read(cr, uid, context['active_id'], ['model'], context=context)['model']
59 |
60 | _defaults = {
61 | 'name': _get_model,
62 | }
63 |
64 |
--------------------------------------------------------------------------------
/report_aeroo_ooo/report.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2012 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | from openerp.osv import osv,fields
33 | from openerp import netsvc
34 | try:
35 | from DocumentConverter import DocumentConverter
36 | except NameError:
37 | class DocumentConverter:
38 | pass
39 |
40 | class OpenOffice_service (DocumentConverter):
41 |
42 | def __init__(self, cr, host, port):
43 | cr.execute("SELECT host, port, ooo_restart_cmd FROM oo_config")
44 | host, port, ooo_restart_cmd = cr.fetchone()
45 | DocumentConverter.__init__(self, host, port, ooo_restart_cmd)
46 |
47 | class oo_config(osv.osv):
48 | '''
49 | OpenOffice connection
50 | '''
51 | _name = 'oo.config'
52 | _description = 'OpenOffice connection'
53 |
54 | _columns = {
55 | 'host':fields.char('Host', size=128, required=True),
56 | 'port': fields.integer('Port', required=True),
57 | 'ooo_restart_cmd': fields.char('OOO restart command', size=256, \
58 | help='Enter the shell command that will be executed to restart the LibreOffice/OpenOffice background process. '+ \
59 | 'The command will be executed as the user of the OpenERP server process,'+ \
60 | 'so you may need to prefix it with sudo and configure your sudoers file to have this command executed without password.'),
61 |
62 | }
63 |
64 |
65 | class report_xml(osv.osv):
66 | _name = 'ir.actions.report.xml'
67 | _inherit = 'ir.actions.report.xml'
68 |
69 | _columns = {
70 | 'process_sep':fields.boolean('Process Separately'),
71 |
72 | }
73 |
74 |
--------------------------------------------------------------------------------
/report_aeroo_ooo/installer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | aeroo_config.installer.view
6 | aeroo_config.installer
7 |
8 |
9 |
10 |
13 |
21 |
22 |
23 | Here you can configure Aeroo connection to OpenOffice.org and test now document conversion.
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | OpenOffice.org connection Configuration
57 | ir.actions.act_window
58 | aeroo_config.installer
59 |
60 | form
61 | form
62 | new
63 |
64 |
65 |
66 |
67 | automatic
68 | 3
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/report_aeroo/installer.py:
--------------------------------------------------------------------------------
1 | # -*- encoding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Copyright (c) 2008-2013 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
5 | # General contacts
6 | #
7 | # WARNING: This program as such is intended to be used by professional
8 | # programmers who take the whole responsability of assessing all potential
9 | # consequences resulting from its eventual inadequacies and bugs
10 | # End users who are looking for a ready-to-use solution with commercial
11 | # garantees and support are strongly adviced to contract a Free Software
12 | # Service Company
13 | #
14 | # This program is Free Software; you can redistribute it and/or
15 | # modify it under the terms of the GNU General Public License
16 | # as published by the Free Software Foundation; either version 3
17 | # of the License, or (at your option) any later version.
18 | #
19 | # This module is GPLv3 or newer and incompatible
20 | # with OpenERP SA "AGPL + Private Use License"!
21 | #
22 | # This program is distributed in the hope that it will be useful,
23 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | # GNU General Public License for more details.
26 | #
27 | # You should have received a copy of the GNU General Public License
28 | # along with this program; if not, write to the Free Software
29 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 | #
31 | ##############################################################################
32 |
33 | from openerp.osv import fields
34 | from openerp.osv import osv
35 | from openerp import netsvc
36 | from openerp import tools
37 | import os, base64
38 | import urllib2
39 |
40 | _url = 'http://www.alistek.com/aeroo_banner/v7_0_report_aeroo.png'
41 |
42 | class report_aeroo_installer(osv.osv_memory):
43 | _name = 'report.aeroo.installer'
44 | _inherit = 'res.config.installer'
45 | _logo_image = None
46 |
47 | def _get_image(self, cr, uid, context=None):
48 | if self._logo_image:
49 | return self._logo_image
50 | try:
51 | im = urllib2.urlopen(_url.encode("UTF-8"))
52 | if im.headers.maintype!='image':
53 | raise TypeError(im.headers.maintype)
54 | except Exception, e:
55 | path = os.path.join('report_aeroo','config_pixmaps','module_banner.png')
56 | image_file = file_data = tools.file_open(path,'rb')
57 | try:
58 | file_data = image_file.read()
59 | self._logo_image = base64.encodestring(file_data)
60 | return self._logo_image
61 | finally:
62 | image_file.close()
63 | else:
64 | self._logo_image = base64.encodestring(im.read())
65 | return self._logo_image
66 |
67 | def _get_image_fn(self, cr, uid, ids, name, args, context=None):
68 | image = self._get_image(cr, uid, context)
69 | return dict.fromkeys(ids, image) # ok to use .fromkeys() as the image is same for all
70 |
71 | _columns = {
72 | 'link':fields.char('Original developer', size=128, readonly=True),
73 | 'config_logo': fields.function(_get_image_fn, string='Image', type='binary', method=True),
74 |
75 | }
76 |
77 | _defaults = {
78 | 'config_logo': _get_image,
79 | 'link':'http://www.alistek.com',
80 | }
81 |
82 | report_aeroo_installer()
83 |
84 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/en_US/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # en_US
4 |
5 | from openerp.addons.report_aeroo.ctt_objects import ctt_language
6 |
7 | class en_US(ctt_language):
8 | def _init_lang(self):
9 | # language name
10 | self.name = 'en_US'
11 | # digits - masculine, singular
12 | self.digits_sng_msc = [u'zero', u'one', u'two', u'three', u'four',
13 | u'five', u'six', u'seven', u'eight', u'nine']
14 | # tens - masculine, singular
15 | self.tens_sng_msc = [u'', u'one', u'twen', u'thir', u'four', u'fif',
16 | u'six', u'seven', u'eigh', u'nine']
17 | # teens - masculine
18 | self.teens = [u'ten', u'eleven', u'twelve', u'thirteen', u'fourteen',
19 | u'fifteen', u'sixteen', u'seventeen', u'eighteen',
20 | u'nineteen']
21 | # multiplier - masculine, singular
22 | self.multi_sng_msc = [u' hundred', u' thousand', u' million',
23 | u' billion']
24 | # multiplier - masculine, plural
25 | self.multi_plr_msc = [u' hundreds', u' thousands', u' millions',
26 | u' billions']
27 |
28 | # next line is needed for correct loading of currencies
29 | import currencies
30 | return currencies
31 |
32 |
33 | def wordify(self, chunk, chunknr, gender):
34 | if gender == 'm':
35 | number = self.digits_sng_msc
36 | elif gender == 'f':
37 | number = self.digits_sng_fem
38 | elif gender == 'n':
39 | number = self.digits_sng_neu
40 | words = u''
41 | digit1 = u''
42 | digit2 = u''
43 | digit3 = u''
44 | chunklength = len(chunk)
45 | # placing digits in right places
46 | if chunklength == 1:
47 | digit3 = chunk[0 : 1]
48 | if chunklength == 2:
49 | digit2 = chunk[0 : 1]
50 | digit3 = chunk[1 : 2]
51 | if chunklength == 3:
52 | digit1 = chunk[0 : 1]
53 | digit2 = chunk[1 : 2]
54 | digit3 = chunk[-1]
55 | # processing zero
56 | if chunklength == 1 and digit3 == '0' :
57 | return number[0]
58 | # processing hundreds
59 | if chunklength == 3 :
60 | if digit1 == '1' :
61 | words += self.digits_sng_msc[int(digit1)] + self.multi_sng_msc[0]
62 | else :
63 | if int(digit1) >= 1 : words += self.digits_sng_msc[int(digit1)] + self.multi_plr_msc[0]
64 | # processing tens
65 | if chunklength > 1:
66 | spacer = ''
67 | if len(words) > 0 : spacer = u' '
68 | if digit2 == '1':
69 | words += spacer + self.teens[int(digit3)]
70 | else:
71 | if int(digit2) > 1 and int(digit2) > 0:
72 | words += spacer + self.tens_sng_msc[int(digit2)] + u'ty'
73 |
74 | # processing ones
75 | if chunklength > 0 and digit2 != '1' :
76 | spacer = ''
77 | if len(words) > 0: spacer = u' '
78 | if int(digit3) > 0:
79 | words += spacer + number[int(digit3)]
80 | # end processing
81 | if len(words) > 0 :
82 | if digit3 == '1' and chunknr > 0:
83 | return words + self.multi_sng_msc[chunknr]
84 | elif digit3 != '1' and chunknr > 0:
85 | return words + self.multi_sng_msc[chunknr]
86 | else:
87 | return words
88 | else:
89 | return ''
90 |
91 | en_US()
92 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/tr_TR/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # tr_TR
4 | ################################################################################
5 | #
6 | # Turkish language support assembled from contributions provided by:
7 | # Ahmet Altınışık
8 | #
9 | ################################################################################
10 | from openerp.addons.report_aeroo.ctt_objects import ctt_language
11 |
12 | class tr_TR(ctt_language):
13 | def _init_lang(self):
14 | self.name = 'tr_TR'
15 | # digits - masculine, singular
16 | self.number_sng_msc = [u'', u'bir', u'iki', u'üç', u'dört', u'beş',
17 | u'alti', u'yedi', u'sekiz', u'dokuz']
18 | # tens - masculine, singular
19 | self.tens_sng_msc = [u'on', u'on bir', u'on iki', u'on üç', u'on dört',
20 | u'on beş', u'on alti', u'on yedi', u'on sekiz',
21 | u'on dokuz']
22 | # teens - masculine
23 | self.teens = [u'on', u'on bir', u'on iki', u'on üç', u'on dört',
24 | u'on beş', u'on alti', u'on yedi', u'on sekiz',
25 | u'on dokuz']
26 | # multiplier - masculine, singular
27 | self.multi_sng_msc = [u'yüz', u' bin', u' milyon', u' milyar']
28 |
29 | # next line is needed for correct loading of currencies
30 | import currencies
31 | return currencies
32 |
33 |
34 | def wordify(self, chunk, chunknr, gender):
35 | if gender == 'm':
36 | number = self.number_sng_msc
37 | elif gender == 'f':
38 | number = self.number_sng_fem
39 | elif gender == 'n':
40 | number = self.number_sng_neu
41 | words = u''
42 | digit1 = u''
43 | digit2 = u''
44 | digit3 = u''
45 | chunklength = len(chunk)
46 | # placing digits in right places
47 | if chunklength == 1:
48 | digit3 = chunk[0 : 1]
49 | if chunklength == 2:
50 | digit2 = chunk[0 : 1]
51 | digit3 = chunk[1 : 2]
52 | if chunklength == 3:
53 | digit1 = chunk[0 : 1]
54 | digit2 = chunk[1 : 2]
55 | digit3 = chunk[-1]
56 | # processing zero
57 | if chunklength == 1 and digit3 == '0' :
58 | return number[0]
59 | # processing hundreds
60 | if chunklength == 3 :
61 | if digit1 == '1' :
62 | words += self.multi_sng_msc[0]
63 | else :
64 | if int(digit1) > 1 : words += number[int(digit1)] + \
65 | self.multi_plr_msc[0]
66 | # processing tens
67 | if chunklength > 1:
68 | spacer = ''
69 | if len(words) > 0 : spacer = ' '
70 | if digit2 == '1':
71 | words += spacer + self.teens[int(digit3)]
72 | else:
73 | if int(digit2) > 1 and int(digit2) > 0:
74 | words += spacer + self.tens_sng_msc[int(digit2)]
75 |
76 | # processing ones
77 | if chunklength > 0 and digit2 != '1' :
78 | spacer = ''
79 | if len(words) > 0: spacer = u' '
80 | if int(digit3) > 0:
81 | words += spacer + number[int(digit3)]
82 | # end processing
83 | if len(words) > 0 :
84 | if digit3 == '1' and chunknr > 0:
85 | return words + self.multi_sng_msc[chunknr]
86 | elif digit3 != '1' and chunknr > 0:
87 | return words + self.multi_plr_msc[chunknr]
88 | else:
89 | return words
90 | else:
91 | return ''
92 |
93 | tr_TR()
94 |
--------------------------------------------------------------------------------
/report_aeroo/__openerp__.py:
--------------------------------------------------------------------------------
1 | # -*- encoding: utf-8 -*-
2 | ########################################################################
3 | #
4 | # Copyright (C) 2009 Domsense s.r.l.
5 | # @authors: Simone Orsi
6 | # Copyright (C) 2009-2013 Alistek Ltd
7 | #
8 | #This program is free software: you can redistribute it and/or modify
9 | #it under the terms of the GNU General Public License as published by
10 | #the Free Software Foundation, either version 3 of the License, or
11 | #(at your option) any later version.
12 | #
13 | # This module is GPLv3 or newer and incompatible
14 | # with OpenERP SA "AGPL + Private Use License"!
15 | #
16 | #This program is distributed in the hope that it will be useful,
17 | #but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | #GNU General Public License for more details.
20 | #
21 | #You should have received a copy of the GNU General Public License
22 | #along with this program. If not, see .
23 | ########################################################################
24 |
25 | {
26 | 'name': 'Aeroo Reports',
27 | 'version': '1.2',
28 | 'category': 'Generic Modules/Aeroo Reporting',
29 | 'description': """
30 | Aeroo Reports for OpenERP is a comprehensive reporting engine based on Aeroo Library.
31 |
32 | Report templates can be created directly in of following formats:
33 | =================================================================
34 | * Open Document Format (ODF) - .odt, .ods;
35 | * Other ASCII based formats, like HTML, CSV, etc.
36 |
37 | Output formats:
38 | =================================================================
39 | * Open Document Format (ODF) - .odt, .ods;
40 | * Other ASCII based formats, like HTML, CSV, etc.
41 | * with report_aeroo_ooo [1] module - PDF, DOC, XLS, CSV.
42 |
43 | Reporting engine features:
44 | =================================================================
45 | * Add reports from UI "on the fly";
46 | * Install reports from module;
47 | * Dynamic template load/unload;
48 | * Extra Functions - set of functions for rapid template development;
49 | * Use templates stored on filesystem, database or elsewhere;
50 | * Same button - different templates;
51 | * Powerful stylesheet system for ODF templates;
52 | * Global or local stylesheets;
53 | * Template preloading for performance concerns;
54 | * User defined parsers;
55 | * Report deactivation;
56 | * Tunable format fallback;
57 | * Add/Remove print button wizards;
58 | * Test report on particular object ID, directly from Report form;
59 | * Translatable reports;
60 | * Translation export;
61 | * Number of copies;
62 | * Universal Report wizard;
63 | * Override report file extension (for direct printing, etc);
64 | * Separate input/output format selections;
65 |
66 | [1] For more information on available template -> output pairs and other features, see description of report_aeroo_ooo module.
67 | """,
68 | 'author': 'Alistek Ltd, Simone Orsi - Domsense',
69 | 'website': 'http://www.alistek.com',
70 | 'complexity': "easy",
71 | 'depends': ['base', 'report', 'base_field_serialized'],
72 | "init_xml" : [],
73 | 'update_xml': ["installer.xml", "report_view.xml", "data/report_aeroo_data.xml", "wizard/add_print_button_view.xml", "wizard/remove_print_button_view.xml", "security/ir.model.access.csv"],
74 | "license" : "GPL-3 or any later version",
75 | 'installable': True,
76 | 'active': False,
77 | 'application': True,
78 | }
79 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/es_ES/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # es_ES
4 | ################################################################################
5 | # Spanish language support assembled from contributions provided by:
6 | # * mechiscogo
7 | # * Christopher Ormaza - Ecuadorenlinea.net , 2011
8 | ################################################################################
9 |
10 | from openerp.addons.report_aeroo.ctt_objects import ctt_language
11 |
12 | class es_ES(ctt_language):
13 | def _init_lang(self):
14 | # language name
15 | self.name = 'es_ES'
16 | # digits - masculine, singular
17 | self.digits_sng_msc = [u'cero', u'uno', u'dos', u'tres', u'cuatro',
18 | u'cinco', u'seis', u'siete', u'ocho', u'nueve']
19 |
20 | # tens - masculine, singular
21 | self.tens_sng_msc = [u'', u'', u'veint', u'treinta', u'cuarenta',
22 | u'cincuenta', u'sesenta', u'setenta', u'ochenta',
23 | u'noventa ']
24 |
25 | # teens - masculine
26 | self.teens = [u'diez', u'once', u'doce', u'trece', u'catorce',
27 | u'quince', u'dieciséis', u'diecisiete', u'dieciocho',
28 | u'diecinueve']
29 |
30 | # multiplier - masculine, singular
31 | self.multi_sng_msc = [u'cien', u' mil', u' millón', u' billón']
32 |
33 | # multiplier - masculine, plural
34 | self.multi_plr_msc = [u'cientos', u' mil', u' millones', u' billones']
35 |
36 | # next line is needed for correct loading of currencies
37 | import currencies
38 | return currencies
39 |
40 |
41 | def wordify(self, chunk, chunknr, gender):
42 | if gender == 'm':
43 | number = self.digits_sng_msc
44 | elif gender == 'f':
45 | number = self.digits_sng_fem
46 | elif gender == 'n':
47 | number = self.digits_sng_neu
48 | words = u''
49 | digit1 = u''
50 | digit2 = u''
51 | digit3 = u''
52 | chunklength = len(chunk)
53 | # placing digits in right places
54 | if chunklength == 1:
55 | digit3 = chunk[0 : 1]
56 | if chunklength == 2:
57 | digit2 = chunk[0 : 1]
58 | digit3 = chunk[1 : 2]
59 | if chunklength == 3:
60 | digit1 = chunk[0 : 1]
61 | digit2 = chunk[1 : 2]
62 | digit3 = chunk[-1]
63 | # processing zero
64 | if chunklength == 1 and digit3 == '0' :
65 | return number[0]
66 | # processing hundreds
67 | if chunklength == 3 :
68 | if digit1 == '1' :
69 | words += self.multi_sng_msc[0]
70 | else :
71 | if int(digit1) >= 1 : words += self.digits_sng_msc[int(digit1)]\
72 | + self.multi_plr_msc[0]
73 | # processing tens
74 | if chunklength > 1:
75 | spacer = ''
76 | if len(words) > 0 : spacer = u' '
77 | if digit2 == '1':
78 | words += spacer + self.teens[int(digit3)]
79 | else:
80 | if int(digit2) > 1 and int(digit2) > 0:
81 | words += spacer + self.tens_sng_msc[int(digit2)]
82 | if int(digit3) > 0:
83 | words += u' y'
84 |
85 | # processing ones
86 | if chunklength > 0 and digit2 != '1' :
87 | spacer = ''
88 | if len(words) > 0: spacer = u' '
89 | if int(digit3) > 0:
90 | words += spacer + number[int(digit3)]
91 | # end processing
92 | if len(words) > 0 :
93 | if digit3 == '1' and chunknr > 0:
94 | return words + self.multi_sng_msc[chunknr]
95 | elif digit3 != '1' and chunknr > 0:
96 | return words + self.multi_plr_msc[chunknr]
97 | else:
98 | return words
99 | else:
100 | return ''
101 |
102 | es_ES()
103 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lv_LV/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # lv_LV
4 |
5 | from openerp.addons.report_aeroo.ctt_objects import ctt_language
6 |
7 | class lv_LV(ctt_language):
8 | def _init_lang(self):
9 | self.name = 'lv_LV'
10 | # digits - masculine, singular
11 | self.number_sng_msc = [u'nulle', u'viens', u'divi',
12 | u'trīs', u'četri', u'pieci',
13 | u'seši', u'septiņi', u'astoņi',
14 | u'deviņi']
15 | # digits - feminine, singular
16 | self.number_sng_fem = [u'nulle', u'viena', u'divas',
17 | u'trīs', u'četras', u'piecas',
18 | u'sešas', u'septiņas', u'astoņas',
19 | u'deviņas']
20 | # tens - masculine, singular
21 | self.tens_sng_msc = [u'nulle', u'vien', u'div',
22 | u'trīs', u'četr', u'piec',
23 | u'seš', u'septiņ', u'astoņ',
24 | u'deviņ']
25 | # teens - masculine
26 | self.teens = [u'desmit', u'vienpadsmit', u'divpadsmit',
27 | u'trīspadsmit', u'četrpadsmit', u'piecpadsmit',
28 | u'sešpadsmit', u'septiņpadsmit', u'astoņpadsmit',
29 | u'deviņpadsmit']
30 | # multiplier - masculine, singular
31 | self.multi_sng_msc = [u'simts', u' tūkstotis', u' miljons',
32 | u' miljards']
33 | # multiplier - masculine, plural
34 | self.multi_plr_msc = [u' simti', u' tūkstoši', u' miljoni',
35 | u' miljardi']
36 |
37 | # next line is needed for correct loading of currencies
38 | import currencies
39 | return currencies
40 |
41 |
42 | def wordify(self, chunk, chunknr, gender):
43 | if gender == 'm':
44 | number = self.number_sng_msc
45 | elif gender == 'f':
46 | number = self.number_sng_fem
47 | elif gender == 'n':
48 | number = self.number_sng_neu
49 | words = u''
50 | digit1 = u''
51 | digit2 = u''
52 | digit3 = u''
53 | chunklength = len(chunk)
54 | # placing digits in right places
55 | if chunklength == 1:
56 | digit3 = chunk[0 : 1]
57 | if chunklength == 2:
58 | digit2 = chunk[0 : 1]
59 | digit3 = chunk[1 : 2]
60 | if chunklength == 3:
61 | digit1 = chunk[0 : 1]
62 | digit2 = chunk[1 : 2]
63 | digit3 = chunk[-1]
64 | # processing zero
65 | if chunklength == 1 and digit3 == '0' :
66 | return number[0]
67 | # processing hundreds
68 | if chunklength == 3 :
69 | if digit1 == '1' :
70 | words += self.multi_sng_msc[0]
71 | else :
72 | if int(digit1) > 1 : words += number[int(digit1)] + \
73 | self.multi_plr_msc[0]
74 | # processing tens
75 | if chunklength > 1:
76 | spacer = ''
77 | if len(words) > 0 : spacer = ' '
78 | if digit2 == '1':
79 | words += spacer + self.teens[int(digit3)]
80 | else:
81 | if int(digit2) > 1 and int(digit2) > 0:
82 | words += spacer + self.tens_sng_msc[int(digit2)] + u'desmit'
83 |
84 | # processing ones
85 | if chunklength > 0 and digit2 != '1' :
86 | spacer = ''
87 | if len(words) > 0: spacer = u' '
88 | if int(digit3) > 0:
89 | words += spacer + number[int(digit3)]
90 | # end processing
91 | if len(words) > 0 :
92 | if digit3 == '1' and chunknr > 0:
93 | return words + self.multi_sng_msc[chunknr]
94 | elif digit3 != '1' and chunknr > 0:
95 | return words + self.multi_plr_msc[chunknr]
96 | else:
97 | return words
98 | else:
99 | return ''
100 |
101 | lv_LV()
102 |
--------------------------------------------------------------------------------
/report_aeroo/wizard/remove_print_button.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2012 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | from openerp import pooler
33 | from openerp.tools.translate import _
34 | from openerp.osv import osv
35 | from openerp.osv import fields
36 |
37 | def ir_del(cr, uid, id):
38 | obj = pooler.get_pool(cr.dbname).get('ir.values')
39 | return obj.unlink(cr, uid, [id])
40 |
41 | def _reopen(self, res_id, model):
42 | return {'type': 'ir.actions.act_window',
43 | 'view_mode': 'form',
44 | 'view_type': 'form',
45 | 'res_id': res_id,
46 | 'res_model': self._name,
47 | 'target': 'new',
48 | }
49 |
50 | class aeroo_remove_print_button(osv.osv_memory):
51 | '''
52 | Remove Print Button
53 | '''
54 | _name = 'aeroo.remove_print_button'
55 | _description = 'Remove print button'
56 |
57 | def default_get(self, cr, uid, fields_list, context=None):
58 | values = {}
59 |
60 | report = self.pool.get(context['active_model']).browse(cr, uid, context['active_id'], context=context)
61 | if report.report_wizard:
62 | act_win_obj = self.pool.get('ir.actions.act_window')
63 | act_win_ids = act_win_obj.search(cr, uid, [('res_model','=','aeroo.print_actions')], context=context)
64 | for act_win in act_win_obj.browse(cr, uid, act_win_ids, context=context):
65 | act_win_context = eval(act_win.context, {})
66 | if act_win_context.get('report_action_id')==report.id:
67 | values['state'] = 'remove'
68 | break;
69 | else:
70 | values['state'] = 'no_exist'
71 | else:
72 | ids = self.pool.get('ir.values').search(cr, uid, [('value','=',report.type+','+str(report.id))])
73 | if not ids:
74 | values['state'] = 'no_exist'
75 | else:
76 | values['state'] = 'remove'
77 |
78 | return values
79 |
80 | def do_action(self, cr, uid, ids, context):
81 | this = self.browse(cr, uid, ids[0], context=context)
82 | report = self.pool.get(context['active_model']).browse(cr, uid, context['active_id'], context=context)
83 | if report.report_wizard:
84 | report._unset_report_wizard()
85 | event_id = self.pool.get('ir.values').search(cr, uid, [('value','=','ir.actions.report.xml,%d' % context['active_id'])])[0]
86 | res = ir_del(cr, uid, event_id)
87 | this.write({'state':'done'})
88 | return _reopen(self, this.id, this._model)
89 |
90 | _columns = {
91 | 'state':fields.selection([
92 | ('remove','Remove'),
93 | ('no_exist','Not Exist'),
94 | ('done','Done'),
95 |
96 | ],'State', select=True, readonly=True),
97 | }
98 |
99 | aeroo_remove_print_button()
100 |
101 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/lt_LT/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # lt_LT
4 | ################################################################################
5 | #
6 | # Lithuanian language support assembled from contributions provided by:
7 | # Paulius Sladkevičius
8 | #
9 | ################################################################################
10 |
11 | from openerp.addons.report_aeroo.ctt_objects import ctt_language
12 |
13 | class lt_LT(ctt_language):
14 | def _init_lang(self):
15 | self.name = 'lt_LT'
16 | # digits - masculine, singular
17 | self.number_sng_msc = [u'nulis', u'vienas', u'du', u'trys', u'keturi',
18 | u'penkti', u'šeši', u'septyni', u'aštuoni',
19 | u'devyni']
20 | # tens - masculine, singular
21 | self.tens_sng_msc = [u'nulis', u'vienas', u'dvi', u'tris',
22 | u'keturias', u'penkias', u'šešias', u'septynias',
23 | u'aštuonias', u'devynias']
24 | # teens - masculine
25 | self.teens = [u'dešimt', u'vienuolika', u'dvylika', u'trylika',
26 | u'keturiolika', u'penkiolika', u'šešiolika',
27 | u'septyniolika', u'aštuonolika', u'devyniolika']
28 | # multiplier - masculine, singular
29 | self.multi_sng_msc = [u' šimtas', u' tūkstantis', u' milijonas',
30 | u' milijardas']
31 | # multiplier - masculine, plural
32 | self.multi_plr_msc = [u' šimtai', u' tūkstančiai', u' milijonai',
33 | u' milijardai']
34 | # multiplier - masculine, plural (other form)
35 | self.multi_plr_msc_2 = [u' šimtų', u' tūkstančių', u' milijonų',
36 | u' milijardų']
37 |
38 | # next line is needed for correct loading of currencies
39 | import currencies
40 | return currencies
41 |
42 |
43 | def wordify(self, chunk, chunknr, gender):
44 | if gender == 'm':
45 | number = self.number_sng_msc
46 | elif gender == 'f':
47 | number = self.number_sng_fem
48 | elif gender == 'n':
49 | number = self.number_sng_neu
50 | words = u''
51 | digit1 = u''
52 | digit2 = u''
53 | digit3 = u''
54 | chunklength = len(chunk)
55 | # placing digits in right places
56 | if chunklength == 1:
57 | digit3 = chunk[0 : 1]
58 | if chunklength == 2:
59 | digit2 = chunk[0 : 1]
60 | digit3 = chunk[1 : 2]
61 | if chunklength == 3:
62 | digit1 = chunk[0 : 1]
63 | digit2 = chunk[1 : 2]
64 | digit3 = chunk[-1]
65 | # processing zero
66 | if chunklength == 1 and digit3 == '0' :
67 | return number[0]
68 | # processing hundreds
69 | if chunklength == 3 :
70 | if digit1 == '1' :
71 | words += self.multi_sng_msc[0]
72 | else :
73 | if int(digit1) > 1 : words += number[int(digit1)] + \
74 | self.multi_plr_msc[0]
75 | # processing tens
76 | if chunklength > 1:
77 | spacer = ''
78 | if len(words) > 0 : spacer = ' '
79 | if digit2 == '1':
80 | words += spacer + self.number_teens[int(digit3)]
81 | else:
82 | if int(digit2) > 1 and int(digit2) > 0:
83 | words += spacer + self.tens_sng_msc[int(digit2)] + u'dešimt'
84 |
85 | # processing ones
86 | if chunklength > 0 and digit2 != '1' :
87 | spacer = ''
88 | if len(words) > 0: spacer = u' '
89 | if int(digit3) > 0:
90 | words += spacer + number[int(digit3)]
91 | # end processing
92 | if len(words) > 0 :
93 | if digit3 == '1' and chunknr > 0:
94 | return words + self.multi_sng_msc[chunknr]
95 | elif digit3 != '1' and chunknr > 0:
96 | if chunklength >= 2 and ((int(chunk) % 10) == 0 or (digit2 == \
97 | '1' and int(digit3) > 0)):
98 | return words + multi_plr_msc_2[chunknr]
99 | else:
100 | return words + multi_plr_msc[chunknr]
101 |
102 | else:
103 | return words
104 | else:
105 | return ''
106 |
107 | lt_LT()
108 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/ru_RU/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # ru_RU
4 |
5 | from openerp.addons.report_aeroo.ctt_objects import ctt_language
6 |
7 | class ru_RU(ctt_language):
8 | def _init_lang(self):
9 | # language name
10 | self.name = 'ru_RU'
11 | # digits - masculine, singular
12 | self.number_sng_msc = [u'ноль', u'один', u'два', u'три', u'четыре',
13 | u'пять', u'шесть', u'семь', u'восемь', u'девять']
14 | # tens - masculine, singular
15 | self.number_sng_fem = [u'ноль', u'одна', u'две', u'три', u'четыре',
16 | u'пять', u'шесть', u'семь', u'восемь', u'девять']
17 | # tens - masculine, plural
18 | self.number_plr_msc = [u'', u'один', u'двa', u'три', u'четыре', u'пять',
19 | u'шесть', u'семь', u'восемь', u'девять']
20 | # teens - masculine
21 | self.number_teens = [u'десять', u'одиннадцать', u'двенадцать',
22 | u'тринадцать', u'четырнадцать', u'пятнадцать',
23 | u'шестнадцать', u'семнадцать', u'восемнадцать',
24 | u'девятнадцать']
25 | # multiplier - masculine, singular
26 | self.multi_sng_msc = [u'стo', u' тысяча', u' миллион', u' миллиард']
27 | # multiplier - masculine, plural
28 | self.multi_plr_msc = [u'сoт', u' тысяч', u' миллионов', u' миллиардов']
29 |
30 | # next line is needed for correct loading of currencies
31 | import currencies
32 | return currencies
33 |
34 |
35 | def wordify(self, chunk, chunknr, gender):
36 | if gender == 'm':
37 | number = self.number_sng_msc
38 | elif gender == 'f':
39 | number = self.number_sng_fem
40 | elif gender == 'n':
41 | number = self.number_sng_neu
42 | words = u''
43 | digit1 = u''
44 | digit2 = u''
45 | digit3 = u''
46 | chunklength = len(chunk)
47 | # placing digits in right places
48 | if chunklength == 1:
49 | digit3 = chunk[0 : 1]
50 | if chunklength == 2:
51 | digit2 = chunk[0 : 1]
52 | digit3 = chunk[1 : 2]
53 | if chunklength == 3:
54 | digit1 = chunk[0 : 1]
55 | digit2 = chunk[1 : 2]
56 | digit3 = chunk[-1]
57 | # processing zero
58 | if chunklength == 1 and digit3 == '0' :
59 | return number[0]
60 | # processing hundreds
61 | if chunklength == 3 :
62 | if int(digit1) == 1 :
63 | words += self.multi_sng_msc[0]
64 | elif int(digit1) == 2 :
65 | words += u'двести'
66 | elif int(digit1) == 3 :
67 | words += u'триста'
68 | elif int(digit1) == 4 :
69 | words += u'четыреста'
70 | elif int(digit1) >= 5 :
71 | words += self.number_sng_msc[int(digit1)] + self.multi_plr_msc[0]
72 | # processing tens
73 | if chunklength > 1:
74 | spacer = ''
75 | if len(words) > 0 : spacer = ' '
76 | if digit2 == '1':
77 | words += spacer + self.number_teens[int(digit3)]
78 | else:
79 | if int(digit2) > 1 and int(digit2) < 4:
80 | words += spacer + self.number_plr_msc[int(digit2)] + u'дцать'
81 | elif digit2 == '4':
82 | words += spacer + u'сорок'
83 | elif int(digit2) >= 5 and int(digit2) != 9:
84 | words += spacer + self.number_plr_msc[int(digit2)] + u'десят'
85 | elif digit2 == '9':
86 | words += spacer + u'девяносто'
87 |
88 | # processing ones
89 | if chunklength > 0 and digit2 != '1' :
90 | spacer = ''
91 | if len(words) > 0: spacer = u' '
92 | if chunknr == 1:
93 | if int(digit3) == 1 or int(digit3) == 2:
94 | words += spacer + self.number_sng_fem[int(digit3)]
95 | elif int(digit3) >= 3 and int(digit3) != 0:
96 | words += spacer + self.number_sng_msc[int(digit3)]
97 | else:
98 | if int(digit3) > 0: words += spacer + self.number_sng_msc[int(digit3)]
99 | # end processing
100 | if len(words) > 0 :
101 | if digit3 == '1' and chunknr > 0:
102 | return words + self.multi_sng_msc[chunknr]
103 | elif digit3 != '1' and chunknr > 0:
104 | return words + self.multi_plr_msc[chunknr]
105 | else:
106 | return words
107 | else:
108 | return ''
109 |
110 | ru_RU()
111 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_languages/uk_UA/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | # uk_UA
4 |
5 | from openerp.addons.report_aeroo.ctt_objects import ctt_language
6 |
7 | class uk_UA(ctt_language):
8 | def _init_lang(self):
9 | # language name
10 | self.name = 'uk_UA'
11 | # digits - masculine, singular
12 | self.number_sng_msc = [u'ноль', u'один', u'два', u'три', u'чотири',
13 | u'п\'ять', u'шість', u'сім', u'вісім',
14 | u'дев\'ять']
15 | # tens - masculine, singular
16 | self.number_sng_fem = [u'ноль', u'одна', u'дві', u'три', u'чотири',
17 | u'п\'ять', u'шість', u'сім', u'вісім',
18 | u'дев\'ять']
19 | # tens - masculine, plural
20 | self.number_plr_msc = [u'', u'один', u'двa', u'три', u'четыре', u'пять',
21 | u'шесть', u'семь', u'восемь', u'девять']
22 | # teens - masculine
23 | self.number_teens = [u'десять', u'одинадцять', u'дванадцять',
24 | u'тринадцять', u'чотирнадцять', u'п\'ятнадцять',
25 | u'шістнадцять', u'сімнадцять', u'вісімнадцять',
26 | u'дев\'ятнадцять']
27 | # multiplier - masculine, singular
28 | self.multi_sng_msc = [u'стo', u' тисяча', u' мiллiон', u' мiллiард']
29 | # multiplier - masculine, plural
30 | self.multi_plr_msc = [u'сoт', u' тисяч', u' мiллiонiв', u' мiллiардов']
31 |
32 | # next line is needed for correct loading of currencies
33 | import currencies
34 | return currencies
35 |
36 |
37 | def wordify(self, chunk, chunknr, gender):
38 | if gender == 'm':
39 | number = self.number_sng_msc
40 | elif gender == 'f':
41 | number = self.number_sng_fem
42 | elif gender == 'n':
43 | number = self.number_sng_neu
44 | words = u''
45 | digit1 = u''
46 | digit2 = u''
47 | digit3 = u''
48 | chunklength = len(chunk)
49 | # placing digits in right places
50 | if chunklength == 1:
51 | digit3 = chunk[0 : 1]
52 | if chunklength == 2:
53 | digit2 = chunk[0 : 1]
54 | digit3 = chunk[1 : 2]
55 | if chunklength == 3:
56 | digit1 = chunk[0 : 1]
57 | digit2 = chunk[1 : 2]
58 | digit3 = chunk[-1]
59 | # processing zero
60 | if chunklength == 1 and digit3 == '0' :
61 | return number[0]
62 | # processing hundreds
63 | if chunklength == 3 :
64 | if int(digit1) == 1 :
65 | words += self.multi_sng_msc[0]
66 | elif int(digit1) == 2 :
67 | words += u'двісті'
68 | elif int(digit1) == 3 :
69 | words += u'триста'
70 | elif int(digit1) == 4 :
71 | words += u'чотириста'
72 | elif int(digit1) >= 5 :
73 | words += self.number_sng_msc[int(digit1)] + self.multi_plr_msc[0]
74 | # processing tens
75 | if chunklength > 1:
76 | spacer = ''
77 | if len(words) > 0 : spacer = ' '
78 | if digit2 == '1':
79 | words += spacer + self.number_teens[int(digit3)]
80 | else:
81 | if int(digit2) > 1 and int(digit2) < 4:
82 | words += spacer + skaitlix[int(digit2)] + u'дцять'
83 | elif digit2 == '4':
84 | words += spacer + u'сорок'
85 | elif int(digit2) >= 5 and int(digit2) != 9:
86 | words += spacer + skaitlix[int(digit2)] + u'десят'
87 | elif digit2 == '9':
88 | words += spacer + u'дев\'яносто'
89 |
90 | # processing ones
91 | if chunklength > 0 and digit2 != '1' :
92 | spacer = ''
93 | if len(words) > 0: spacer = u' '
94 | if chunknr == 1:
95 | if int(digit3) == 1 or int(digit3) == 2:
96 | words += spacer + self.number_sng_fem[int(digit3)]
97 | elif int(digit3) >= 3 and int(digit3) != 0:
98 | words += spacer + self.number_sng_msc[int(digit3)]
99 | else:
100 | if int(digit3) > 0: words += spacer + self.number_sng_msc[int(digit3)]
101 | # end processing
102 | if len(words) > 0 :
103 | if digit3 == '1' and chunknr > 0:
104 | return words + self.multi_sng_msc[chunknr]
105 | elif digit3 != '1' and chunknr > 0:
106 | return words + self.multi_plr_msc[chunknr]
107 | else:
108 | return words
109 | else:
110 | return ''
111 |
112 | uk_UA()
113 |
--------------------------------------------------------------------------------
/report_aeroo/wizard/add_print_button.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2012 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | from openerp import pooler
33 | from openerp.tools.translate import _
34 | from openerp.osv import osv
35 | from openerp.osv import fields
36 |
37 | special_reports = [
38 | 'printscreen.list'
39 | ]
40 |
41 | def _reopen(self, res_id, model):
42 | return {'type': 'ir.actions.act_window',
43 | 'view_mode': 'form',
44 | 'view_type': 'form',
45 | 'res_id': res_id,
46 | 'res_model': self._name,
47 | 'target': 'new',
48 | }
49 |
50 | class aeroo_add_print_button(osv.osv_memory):
51 | '''
52 | Add Print Button
53 | '''
54 | _name = 'aeroo.add_print_button'
55 | _description = 'Add print button'
56 |
57 | def _check(self, cr, uid, context):
58 | ir_values_obj = self.pool.get('ir.values')
59 | report = self.pool.get(context['active_model']).browse(cr, uid, context['active_id'], context=context)
60 | if report.report_name in special_reports:
61 | return 'exception'
62 | if report.report_wizard:
63 | act_win_obj = self.pool.get('ir.actions.act_window')
64 | act_win_ids = act_win_obj.search(cr, uid, [('res_model','=','aeroo.print_actions')], context=context)
65 | for act_win in act_win_obj.browse(cr, uid, act_win_ids, context=context):
66 | act_win_context = eval(act_win.context, {})
67 | if act_win_context.get('report_action_id')==report.id:
68 | return 'exist'
69 | return 'add'
70 | else:
71 | ids = ir_values_obj.search(cr, uid, [('value','=',report.type+','+str(report.id))])
72 | if not ids:
73 | return 'add'
74 | else:
75 | return 'exist'
76 |
77 | def do_action(self, cr, uid, ids, context):
78 | this = self.browse(cr, uid, ids[0], context=context)
79 | report = self.pool.get(context['active_model']).browse(cr, uid, context['active_id'], context=context)
80 | event_id = self.pool.get('ir.values').set_action(cr, uid, report.report_name, 'client_print_multi', report.model, 'ir.actions.report.xml,%d' % context['active_id'])
81 | if report.report_wizard:
82 | report._set_report_wizard(report.id)
83 | this.write({'state':'done'})
84 | if not this.open_action:
85 | return _reopen(self, this.id, this._model)
86 |
87 | mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
88 | act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
89 |
90 | mod_id = mod_obj.search(cr, uid, [('name', '=', 'act_values_form_action')])[0]
91 | res_id = mod_obj.read(cr, uid, mod_id, ['res_id'])['res_id']
92 | act_win = act_obj.read(cr, uid, res_id, [])
93 | act_win['domain'] = [('id','=',event_id)]
94 | act_win['name'] = _('Client Events')
95 | return act_win
96 |
97 | _columns = {
98 | 'open_action':fields.boolean('Open added action'),
99 | 'state':fields.selection([
100 | ('add','Add'),
101 | ('exist','Exist'),
102 | ('exception','Exception'),
103 | ('done','Done'),
104 |
105 | ],'State', select=True, readonly=True),
106 | }
107 |
108 | _defaults = {
109 | 'state': _check,
110 |
111 | }
112 |
113 | aeroo_add_print_button()
114 |
115 |
--------------------------------------------------------------------------------
/report_aeroo/barcode/code39.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2008 marscel.wordpress.com
2 | #
3 | # Copyright (c) 2011 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 |
6 | # Code39.py v1
7 | # Requires Python and Python Imaging Library (PIL),
8 | # has been tested with Python v2.6 and PIL v1.1.6
9 |
10 | # Usage example:
11 | # code39.py 100 2 "Hello World" barcode.png
12 | #
13 | # This creates a PNG image "barcode.png" containing a barcode of the height of 100px
14 | # a min line width of 2px with "Hello World" encoded as "*HELLO WORLD*" in Code 39
15 |
16 | from PIL import Image, ImageDraw, ImageFont
17 | from openerp.tools import config, ustr
18 | import os, sys
19 |
20 | marginx = 10
21 | marginy = 10
22 | fontsize = 15
23 |
24 | charmap = {
25 | '*':[0,3,0,1,2,1,2,1,0],
26 | '-':[0,3,0,1,0,1,2,1,2],
27 | '$':[0,3,0,3,0,3,0,1,0],
28 | '%':[0,1,0,3,0,3,0,3,0],
29 | ' ':[0,3,2,1,0,1,2,1,0],
30 | '.':[2,3,0,1,0,1,2,1,0],
31 | '/':[0,3,0,3,0,1,0,3,0],
32 | '+':[0,3,0,1,0,3,0,3,0],
33 | '0':[0,1,0,3,2,1,2,1,0],
34 | '1':[2,1,0,3,0,1,0,1,2],
35 | '2':[0,1,2,3,0,1,0,1,2],
36 | '3':[2,1,2,3,0,1,0,1,0],
37 | '4':[0,1,0,3,2,1,0,1,2],
38 | '5':[2,1,0,3,2,1,0,1,0],
39 | '6':[0,1,2,3,2,1,0,1,0],
40 | '7':[0,1,0,3,0,1,2,1,2],
41 | '8':[2,1,0,3,0,1,2,1,0],
42 | '9':[0,1,2,3,0,1,2,1,0],
43 | 'A':[2,1,0,1,0,3,0,1,2],
44 | 'B':[0,1,2,1,0,3,0,1,2],
45 | 'C':[2,1,2,1,0,3,0,1,0],
46 | 'D':[0,1,0,1,2,3,0,1,2],
47 | 'E':[2,1,0,1,2,3,0,1,0],
48 | 'F':[0,1,2,1,2,3,0,1,0],
49 | 'G':[0,1,0,1,0,3,2,1,2],
50 | 'H':[2,1,0,1,0,3,2,1,0],
51 | 'I':[0,1,2,1,0,3,2,1,0],
52 | 'J':[0,1,0,1,2,3,2,1,0],
53 | 'K':[2,1,0,1,0,1,0,3,2],
54 | 'L':[0,1,2,1,0,1,0,3,2],
55 | 'M':[2,1,2,1,0,1,0,3,0],
56 | 'N':[0,1,0,1,2,1,0,3,2],
57 | 'O':[2,1,0,1,2,1,0,3,0],
58 | 'P':[0,1,2,1,2,1,0,3,0],
59 | 'Q':[0,1,0,1,0,1,2,3,2],
60 | 'R':[2,1,0,1,0,1,2,3,0],
61 | 'S':[0,1,2,1,0,1,2,3,0],
62 | 'T':[0,1,0,1,2,1,2,3,0],
63 | 'U':[2,3,0,1,0,1,0,1,2],
64 | 'V':[0,3,2,1,0,1,0,1,2],
65 | 'W':[2,3,2,1,0,1,0,1,0],
66 | 'X':[0,3,0,1,2,1,0,1,2],
67 | 'Y':[2,3,0,1,2,1,0,1,0],
68 | 'Z':[0,3,2,1,2,1,0,1,0]
69 | }
70 |
71 | def create_c39(height, smallest, text):
72 | pixel_length = 0
73 | i = 0
74 | newtext = ""
75 | machinetext = "*" + text + "*"
76 | seglist = []
77 | while i < len(machinetext):
78 | char = machinetext[i].capitalize()
79 | i = i + 1
80 | try:
81 | cmap = charmap[char]
82 | if len(cmap) != 9:
83 | continue
84 |
85 | j = 0
86 | while j < 9:
87 | seg = int(cmap[j])
88 |
89 | if seg == 0 or seg == 1:
90 | pixel_length = pixel_length + smallest
91 | seglist.append(seg)
92 | elif seg == 2 or seg == 3:
93 | pixel_length = pixel_length + smallest * 3
94 | seglist.append(seg)
95 |
96 | j = j + 1
97 |
98 | newtext += char
99 | except:
100 | continue
101 |
102 | pixel_length = pixel_length + 2*marginx + len(newtext) * smallest
103 | pixel_height = height + 2*marginy + fontsize
104 |
105 | barcode_img = Image.new('RGB', [pixel_length, pixel_height], "white")
106 |
107 | if len(seglist) == 0:
108 | return barcode_img
109 |
110 | i = 0
111 | draw = ImageDraw.Draw(barcode_img)
112 | current_x = marginx
113 |
114 | while i < len(seglist):
115 | seg = seglist[i]
116 | color = (255, 255, 255)
117 | wdth = smallest
118 |
119 | if seg == 0 or seg == 2:
120 | color = 0
121 | if seg == 0:
122 | wdth = smallest
123 | else:
124 | wdth = smallest * 3
125 | elif seg == 1 or seg == 3:
126 | color = (255, 255, 255)
127 | if seg == 1:
128 | wdth = smallest
129 | else:
130 | wdth = smallest * 3
131 |
132 | j = 1
133 |
134 | while j <= wdth:
135 | draw.line((current_x, marginy, current_x, marginy+height), fill=color)
136 | current_x = current_x + 1
137 | j = j + 1
138 |
139 | if ((i+1) % 9) == 0:
140 | j = 1
141 | while j <= smallest:
142 | draw.line((current_x, marginy, current_x, marginy+height), fill=(255,255,255))
143 | current_x = current_x + 1
144 | j = j + 1
145 | i = i + 1
146 |
147 | ad = os.path.abspath(os.path.join(ustr(config['root_path']), u'addons'))
148 | mod_path_list = map(lambda m: os.path.abspath(ustr(m.strip())), config['addons_path'].split(','))
149 | mod_path_list.append(ad)
150 |
151 | for mod_path in mod_path_list:
152 | font_file = mod_path+os.path.sep+ \
153 | "report_aeroo"+os.path.sep+"barcode"+os.path.sep+"FreeMonoBold.ttf"
154 | if os.path.lexists(font_file):
155 | font = ImageFont.truetype(font_file, fontsize)
156 |
157 | draw.text((pixel_length/2 - len(newtext)*(fontsize/2)/2-len(newtext), height+fontsize), newtext, font=font, fill=0)
158 |
159 | del draw
160 |
161 | return barcode_img
162 |
163 |
--------------------------------------------------------------------------------
/report_aeroo/barcode/code128.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2009-2011 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
2 | # General contacts
3 | # This list was cut'n'pasted verbatim from the "Code 128 Specification Page"
4 | # at http://www.adams1.com/pub/russadam/128code.html
5 |
6 | codelist="""0 SP SP 00 2 1 2 2 2 2
7 | 1 ! ! 01 2 2 2 1 2 2
8 | 2 " " 02 2 2 2 2 2 1
9 | 3 # # 03 1 2 1 2 2 3
10 | 4 $ $ 04 1 2 1 3 2 2
11 | 5 % % 05 1 3 1 2 2 2
12 | 6 & & 06 1 2 2 2 1 3
13 | 7 ' ' 07 1 2 2 3 1 2
14 | 8 ( ( 08 1 3 2 2 1 2
15 | 9 ) ) 09 2 2 1 2 1 3
16 | 10 * * 10 2 2 1 3 1 2
17 | 11 + + 11 2 3 1 2 1 2
18 | 12 , , 12 1 1 2 2 3 2
19 | 13 - - 13 1 2 2 1 3 2
20 | 14 . . 14 1 2 2 2 3 1
21 | 15 / / 15 1 1 3 2 2 2
22 | 16 0 0 16 1 2 3 1 2 2
23 | 17 1 1 17 1 2 3 2 2 1
24 | 18 2 2 18 2 2 3 2 1 1
25 | 19 3 3 19 2 2 1 1 3 2
26 | 20 4 4 20 2 2 1 2 3 1
27 | 21 5 5 21 2 1 3 2 1 2
28 | 22 6 6 22 2 2 3 1 1 2
29 | 23 7 7 23 3 1 2 1 3 1
30 | 24 8 8 24 3 1 1 2 2 2
31 | 25 9 9 25 3 2 1 1 2 2
32 | 26 : : 26 3 2 1 2 2 1
33 | 27 ; ; 27 3 1 2 2 1 2
34 | 28 < < 28 3 2 2 1 1 2
35 | 29 = = 29 3 2 2 2 1 1
36 | 30 > > 30 2 1 2 1 2 3
37 | 31 ? ? 31 2 1 2 3 2 1
38 | 32 @ @ 32 2 3 2 1 2 1
39 | 33 A A 33 1 1 1 3 2 3
40 | 34 B B 34 1 3 1 1 2 3
41 | 35 C C 35 1 3 1 3 2 1
42 | 36 D D 36 1 1 2 3 1 3
43 | 37 E E 37 1 3 2 1 1 3
44 | 38 F F 38 1 3 2 3 1 1
45 | 39 G G 39 2 1 1 3 1 3
46 | 40 H H 40 2 3 1 1 1 3
47 | 41 I I 41 2 3 1 3 1 1
48 | 42 J J 42 1 1 2 1 3 3
49 | 43 K K 43 1 1 2 3 3 1
50 | 44 L L 44 1 3 2 1 3 1
51 | 45 M M 45 1 1 3 1 2 3
52 | 46 N N 46 1 1 3 3 2 1
53 | 47 O O 47 1 3 3 1 2 1
54 | 48 P P 48 3 1 3 1 2 1
55 | 49 Q Q 49 2 1 1 3 3 1
56 | 50 R R 50 2 3 1 1 3 1
57 | 51 S S 51 2 1 3 1 1 3
58 | 52 T T 52 2 1 3 3 1 1
59 | 53 U U 53 2 1 3 1 3 1
60 | 54 V V 54 3 1 1 1 2 3
61 | 55 W W 55 3 1 1 3 2 1
62 | 56 X X 56 3 3 1 1 2 1
63 | 57 Y Y 57 3 1 2 1 1 3
64 | 58 Z Z 58 3 1 2 3 1 1
65 | 59 [ [ 59 3 3 2 1 1 1
66 | 60 \\ \\ 60 3 1 4 1 1 1
67 | 61 ] ] 61 2 2 1 4 1 1
68 | 62 ^ ^ 62 4 3 1 1 1 1
69 | 63 _ _ 63 1 1 1 2 2 4
70 | 64 NUL ' 64 1 1 1 4 2 2
71 | 65 SOH a 65 1 2 1 1 2 4
72 | 66 STX b 66 1 2 1 4 2 1
73 | 67 ETX c 67 1 4 1 1 2 2
74 | 68 EOT d 68 1 4 1 2 2 1
75 | 69 ENQ e 69 1 1 2 2 1 4
76 | 70 ACK f 70 1 1 2 4 1 2
77 | 71 BEL g 61 1 2 2 1 1 4
78 | 72 BS h 72 1 2 2 4 1 1
79 | 73 HT i 73 1 4 2 1 1 2
80 | 74 LF j 74 1 4 2 2 1 1
81 | 75 VT k 75 2 4 1 2 1 1
82 | 76 FF l 76 2 2 1 1 1 4
83 | 77 CR m 77 4 1 3 1 1 1
84 | 78 SO n 78 2 4 1 1 1 2
85 | 79 SI o 79 1 3 4 1 1 1
86 | 80 DLE p 80 1 1 1 2 4 2
87 | 81 DC1 q 81 1 2 1 1 4 2
88 | 82 DC2 r 82 1 2 1 2 4 1
89 | 83 DC3 s 83 1 1 4 2 1 2
90 | 84 DC4 t 84 1 2 4 1 1 2
91 | 85 NAK u 85 1 2 4 2 1 1
92 | 86 SYN v 86 4 1 1 2 1 2
93 | 87 ETB w 87 4 2 1 1 1 2
94 | 88 CAN x 88 4 2 1 2 1 1
95 | 89 EM y 89 2 1 2 1 4 1
96 | 90 SUB z 90 2 1 4 1 2 1
97 | 91 ESC { 91 4 1 2 1 2 1
98 | 92 FS | 92 1 1 1 1 4 3
99 | 93 GS } 93 1 1 1 3 4 1
100 | 94 RS ~ 94 1 3 1 1 4 1
101 | 95 (Hex 7F) US DEL 95 1 1 4 1 1 3
102 | 96 (Hex 80) FNC 3 FNC 3 96 1 1 4 3 1 1
103 | 97 (Hex 81) FNC 2 FNC 2 97 4 1 1 1 1 3
104 | 98 (Hex 82) SHIFT SHIFT 98 4 1 1 3 1 1
105 | 99 (Hex 83) CODE C CODE C 99 1 1 3 1 4 1
106 | 100 (Hex 84) CODE B FNC 4 CODE B 1 1 4 1 3 1
107 | 101 (Hex 85) FNC 4 CODE A CODE A 3 1 1 1 4 1
108 | 102 (Hex 86) FNC 1 FNC 1 FNC 1 4 1 1 1 3 1"""
109 |
110 |
111 |
112 |
113 | other="""103 (Hex 87) START (Code A) 2 1 1 4 1 2
114 | 104 (Hex 88) START (Code B) 2 1 1 2 1 4
115 | 105 (Hex 89) START (Code C) 2 1 1 2 3 2
116 | 106 STOP 2 3 3 1 1 1 2"""
117 |
118 |
119 | codes={}
120 | values={}
121 | for l in codelist.split('\n'):
122 | l.strip()
123 | num,a1,b1,c1,code=l.split('\t')
124 | num=int(num.split(' ')[0])
125 | values[num]=[int(x) for x in code.split()]
126 | codes[b1.strip()]=num
127 |
128 | codes[' ']=codes['SP']
129 |
130 | for l in other.split('\n'):
131 | l.strip()
132 | num,name,code=l.split('\t')
133 | num=int(num.split(' ')[0])
134 | values[num]=[int(x) for x in code.split()]
135 | codes[name.strip()]=num
136 |
137 | def encode_message(msg):
138 | startnum=codes['START (Code B)']
139 | message=values[startnum][:]
140 | chksum=startnum
141 | mult=1
142 | for c in msg:
143 | if not codes.has_key(c):
144 | raise "No code for "+c
145 | chksum=chksum+mult*codes[c]
146 | mult=mult+1
147 | message=message+values[codes[c]]
148 |
149 | chksum=chksum%103
150 |
151 | message=message+values[chksum]
152 | message=message+values[codes['STOP']]
153 |
154 | return message
155 |
156 |
157 | import os
158 | from PIL import Image
159 | def get_code(message,xw=1,h=100,rotate=None):
160 | """ message is message to code.
161 | xw is horizontal multiplier (in pixels width of narrowest bar)
162 | h is height in pixels.
163 |
164 | Returns a Python Imaging Library object."""
165 |
166 | widths=[xw*20]+encode_message(message)+[xw*20]
167 |
168 | bits=[]
169 | i=1
170 | for w in widths:
171 | bits=bits+[i]*w*xw
172 | i=1-i
173 |
174 | #print len(bits)
175 | #print bits
176 |
177 | i=Image.new('1',(len(bits),h),1)
178 |
179 | for b in range(len(bits)):
180 | for y in range(h):
181 | i.putpixel((b,y),255*bits[b])
182 |
183 | return i
184 |
185 |
186 |
--------------------------------------------------------------------------------
/report_aeroo/barcode/EANBarCode.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2009-2011 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
2 | # General contacts
3 |
4 | from openerp.tools import config, ustr
5 | fontsize = 15
6 |
7 | """
8 | This class generate EAN bar code, it required PIL (python imaging library)
9 | installed.
10 |
11 | If the code has not checksum (12 digits), it added automatically.
12 |
13 | Create bar code sample :
14 | from EANBarCode import EanBarCode
15 | bar = EanBarCode()
16 | bar.getImage("9782212110708",50,"gif")
17 |
18 | """
19 |
20 | class EanBarCode:
21 | """ Compute the EAN bar code """
22 | def __init__(self):
23 | A = {0 : "0001101", 1 : "0011001", 2 : "0010011", 3 : "0111101", 4 : "0100011",
24 | 5 : "0110001", 6 : "0101111", 7 : "0111011", 8 : "0110111", 9 : "0001011"}
25 | B = {0 : "0100111", 1 : "0110011", 2 : "0011011", 3 : "0100001", 4 : "0011101",
26 | 5 : "0111001", 6 : "0000101", 7 : "0010001", 8 : "0001001", 9 : "0010111"}
27 | C = {0 : "1110010", 1 : "1100110", 2 : "1101100", 3 : "1000010", 4 : "1011100",
28 | 5 : "1001110", 6 : "1010000", 7 : "1000100", 8 : "1001000", 9 : "1110100"}
29 | self.groupC = C
30 |
31 | self.family = {0 : (A,A,A,A,A,A), 1 : (A,A,B,A,B,B), 2 : (A,A,B,B,A,B), 3 : (A,A,B,B,B,A), 4 : (A,B,A,A,B,B),
32 | 5 : (A,B,B,A,A,B), 6 : (A,B,B,B,A,A), 7 : (A,B,A,B,A,B), 8 : (A,B,A,B,B,A), 9 : (A,B,B,A,B,A)}
33 |
34 |
35 | def makeCode(self, code):
36 | """ Create the binary code
37 | return a string which contains "0" for white bar, "1" for black bar, "L" for long bar """
38 |
39 | # Convert code string in integer list
40 | self.EAN13 = []
41 | for digit in code:
42 | self.EAN13.append(int(digit))
43 |
44 | # If the code has already a checksum
45 | if len(self.EAN13) == 13:
46 | # Verify checksum
47 | self.verifyChecksum(self.EAN13)
48 | # If the code has not yet checksum
49 | elif len(self.EAN13) == 12:
50 | # Add checksum value
51 | self.EAN13.append(self.computeChecksum(self.EAN13))
52 |
53 | # Get the left codage class
54 | left = self.family[self.EAN13[0]]
55 |
56 | # Add start separator
57 | strCode = 'L0L'
58 |
59 | # Compute the left part of bar code
60 | for i in range(0,6):
61 | strCode += left[i][self.EAN13[i+1]]
62 |
63 | # Add middle separator
64 | strCode += '0L0L0'
65 |
66 | # Compute the right codage class
67 | for i in range (7,13):
68 | strCode += self.groupC[self.EAN13[i]]
69 |
70 | # Add stop separator
71 | strCode += 'L0L'
72 |
73 | return strCode
74 |
75 |
76 | def computeChecksum(self, arg):
77 | """ Compute the checksum of bar code """
78 | # UPCA/EAN13
79 | weight=[1,3]*6
80 | magic=10
81 | sum = 0
82 |
83 | for i in range(12): # checksum based on first 12 digits.
84 | sum = sum + int(arg[i]) * weight[i]
85 | z = ( magic - (sum % magic) ) % magic
86 | if z < 0 or z >= magic:
87 | return None
88 | return z
89 |
90 |
91 | def verifyChecksum(self, bits):
92 | """ Verify the checksum """
93 | computedChecksum = self.computeChecksum(bits[:12])
94 | codeBarChecksum = bits[12]
95 |
96 | if codeBarChecksum != computedChecksum:
97 | raise Exception ("Bad checksum is %s and should be %s"%(codeBarChecksum, computedChecksum))
98 |
99 |
100 | def getImage(self, value, height = 50, xw=1, rotate=None, extension = "PNG"):
101 | """ Get an image with PIL library
102 | value code barre value
103 | height height in pixel of the bar code
104 | extension image file extension"""
105 | from PIL import Image, ImageFont, ImageDraw
106 | import os
107 | from string import lower, upper
108 |
109 | # Get the bar code list
110 | bits = self.makeCode(value)
111 |
112 | # Get thee bar code with the checksum added
113 | code = ""
114 | for digit in self.EAN13:
115 | code += "%d"%digit
116 |
117 | # Create a new image
118 | position = 8
119 | im = Image.new("1",(len(bits)+position,height))
120 |
121 | # Load font
122 | ad = os.path.abspath(os.path.join(ustr(config['root_path']), u'addons'))
123 | mod_path_list = map(lambda m: os.path.abspath(ustr(m.strip())), config['addons_path'].split(','))
124 | mod_path_list.append(ad)
125 |
126 | for mod_path in mod_path_list:
127 | font_file = mod_path+os.path.sep+ \
128 | "report_aeroo"+os.path.sep+"barcode"+os.path.sep+"FreeMonoBold.ttf"
129 | if os.path.lexists(font_file):
130 | font = ImageFont.truetype(font_file, fontsize)
131 |
132 | # Create drawer
133 | draw = ImageDraw.Draw(im)
134 |
135 | # Erase image
136 | draw.rectangle(((0,0),(im.size[0],im.size[1])),fill=256)
137 |
138 | # Draw first part of number
139 | draw.text((0, height-9), code[0], font=font, fill=0)
140 |
141 | # Draw first part of number
142 | draw.text((position+7, height-9), code[1:7], font=font, fill=0)
143 |
144 | # Draw second part of number
145 | draw.text((len(bits)/2+6+position, height-9), code[7:], font=font, fill=0)
146 |
147 | # Draw the bar codes
148 | for bit in range(len(bits)):
149 | # Draw normal bar
150 | if bits[bit] == '1':
151 | draw.rectangle(((bit+position,0),(bit+position,height-10)),fill=0)
152 | # Draw long bar
153 | elif bits[bit] == 'L':
154 | draw.rectangle(((bit+position,0),(bit+position,height-3)),fill=0)
155 |
156 | # Save the result image
157 | return im
158 |
159 |
--------------------------------------------------------------------------------
/report_aeroo/wizard/report_actions.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2012 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | import wizard
33 | import pooler
34 | from tools.translate import _
35 |
36 | def ir_set(cr, uid, key, key2, name, models, value, replace=True, isobject=False, meta=None):
37 | obj = pooler.get_pool(cr.dbname).get('ir.values')
38 | return obj.set(cr, uid, key, key2, name, models, value, replace, isobject, meta)
39 |
40 | special_reports = [
41 | 'printscreen.list'
42 | ]
43 |
44 | class report_actions_wizard(wizard.interface):
45 | '''
46 | Add Print Button
47 | '''
48 | form = '''
49 | '''
53 |
54 | exist_form = '''
55 | '''
58 |
59 | exception_form = '''
60 | '''
63 |
64 | done_form = '''
65 | '''
68 |
69 | fields = {
70 | 'open_action': {'string': 'Open added action', 'type': 'boolean', 'default': False},
71 | }
72 |
73 | def _do_action(self, cr, uid, data, context):
74 | pool = pooler.get_pool(cr.dbname)
75 | report = pool.get(data['model']).browse(cr, uid, data['id'], context=context)
76 | res = ir_set(cr, uid, 'action', 'client_print_multi', report.report_name, [report.model], 'ir.actions.report.xml,%d' % data['id'], isobject=True)
77 | if report.report_wizard:
78 | report._set_report_wizard()
79 | return {'value_id':res[0]}
80 |
81 | def _check(self, cr, uid, data, context):
82 | pool = pooler.get_pool(cr.dbname)
83 | ir_values_obj = pool.get('ir.values')
84 | report = pool.get(data['model']).browse(cr, uid, data['id'], context=context)
85 | if report.report_name in special_reports:
86 | return 'exception'
87 | if report.report_wizard:
88 | act_win_obj = pool.get('ir.actions.act_window')
89 | act_win_ids = act_win_obj.search(cr, uid, [('res_model','=','aeroo.print_actions')], context=context)
90 | for act_win in act_win_obj.browse(cr, uid, act_win_ids, context=context):
91 | act_win_context = eval(act_win.context, {})
92 | if act_win_context.get('report_action_id')==report.id:
93 | return 'exist'
94 | return 'add'
95 | else:
96 | ids = ir_values_obj.search(cr, uid, [('value','=',report.type+','+str(data['id']))])
97 | if not ids:
98 | return 'add'
99 | else:
100 | return 'exist'
101 |
102 | def _action_open_window(self, cr, uid, data, context):
103 | form=data['form']
104 | if not form['open_action']:
105 | return {}
106 |
107 | mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
108 | act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
109 |
110 | mod_id = mod_obj.search(cr, uid, [('name', '=', 'act_values_form_action')])[0]
111 | res_id = mod_obj.read(cr, uid, mod_id, ['res_id'])['res_id']
112 | act_win = act_obj.read(cr, uid, res_id, [])
113 | act_win['domain'] = [('id','=',form['value_id'])]
114 | act_win['name'] = _('Client Events')
115 | return act_win
116 |
117 | states = {
118 | 'init': {
119 | 'actions': [],
120 | 'result': {'type':'choice','next_state':_check}
121 | },
122 | 'add': {
123 | 'actions': [],
124 | 'result': {'type': 'form', 'arch': form, 'fields': fields, 'state': (('end', _('_Cancel')), ('process', _('_Ok')))},
125 | },
126 | 'exist': {
127 | 'actions': [],
128 | 'result': {'type': 'form', 'arch': exist_form, 'fields': {}, 'state': (('end', _('_Close')),)},
129 | },
130 | 'exception': {
131 | 'actions': [],
132 | 'result': {'type': 'form', 'arch': exception_form, 'fields': {}, 'state': (('end', _('_Close')),)},
133 | },
134 | 'process': {
135 | 'actions': [_do_action],
136 | 'result': {'type': 'state', 'state': 'done'},
137 | },
138 | 'done': {
139 | 'actions': [],
140 | 'result': {'type': 'form', 'arch': done_form, 'fields': {}, 'state': (('exit', _('_Close')),)},
141 | },
142 | 'exit': {
143 | 'actions': [],
144 | 'result': {'type': 'action', 'action': _action_open_window, 'state': 'end'},
145 | },
146 | }
147 | report_actions_wizard('aeroo.report_actions')
148 |
149 |
--------------------------------------------------------------------------------
/report_aeroo/ctt_objects.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: utf8 -*-
3 | ################################################################################
4 | # Developed by Kaspars Vilkens - Alistek Ltd (c) 2011
5 | #
6 | # Supported sum: 0 ... 999999999999.99
7 | # Supported languages: for more reference see languages forlder
8 | # Supported currencies: see particular language for reference
9 | ################################################################################
10 |
11 | import os
12 | supported_language = {}
13 |
14 | if __name__ == '__main__':
15 | from sys import exit
16 | error = '''This code is part of Report Aeroo package!
17 | Not to be used separately...'''
18 | exit(error)
19 |
20 | def currency_to_text(sum, currency_code, language_code):
21 | if language_code not in supported_language:
22 | raise Exception('Not supported or no language: %s' % language_code)
23 | else:
24 | suppl = supported_language[language_code]
25 | return suppl.currency_to_text(sum, currency_code)
26 |
27 | class ctt_language(object):
28 | def _init_lang(self):
29 | pass
30 |
31 | def __repr__(self):
32 | return self.name
33 |
34 | def __init__(self):
35 | self.supported_currency = {}
36 | self.minbound = 0
37 | self.maxbound = 999999999999.99
38 | currencies = self._init_lang()
39 | supported_language.update({self.name : self})
40 | import_submodules('currency', currencies, 0)
41 |
42 | def check_sum(self):
43 | if sum < self.minbound or sum > self.maxbound :
44 | raise Exception(\
45 | """Sum out of bounds: must be from %s to %s""" % \
46 | (str(self.minbound), str(self.maxbound)))
47 |
48 | def check_currency(self):
49 | if currency not in supported_currency:
50 | raise Exception(\
51 | """Unsupported or no currency: must be one of (%s)""" % \
52 | ', '.join(self.supported_currency))
53 |
54 | def dtowords(self, sum_integers, gender):
55 | diginwords = u''
56 | if sum_integers == 0:
57 | return self.wordify('0', 0, gender)
58 | elif sum_integers > 0:
59 | lengthx = len(str(sum_integers))
60 | nrchunks = (lengthx / 3)
61 | if nrchunks < (float(lengthx) / 3) :
62 | nrchunks+=1
63 | inc = 1
64 | while inc <= nrchunks:
65 | startpos = (lengthx - inc * 3)
66 | chunklength = 3
67 | if startpos < 0:
68 | chunklength += startpos
69 | startpos = 0
70 | chunk = str(sum_integers)[startpos : startpos + chunklength]
71 | #print str(startpos)+' '+str(chunklength)+' '+ chunk
72 | if inc == 1:
73 | wordified = self.wordify(chunk, inc-1, gender)
74 | else:
75 | wordified = self.wordify(chunk, inc-1, 'm')
76 | inc += 1
77 | spacer = ''
78 | if len(diginwords) > 0 and wordified:
79 | spacer = ' '
80 | diginwords = wordified + spacer + diginwords
81 | return diginwords
82 |
83 |
84 | def currency_to_text(self, sum, currency):
85 | #--------------for currencies with 100 fractions
86 | sum = float(sum)
87 | sum = round(sum, 2)
88 | # find out digits before floating point - currency
89 | sum_cur = int(sum)
90 | # find out digits after floating point - fractions
91 | sum_frc = int(round((sum - sum_cur) * 100,0))
92 | curr = self.supported_currency.get(currency)
93 | cur_in_words = self.dtowords(sum_cur, curr.cur_gram_gender)
94 | frc_in_words = self.dtowords(sum_frc, curr.frc_gram_gender)
95 | #------------------------------------
96 |
97 | return (cur_in_words + curr.cur_to_text(sum_cur) + ' ' + frc_in_words +\
98 | curr.frc_to_text(sum_frc)).strip().encode('utf-8')
99 |
100 |
101 | class ctt_currency(object):
102 | def _init_currency(self):
103 | pass
104 |
105 | def __repr__(self):
106 | return self.code
107 |
108 | def __init__(self):
109 | self._init_currency()
110 | suppl = supported_language.get(self.language)
111 | suppl.supported_currency.update({self.code : self})
112 |
113 | def cur_to_text(self, sum_cur):
114 | # is the currency sum one
115 | if sum_cur == 1 or (str(sum_cur)[-1] == '1' and str(sum_cur)[-2] !='1'):
116 | return self.cur_singular
117 | # 2,3 and 4 yields different plural form, if defined
118 | elif ((sum_cur in [2, 3, 4]) or (str(sum_cur)[-1] in ['2', '3', '4'] \
119 | and str(sum_cur)[-2] != '1')) and hasattr(self, 'cur_plural_2to4'):
120 | return self.cur_plural_2to4
121 | # betwean 1 and 10 yields different plural form, if defined
122 | elif (sum_cur > 1 and sum_cur < 10 or (int(str(sum_cur)[-1]) > 1 \
123 | and str(sum_cur)[-2] != '1')) and hasattr(self, 'cur_plural_2to10'):
124 | return self.cur_plural_2to10
125 | # starting from 10 yields uses default plural form
126 | else:
127 | return self.cur_plural
128 |
129 | def frc_to_text(self, sum_frc):
130 | # is the fraction sum one
131 | if sum_frc == 1 or (str(sum_frc)[-1] == '1' and str(sum_frc)[-2] !='1'):
132 | return self.frc_singular
133 | # 2,3 and 4 yields different plural form, if defined
134 | elif ((sum_frc in [2, 3, 4]) or (str(sum_frc)[-1] in ['2', '3', '4'] \
135 | and str(sum_frc)[-2] != '1')) and hasattr(self, 'frc_plural_2to4'):
136 | return self.frc_plural_2to4
137 | # betwean 1 and 10 yields different plural form, if defined
138 | elif (sum_frc > 1 and sum_frc < 10 or (int(str(sum_frc)[-1]) > 1 \
139 | and str(sum_frc)[-2] != '1')) and hasattr(self, 'frc_plural_2to10'):
140 | return self.frc_plural_2to10
141 | # starting from 10 yields uses default plural form
142 | else:
143 | return self.frc_plural
144 |
145 | def __filter_names(to_import, package):
146 | folder = os.path.split(package.__file__)[0]
147 | for name in os.listdir(folder):
148 | if to_import == 'currency':
149 | if name.endswith(".py") and not name.startswith("__"):
150 | yield name[:-3]
151 | if to_import == 'language':
152 | if len(name) == 5 and not name.startswith("__"):
153 | yield name
154 |
155 | def import_submodules(to_import, package, level=-1):
156 | names = list(__filter_names(to_import, package))
157 | m = __import__(package.__name__, globals(), locals(), names, level)
158 | return dict((name, getattr(m, name)) for name in names)
159 |
160 | import ctt_languages
161 | import_submodules('language', ctt_languages, 0)
162 |
--------------------------------------------------------------------------------
/report_aeroo/wizard/report_import_wizard.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2012 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | from openerp.osv import osv
33 | from openerp.osv import fields
34 | from openerp.tools import convert_xml_import
35 | from openerp.tools.translate import _
36 | import base64
37 | import lxml.etree
38 | import zipfile
39 | try:
40 | from cStringIO import StringIO
41 | except ImportError:
42 | from StringIO import StringIO
43 |
44 | class report_aeroo_import(osv.osv_memory):
45 | _name = 'aeroo.report_import'
46 | _description = 'Aeroo report import wizard'
47 |
48 | _columns = {
49 | 'name':fields.char('Name', size=64),
50 | 'file':fields.binary('Aeroo report file', filters='*.aeroo', required=True),
51 | 'info': fields.text('Info', readonly=True),
52 | 'state':fields.selection([
53 | ('draft','Draft'),
54 | ('info','Info'),
55 | ('done','Done'),
56 |
57 | ],'State', select=True, readonly=True),
58 |
59 | }
60 |
61 | def default_get(self, cr, uid, fields_list, context=None):
62 | values = {'state': 'draft'}
63 | default_ids = context.get('default_ids')
64 | if default_ids:
65 | this = self.read(cr, uid, default_ids, ['name','state','file','info'], context=context)[0]
66 | del this['id']
67 | values.update(this)
68 | return values
69 |
70 | def install_report(self, cr, uid, ids, context=None):
71 | report_obj = self.pool.get('ir.actions.report.xml')
72 | this = self.browse(cr, uid, ids[0], context=context)
73 | if report_obj.search(cr, uid, [('report_name','=',this.name)], context=context):
74 | raise osv.except_osv(_('Warning!'), _('Report with service name "%s" already exist in system!') % this.name)
75 | fd = StringIO()
76 | fd.write(base64.decodestring(this.file))
77 | fd.seek(0)
78 | convert_xml_import(cr, 'report_aeroo', fd, {}, 'init', noupdate=True)
79 | fd.close()
80 | self.write(cr, uid, ids, {'state':'done'}, context=context)
81 | report_id = report_obj.search(cr, uid, [('report_name','=',this.name)], context=context)[-1]
82 | report = report_obj.browse(cr, uid, report_id, context=context)
83 | event_id = self.pool.get('ir.values').set_action(cr, uid, report.report_name, 'client_print_multi', report.model, 'ir.actions.report.xml,%d' % report_id)
84 | if report.report_wizard:
85 | report._set_report_wizard(report.id)
86 |
87 | mod_obj = self.pool.get('ir.model.data')
88 | act_obj = self.pool.get('ir.actions.act_window')
89 |
90 | mod_id = mod_obj.search(cr, uid, [('name', '=', 'action_aeroo_report_xml_tree')])[0]
91 | res_id = mod_obj.read(cr, uid, mod_id, ['res_id'])['res_id']
92 | act_win = act_obj.read(cr, uid, res_id, [])
93 | act_win['domain'] = [('id','=',report_id)]
94 | return act_win
95 |
96 | def next(self, cr, uid, ids, context=None):
97 | this = self.browse(cr, uid, ids[0], context=context)
98 | file_data = base64.decodestring(this.file)
99 | zip_stream = StringIO()
100 | zip_stream.write(file_data)
101 | zip_obj = zipfile.ZipFile(zip_stream, mode='r', compression=zipfile.ZIP_DEFLATED)
102 | if zipfile.is_zipfile(zip_stream):
103 | report_obj = self.pool.get('ir.actions.report.xml')
104 | context['allformats'] = True
105 | mimetypes = dict(report_obj._get_in_mimetypes(cr, uid, context=context))
106 | styles_select = dict(report_obj._columns['styles_mode'].selection)
107 | if 'data.xml' in zip_obj.namelist():
108 | data = zip_obj.read('data.xml')
109 | else:
110 | raise osv.except_osv(_('Error!'), _('Aeroo report file is invalid!'))
111 | tree = lxml.etree.parse(StringIO(data))
112 | root = tree.getroot()
113 | info = ''
114 | report = root.xpath("//data/record[@model='ir.actions.report.xml']")[0]
115 | style = root.xpath("//data/record[@model='report.stylesheets']")[0]
116 | rep_name = report.find("field[@name='name']").text
117 | rep_service = report.find("field[@name='report_name']").text
118 | rep_model = report.find("field[@name='model']").text
119 | rep_format = eval(report.find("field[@name='out_format']").attrib['search'], {})[0][2]
120 | rep_charset = report.find("field[@name='charset']").text
121 | parser_state = report.find("field[@name='parser_state']").text
122 | styles_mode = report.find("field[@name='styles_mode']").text
123 | tml_source = report.find("field[@name='tml_source']").text
124 |
125 | info += "Name: %s\n" % rep_name
126 | info += "Object: %s\n" % rep_model
127 | info += "Service Name: %s\n" % rep_service
128 | info += "Format: %s\n" % mimetypes.get(rep_format,'oo-odt')
129 | info += "Template: %s\n" % (tml_source=='parser' and 'defined by parser' or 'static')
130 | if rep_format=='genshi-raw':
131 | info += "Charset: %s\n" % rep_charset
132 | info += "Parser: %s\n" % (parser_state in ('def','loc') and 'customized' or 'default')
133 | info += "Stylesheet: %s%s\n" % (styles_select[styles_mode].lower(), style is not None and " (%s)" % style.find("field[@name='name']").text)
134 | self.write(cr, uid, ids, {'name':rep_service,'info':info,'state':'info','file':base64.encodestring(data)}, context=context)
135 | else:
136 | raise osv.except_osv(_('Error!'), _('Is not Aeroo report file.'))
137 |
138 | mod_obj = self.pool.get('ir.model.data')
139 | act_obj = self.pool.get('ir.actions.act_window')
140 |
141 | mod_id = mod_obj.search(cr, uid, [('name', '=', 'action_aeroo_report_import_wizard')])[0]
142 | res_id = mod_obj.read(cr, uid, mod_id, ['res_id'])['res_id']
143 | act_win = act_obj.read(cr, uid, res_id, [])
144 | act_win['domain'] = [('id','in',ids)]
145 | act_win['context'] = {'default_ids':ids}
146 | return act_win
147 |
148 | _defaults = {
149 | 'state': 'draft',
150 | }
151 |
152 |
--------------------------------------------------------------------------------
/report_aeroo_ooo/installer.py:
--------------------------------------------------------------------------------
1 | # -*- encoding: utf-8 -*-
2 | ##############################################################################
3 | #
4 | # Copyright (c) 2008-2012 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
5 | # General contacts
6 | #
7 | # WARNING: This program as such is intended to be used by professional
8 | # programmers who take the whole responsability of assessing all potential
9 | # consequences resulting from its eventual inadequacies and bugs
10 | # End users who are looking for a ready-to-use solution with commercial
11 | # garantees and support are strongly adviced to contract a Free Software
12 | # Service Company
13 | #
14 | # This program is Free Software; you can redistribute it and/or
15 | # modify it under the terms of the GNU General Public License
16 | # as published by the Free Software Foundation; either version 3
17 | # of the License, or (at your option) any later version.
18 | #
19 | # This module is GPLv3 or newer and incompatible
20 | # with OpenERP SA "AGPL + Private Use License"!
21 | #
22 | # This program is distributed in the hope that it will be useful,
23 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | # GNU General Public License for more details.
26 | #
27 | # You should have received a copy of the GNU General Public License
28 | # along with this program; if not, write to the Free Software
29 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 | #
31 | ##############################################################################
32 |
33 | from openerp.osv import fields
34 | from openerp.osv import osv
35 | import openerp.netsvc
36 | import openerp.tools
37 | from xml.dom import minidom
38 | import os, base64
39 | import urllib2
40 | try:
41 | from cStringIO import StringIO
42 | except ImportError:
43 | from StringIO import StringIO
44 | from openerp.tools.translate import _
45 |
46 | _url = 'http://www.alistek.com/aeroo_banner/v7_0_report_aeroo_ooo.png'
47 |
48 | import threading
49 | aeroo_lock = threading.Lock()
50 |
51 | class aeroo_config_installer(osv.osv_memory):
52 | _name = 'aeroo_config.installer'
53 | _inherit = 'res.config.installer'
54 | _rec_name = 'host'
55 | _logo_image = None
56 |
57 | def _get_image(self, cr, uid, context=None):
58 | if self._logo_image:
59 | return self._logo_image
60 | try:
61 | im = urllib2.urlopen(_url.encode("UTF-8"))
62 | if im.headers.maintype!='image':
63 | raise TypeError(im.headers.maintype)
64 | except Exception, e:
65 | path = os.path.join('report_aeroo','config_pixmaps','module_banner.png')
66 | image_file = file_data = openerp.tools.file_open(path,'rb')
67 | try:
68 | file_data = image_file.read()
69 | self._logo_image = base64.encodestring(file_data)
70 | return self._logo_image
71 | finally:
72 | image_file.close()
73 | else:
74 | self._logo_image = base64.encodestring(im.read())
75 | return self._logo_image
76 |
77 | def _get_image_fn(self, cr, uid, ids, name, args, context=None):
78 | image = self._get_image(cr, uid, context)
79 | return dict.fromkeys(ids, image) # ok to use .fromkeys() as the image is same for all
80 |
81 | _columns = {
82 | 'host':fields.char('Host', size=64, required=True),
83 | 'port':fields.integer('Port', required=True),
84 | 'ooo_restart_cmd': fields.char('OOO restart command', size=256, \
85 | help='Enter the shell command that will be executed to restart the LibreOffice/OpenOffice background process.'+ \
86 | 'The command will be executed as the user of the OpenERP server process,'+ \
87 | 'so you may need to prefix it with sudo and configure your sudoers file to have this command executed without password.'),
88 | 'state':fields.selection([
89 | ('init','Init'),
90 | ('error','Error'),
91 | ('done','Done'),
92 |
93 | ],'State', select=True, readonly=True),
94 | 'msg': fields.text('Message', readonly=True),
95 | 'error_details': fields.text('Error Details', readonly=True),
96 | 'link':fields.char('Installation Manual', size=128, help='Installation (Dependencies and Base system setup)', readonly=True),
97 | 'config_logo': fields.function(_get_image_fn, string='Image', type='binary', method=True),
98 |
99 | }
100 |
101 | def default_get(self, cr, uid, fields, context=None):
102 | config_obj = self.pool.get('oo.config')
103 | data = super(aeroo_config_installer, self).default_get(cr, uid, fields, context=context)
104 | ids = config_obj.search(cr, 1, [], context=context)
105 | if ids:
106 | res = config_obj.read(cr, 1, ids[0], context=context)
107 | del res['id']
108 | data.update(res)
109 | return data
110 |
111 | def check(self, cr, uid, ids, context=None):
112 | from DocumentConverter import DocumentConversionException
113 |
114 | config_obj = self.pool.get('oo.config')
115 | data = self.read(cr, uid, ids, ['host','port','ooo_restart_cmd'])[0]
116 | del data['id']
117 | config_id = config_obj.search(cr, 1, [], context=context)
118 | if config_id:
119 | config_obj.write(cr, 1, config_id, data, context=context)
120 | else:
121 | config_id = config_obj.create(cr, 1, data, context=context)
122 |
123 | try:
124 | fp = openerp.tools.file_open('report_aeroo_ooo/test_temp.odt', mode='rb')
125 | file_data = fp.read()
126 | DC = openerp.addons.report_aeroo_ooo.report.OpenOffice_service(cr, data['host'], data['port'])
127 | #DC = openerp.netsvc.Service._services.setdefault('openoffice', OpenOffice_service(cr, data['host'], data['port']))
128 | with aeroo_lock:
129 | DC.putDocument(file_data)
130 | DC.saveByStream()
131 | fp.close()
132 | DC.closeDocument()
133 | del DC
134 | except DocumentConversionException, e:
135 | error_details = str(e)
136 | state = 'error'
137 | except Exception, e:
138 | error_details = str(e)
139 | state = 'error'
140 | else:
141 | error_details = ''
142 | state = 'done'
143 |
144 | if state=='error':
145 | msg = _('Connection to OpenOffice.org instance was not established or convertion to PDF unsuccessful!')
146 | else:
147 | msg = _('Connection to the OpenOffice.org instance was successfully established and PDF convertion is working.')
148 | self.write(cr, uid, ids, {'msg':msg,'error_details':error_details,'state':state})
149 |
150 | mod_obj = self.pool.get('ir.model.data')
151 | act_obj = self.pool.get('ir.actions.act_window')
152 | result = mod_obj.get_object_reference(cr, uid, 'report_aeroo_ooo', 'action_aeroo_config_wizard')
153 | id = result and result[1] or False
154 | result = act_obj.read(cr, uid, id, context=context)
155 | result['res_id'] = ids[0]
156 | return result
157 |
158 | _defaults = {
159 | 'config_logo': _get_image,
160 | 'host':'localhost',
161 | 'port':8100,
162 | 'ooo_restart_cmd': 'sudo /etc/init.d/libreoffice restart',
163 | 'state':'init',
164 | 'link':'http://www.alistek.com/wiki/index.php/Aeroo_Reports_Linux_server#Installation_.28Dependencies_and_Base_system_setup.29',
165 | }
166 |
167 | def _register_hook(self, cr):
168 | check_list = [
169 | 'import uno',
170 | 'import unohelper',
171 | 'from com.sun.star.beans import PropertyValue',
172 | 'from com.sun.star.uno import Exception as UnoException',
173 | 'from com.sun.star.connection import NoConnectException, ConnectionSetupException',
174 | 'from com.sun.star.beans import UnknownPropertyException',
175 | 'from com.sun.star.lang import IllegalArgumentException',
176 | 'from com.sun.star.io import XOutputStream',
177 | 'from com.sun.star.io import IOException',
178 | ]
179 |
180 | from check_deps import check_deps
181 | check_deps(check_list)
182 |
--------------------------------------------------------------------------------
/report_aeroo/wizard/report_print_actions.py:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # Copyright (c) 2008-2013 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
4 | # General contacts
5 | #
6 | # WARNING: This program as such is intended to be used by professional
7 | # programmers who take the whole responsability of assessing all potential
8 | # consequences resulting from its eventual inadequacies and bugs
9 | # End users who are looking for a ready-to-use solution with commercial
10 | # garantees and support are strongly adviced to contract a Free Software
11 | # Service Company
12 | #
13 | # This program is Free Software; you can redistribute it and/or
14 | # modify it under the terms of the GNU General Public License
15 | # as published by the Free Software Foundation; either version 3
16 | # of the License, or (at your option) any later version.
17 | #
18 | # This module is GPLv3 or newer and incompatible
19 | # with OpenERP SA "AGPL + Private Use License"!
20 | #
21 | # This program is distributed in the hope that it will be useful,
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | # GNU General Public License for more details.
25 | #
26 | # You should have received a copy of the GNU General Public License
27 | # along with this program; if not, write to the Free Software
28 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 | #
30 | ##############################################################################
31 |
32 | from openerp.osv import osv
33 | from openerp.osv import fields
34 | from openerp import netsvc
35 |
36 | from openerp.tools.translate import _
37 |
38 | class report_print_actions(osv.osv_memory):
39 | _name = 'aeroo.print_actions'
40 | _description = 'Aeroo reports print wizard'
41 |
42 | def check_report(self, report_name):
43 | if 'report.%s' % report_name not in netsvc.Service._services: # check if report exist in register of reports
44 | raise osv.except_osv(_('System Error !'), _('Report was not registered in system or deactivated !'))
45 | return True
46 |
47 | def _reopen(self, res_id, model):
48 | return {'type': 'ir.actions.act_window',
49 | 'view_mode': 'form',
50 | 'view_type': 'form',
51 | 'res_id': res_id,
52 | 'res_model': self._name,
53 | 'target': 'new',
54 | }
55 |
56 | def check_if_deferred(self, report_xml, print_ids):
57 | extras = report_xml.extras.split(',')
58 | if 'deferred_processing' in extras and report_xml.deferred!='off' and len(print_ids)>=report_xml.deferred_limit:
59 | return True
60 | return False
61 |
62 | def start_deferred(self, cr, uid, ids, context=None):
63 | this = self.browse(cr, uid, ids[0], context=context)
64 | report_xml = self.pool.get('ir.actions.report.xml').browse(cr, uid, context['report_action_id'])
65 | deferred_proc_obj = self.pool.get('deferred_processing.task')
66 | process_id = deferred_proc_obj.create(cr, uid, {'name':report_xml.name}, context=context)
67 | deferred_proc_obj.new_process(cr, uid, process_id, context=context)
68 | deferred_proc_obj.start_process_report(cr, uid, process_id, this.print_ids, context['report_action_id'], context=context)
69 |
70 | mod_obj = self.pool.get('ir.model.data')
71 | act_obj = self.pool.get('ir.actions.act_window')
72 |
73 | mod_id = mod_obj.search(cr, uid, [('name', '=', 'action_deferred_processing_task_deferred_processing')])[0]
74 | res_id = mod_obj.read(cr, uid, mod_id, ['res_id'])['res_id']
75 | act_win = act_obj.read(cr, uid, res_id, ['name','type','view_id','res_model','view_type', \
76 | 'search_view_id','view_mode','target','context'])
77 | act_win['res_id'] = process_id
78 | act_win['view_type'] = 'form'
79 | act_win['view_mode'] = 'form,tree'
80 | return act_win
81 |
82 | def simple_print(self, cr, uid, ids, context):
83 | this = self.browse(cr, uid, ids[0], context=context)
84 | report_xml = self.pool.get('ir.actions.report.xml').browse(cr, uid, context['report_action_id'])
85 | data = {'model':report_xml.model, 'ids':this.print_ids, 'id':context['active_id'], 'report_type': 'aeroo'}
86 | if str(report_xml.out_format.id) != this.out_format:
87 | report_xml.write({'out_format':this.out_format}, context=context)
88 | return {
89 | 'type': 'ir.actions.report.xml',
90 | 'report_name': report_xml.report_name,
91 | 'datas': data,
92 | 'context':context
93 | }
94 |
95 | def to_print(self, cr, uid, ids, context=None):
96 | this = self.browse(cr, uid, ids[0], context=context)
97 | report_xml = self.pool.get('ir.actions.report.xml').browse(cr, uid, context['report_action_id'])
98 | self.check_report(report_xml.report_name)
99 | print_ids = []
100 | if this.copies<=0:
101 | print_ids = this.print_ids
102 | else:
103 | while(this.copies):
104 | print_ids.extend(this.print_ids)
105 | this.copies -= 1
106 | if str(report_xml.out_format.id) != this.out_format:
107 | report_xml.write({'out_format':this.out_format}, context=context)
108 | if self.check_if_deferred(report_xml, print_ids):
109 | this.write({'state':'confirm','message':_("This process may take too long for interactive processing. \
110 | It is advisable to defer the process in background. \
111 | Do you want to start a deferred process?"),'print_ids':print_ids}, context=context)
112 | return self._reopen(this.id, this._model)
113 | ##### Simple print #####
114 | data = {'model':report_xml.model, 'ids':print_ids, 'id':context['active_id'], 'report_type': 'aeroo'}
115 | return {
116 | 'type': 'ir.actions.report.xml',
117 | 'report_name': report_xml.report_name,
118 | 'datas': data,
119 | 'context':context
120 | }
121 |
122 | def _out_format_get(self, cr, uid, context={}):
123 | obj = self.pool.get('report.mimetypes')
124 | report_action_id = context.get('report_action_id',False)
125 | if report_action_id:
126 | in_format = self.pool.get('ir.actions.report.xml').read(cr, uid, report_action_id, ['in_format'])['in_format']
127 | ids = obj.search(cr, uid, [('compatible_types','=',in_format)], context=context)
128 | res = obj.read(cr, uid, ids, ['name'], context)
129 | return [(str(r['id']), r['name']) for r in res]
130 | else:
131 | return []
132 |
133 | _columns = {
134 | 'out_format': fields.selection(_out_format_get, 'Output format', required=True),
135 | 'out_format_code':fields.char('Output format code', size=16, required=False, readonly=True),
136 | 'copies': fields.integer('Number of copies', required=True),
137 | 'message': fields.text('Message'),
138 | 'state':fields.selection([
139 | ('draft','Draft'),
140 | ('confirm','Confirm'),
141 | ('done','Done'),
142 |
143 | ],'State', select=True, readonly=True),
144 | 'print_ids':fields.serialized(),
145 | }
146 |
147 | def onchange_out_format(self, cr, uid, ids, out_format_id):
148 | if not out_format_id:
149 | return {}
150 | out_format = self.pool.get('report.mimetypes').read(cr, uid, int(out_format_id), ['code'])
151 | return { 'value':
152 | {'out_format_code': out_format['code']}
153 | }
154 |
155 | def _get_default_outformat(field):
156 | def get_default_outformat(self, cr, uid, context):
157 | report_action_id = context.get('report_action_id',False)
158 | if report_action_id:
159 | report_xml = self.pool.get('ir.actions.report.xml').browse(cr, uid, report_action_id)
160 | return str(getattr(report_xml.out_format, field))
161 | else:
162 | return False
163 | return get_default_outformat
164 |
165 | def _get_default_number_of_copies(self, cr, uid, context):
166 | report_action_id = context.get('report_action_id',False)
167 | if not report_action_id:
168 | return False
169 | report_xml = self.pool.get('ir.actions.report.xml').browse(cr, uid, context['report_action_id'])
170 | return report_xml.copies
171 |
172 | _defaults = {
173 | 'out_format': _get_default_outformat('id'),
174 | 'out_format_code': _get_default_outformat('code'),
175 | 'copies': _get_default_number_of_copies,
176 | 'state': 'draft',
177 | 'print_ids': lambda self,cr,uid,ctx: ctx.get('active_ids')
178 | }
179 |
180 |
--------------------------------------------------------------------------------
/report_aeroo_ooo/DocumentConverter.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # PyODConverter (Python OpenDocument Converter) v1.0.0 - 2008-05-05
4 | #
5 | # This script converts a document from one office format to another by
6 | # connecting to an OpenOffice.org instance via Python-UNO bridge.
7 | #
8 | # Copyright (C) 2008 Mirko Nasato
9 | # Matthew Holloway
10 | # Alistek Ltd. (www.alistek.com)
11 | # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl-2.1.html
12 | # - or any later version.
13 | #
14 |
15 | DEFAULT_OPENOFFICE_PORT = 8100
16 |
17 | ################## For CSV documents #######################
18 | # Field Separator (1), Text Delimiter (2), Character Set (3), Number of First Line (4)
19 | CSVFilterOptions = "59,34,76,1"
20 | # ASCII code of field separator
21 | # ASCII code of text delimiter
22 | # character set, use 0 for "system character set", 76 seems to be UTF-8
23 | # number of first line (1-based)
24 | # Cell format codes for the different columns (optional)
25 | ############################################################
26 |
27 | from os.path import abspath
28 | from os.path import isfile
29 | from os.path import splitext
30 | import sys
31 | import time
32 | import subprocess
33 | import logging
34 | try:
35 | from cStringIO import StringIO
36 | except ImportError:
37 | from StringIO import StringIO
38 |
39 | try:
40 | import uno
41 | import unohelper
42 | from com.sun.star.beans import PropertyValue
43 | from com.sun.star.uno import Exception as UnoException
44 | from com.sun.star.connection import NoConnectException, ConnectionSetupException
45 | from com.sun.star.beans import UnknownPropertyException
46 | from com.sun.star.lang import IllegalArgumentException
47 | from com.sun.star.io import XOutputStream
48 | from com.sun.star.io import IOException
49 | except ImportError:
50 | logging.exception('Failed to import necessary UNO components', exc_info=True)
51 |
52 | from openerp.tools.translate import _
53 |
54 | logger = logging.getLogger(__name__)
55 |
56 | class DocumentConversionException(Exception):
57 |
58 | def __init__(self, message):
59 | self.message = message
60 |
61 | def __str__(self):
62 | return self.message
63 |
64 | class OutputStreamWrapper(unohelper.Base, XOutputStream):
65 | """ Minimal Implementation of XOutputStream """
66 | def __init__(self, debug=True):
67 | self.debug = debug
68 | self.data = StringIO()
69 | self.position = 0
70 | if self.debug:
71 | sys.stderr.write("__init__ OutputStreamWrapper.\n")
72 |
73 | def writeBytes(self, bytes):
74 | if self.debug:
75 | sys.stderr.write("writeBytes %i bytes.\n" % len(bytes.value))
76 | self.data.write(bytes.value)
77 | self.position += len(bytes.value)
78 |
79 | def close(self):
80 | if self.debug:
81 | sys.stderr.write("Closing output. %i bytes written.\n" % self.position)
82 | self.data.close()
83 |
84 | def flush(self):
85 | if self.debug:
86 | sys.stderr.write("Flushing output.\n")
87 | pass
88 | def closeOutput(self):
89 | if self.debug:
90 | sys.stderr.write("Closing output.\n")
91 | pass
92 |
93 | class DocumentConverter:
94 |
95 | def __init__(self, host='localhost', port=DEFAULT_OPENOFFICE_PORT, ooo_restart_cmd=None):
96 | self._host = host
97 | self._port = port
98 | self._ooo_restart_cmd = ooo_restart_cmd
99 | self.localContext = uno.getComponentContext()
100 | self.serviceManager = self.localContext.ServiceManager
101 | self._resolver = self.serviceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", self.localContext)
102 | try:
103 | self._context = self._resolver.resolve("uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContext" % (host, port))
104 | except IllegalArgumentException, exception:
105 | raise DocumentConversionException("The url is invalid (%s)" % exception)
106 | except NoConnectException, exception:
107 | if self._restart_ooo():
108 | # We try again once
109 | try:
110 | self._context = self._resolver.resolve("uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContext" % (host, port))
111 | except NoConnectException, exception:
112 | raise DocumentConversionException("Failed to connect to OpenOffice.org on host %s, port %s. %s" % (host, port, exception))
113 | else:
114 | raise DocumentConversionException("Failed to connect to OpenOffice.org on host %s, port %s. %s" % (host, port, exception))
115 |
116 | except ConnectionSetupException, exception:
117 | raise DocumentConversionException("Not possible to accept on a local resource (%s)" % exception)
118 |
119 | def putDocument(self, data):
120 | try:
121 | desktop = self._context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", self._context)
122 | except UnknownPropertyException:
123 | self._context = self._resolver.resolve("uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContext" % (self._host, self._port))
124 | desktop = self._context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", self._context)
125 | inputStream = self.serviceManager.createInstanceWithContext("com.sun.star.io.SequenceInputStream", self.localContext)
126 | inputStream.initialize((uno.ByteSequence(data),))
127 | self.document = desktop.loadComponentFromURL('private:stream', "_blank", 0, self._toProperties(InputStream = inputStream))
128 | inputStream.closeInput()
129 |
130 | def closeDocument(self):
131 | self.document.close(True)
132 |
133 | def saveByStream(self, filter_name=None):
134 | try:
135 | self.document.refresh()
136 | except AttributeError, e: # ods document does not support refresh
137 | pass
138 | outputStream = OutputStreamWrapper(False)
139 | try:
140 | self.document.storeToURL('private:stream', self._toProperties(OutputStream = outputStream, FilterName = filter_name, FilterOptions=CSVFilterOptions))
141 | except IOException, e:
142 | print ("IOException during conversion: %s - %s" % (e.ErrCode, e.Message))
143 | outputStream.close()
144 |
145 | openDocumentBytes = outputStream.data.getvalue()
146 | outputStream.close()
147 | return openDocumentBytes
148 |
149 |
150 | def insertSubreports(self, oo_subreports):
151 | """
152 | Inserts the given file into the current document.
153 | The file contents will replace the placeholder text.
154 | """
155 | import os
156 |
157 | for subreport in oo_subreports:
158 | fd = file(subreport, 'rb')
159 | placeholder_text = "" % subreport
160 | subdata = fd.read()
161 | subStream = self.serviceManager.createInstanceWithContext("com.sun.star.io.SequenceInputStream", self.localContext)
162 | subStream.initialize((uno.ByteSequence(subdata),))
163 |
164 | search = self.document.createSearchDescriptor()
165 | search.SearchString = placeholder_text
166 | found = self.document.findFirst( search )
167 | #while found:
168 | try:
169 | found.insertDocumentFromURL('private:stream', self._toProperties(InputStream = subStream, FilterName = "writer8"))
170 | except Exception, ex:
171 | print (_("Error inserting file %s on the OpenOffice document: %s") % (subreport, ex))
172 | #found = self.document.findNext(found, search)
173 |
174 | os.unlink(subreport)
175 |
176 | def joinDocuments(self, docs):
177 | while(docs):
178 | subStream = self.serviceManager.createInstanceWithContext("com.sun.star.io.SequenceInputStream", self.localContext)
179 | subStream.initialize((uno.ByteSequence(docs.pop()),))
180 | try:
181 | self.document.Text.getEnd().insertDocumentFromURL('private:stream', self._toProperties(InputStream = subStream, FilterName = "writer8"))
182 | except Exception, ex:
183 | print (_("Error inserting file %s on the OpenOffice document: %s") % (docs, ex))
184 |
185 | def convertByPath(self, inputFile, outputFile):
186 | inputUrl = self._toFileUrl(inputFile)
187 | outputUrl = self._toFileUrl(outputFile)
188 | document = self.desktop.loadComponentFromURL(inputUrl, "_blank", 8, self._toProperties(Hidden=True))
189 | try:
190 | document.refresh()
191 | except AttributeError:
192 | pass
193 | try:
194 | document.storeToURL(outputUrl, self._toProperties(FilterName="writer_pdf_Export"))
195 | finally:
196 | document.close(True)
197 |
198 | def _toFileUrl(self, path):
199 | return uno.systemPathToFileUrl(abspath(path))
200 |
201 | def _toProperties(self, **args):
202 | props = []
203 | for key in args:
204 | prop = PropertyValue()
205 | prop.Name = key
206 | prop.Value = args[key]
207 | props.append(prop)
208 | return tuple(props)
209 |
210 | def _restart_ooo(self):
211 | if not self._ooo_restart_cmd:
212 | logger.warning('No LibreOffice/OpenOffice restart script configured')
213 | return False
214 | logger.info('Restarting LibreOffice/OpenOffice background process')
215 | try:
216 | logger.info('Executing restart script "%s"' % self._ooo_restart_cmd)
217 | retcode = subprocess.call(self._ooo_restart_cmd, shell=True)
218 | if retcode == 0:
219 | logger.warning('Restart successfull')
220 | time.sleep(4) # Let some time for LibO/OOO to be fully started
221 | else:
222 | logger.error('Restart script failed with return code %d' % retcode)
223 | except OSError, e:
224 | logger.error('Failed to execute the restart script. OS error: %s' % e)
225 | return True
226 |
227 |
--------------------------------------------------------------------------------