setup mit report setup, ändern auf ubuntu trusty

develop
Andreas Brückl 2016-01-05 15:13:11 +01:00
parent d73c53cb3e
commit a1d621ee8a
5 changed files with 46 additions and 17 deletions

View File

@ -87,6 +87,7 @@ def main():
'delete_mail_server', 'delete_mail_server',
'update_values', 'update_values',
'set_sys_params', 'set_sys_params',
'setup_reports',
] ]
if cmd == 'rollout': if cmd == 'rollout':

View File

@ -209,6 +209,22 @@ class Config():
#'sale_order_reminder', #'sale_order_reminder',
] ]
# Setzen das Feld "Attachment" im Report (wenn gesetzt, wird das PDF in den Anhängen gespeichert)
timestamp = " + '_' + time.strftime('%Y-%m-%d-%H%M') + '.pdf')"
self.reports = {
'sale.report_saleorder': "((object.state in ('draft','sent') and 'KV_' or 'AB_') + object.name" + timestamp,
'cam_reports.report_saleorder_ohne': "((object.state in ('draft','sent') and 'KV_' or 'AB_') + object.name" + timestamp,
'cam_reports.report_porto_anforderung': "('PV_' + object.name " + timestamp,
'cam_reports.report_porto_anforderung_ohne': "('PV_' + object.name " + timestamp,
'account.report_invoice': "(object.state in ('open','paid')) and ('RE_'+(object.number or '').replace('/','')" + timestamp,
'cam_reports.report_invoices_ohne': "(object.state in ('open','paid')) and ('RE_'+(object.number or '').replace('/','')" + timestamp,
'cam_reports.report_porto_rechnung': "(object.state in ('open','paid')) and ('RE_'+(object.number or '').replace('/','')" + timestamp,
'cam_reports.report_porto_rechnung_ohne': "(object.state in ('open','paid')) and ('RE_'+(object.number or '').replace('/','')" + timestamp,
'purchase.report_purchasequotation': "('AN_' + object.name" + timestamp,
'purchase.report_purchaseorder': "('B_' + object.name" + timestamp,
'cam_reports.report_purchaseorder_ohne': "('B_' + object.name" + timestamp,
}
self.users_file = "res.users.csv" self.users_file = "res.users.csv"
self.translation_files = [ self.translation_files = [

View File

@ -670,3 +670,14 @@ class CamadeusFunctions():
else: else:
self._execute('ir.config_parameter', 'create', vals) self._execute('ir.config_parameter', 'create', vals)
return True return True
def setup_reports(self):
"""Berichte konfigurieren"""
for report, attachment in self.config.reports.items():
r_ids = self._execute('ir.actions.report.xml', 'search', [('report_name','=',report)])
if r_ids:
self._execute('ir.actions.report.xml', 'write', r_ids, {'attachment': attachment})
else:
return False
return True

View File

@ -64,6 +64,7 @@ class odoo {
'bzr', 'bzr',
'git', 'git',
'nginx', 'nginx',
'ntp',
'poppler-utils', 'poppler-utils',
'postgresql', 'postgresql',
'python-dateutil', 'python-dateutil',
@ -99,7 +100,7 @@ class odoo {
'python-simplejson', 'python-simplejson',
'python-tz', 'python-tz',
'python-unittest2', 'python-unittest2',
'python-vatnumber', #'python-vatnumber',
'python-vobject', 'python-vobject',
'python-webdav', 'python-webdav',
'python-werkzeug', 'python-werkzeug',
@ -115,25 +116,25 @@ class odoo {
} }
# file { 'wkhtmltox-0.12.2.1_linux-wheezy-amd64.deb': file { 'wkhtmltox':
# name => "/tmp/wkhtmltox-0.12.2.1_linux-wheezy-amd64.deb", name => "/tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb",
# owner => root, owner => root,
# group => root, group => root,
# source => "puppet:///modules/odoo/wkhtmltox-0.12.2.1_linux-wheezy-amd64.deb" source => "puppet:///modules/odoo/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb"
# } }
# package { 'wkhtmltox': package { 'wkhtmltox':
# provider => dpkg, provider => dpkg,
# ensure => installed, ensure => installed,
# source => "/tmp/wkhtmltox-0.12.2.1_linux-wheezy-amd64.deb", source => "/tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb",
# require => [File['wkhtmltox-0.12.2.1_linux-wheezy-amd64.deb'],Package['xfonts-base']], require => [File['wkhtmltopdf'],Package['xfonts-base']],
# } }
package {['passlib', package {['passlib',
'psycogreen', 'psycogreen',
'gdata', 'gdata',
'requests', 'requests',
'setproctitle', 'vatnumber',
]: ]:
ensure => installed, ensure => installed,
provider => 'pip', provider => 'pip',
@ -183,7 +184,7 @@ class odoo {
mode => '0600', mode => '0600',
ensure => present, ensure => present,
content => template('odoo/default.nginx.erb'), content => template('odoo/default.nginx.erb'),
notify => Package['nginx'], notify => Service['nginx'],
} }
# NGINX SSL # NGINX SSL
@ -390,7 +391,7 @@ git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout -
postgresql::server::role { "$instance": postgresql::server::role { "$instance":
password_hash => postgresql_password($instance, $db_pw), password_hash => postgresql_password($instance, $db_pw),
createdb => true, createdb => true,
require => Exec['utf8 postgres'], # require => Exec['utf8 postgres'],
} }
# NGINX # NGINX