Merge branch 'develop'

develop
Ahmed Aly 2018-10-08 13:51:08 +02:00
commit 61b34b803e
31 changed files with 501 additions and 158 deletions

View File

@ -6,11 +6,11 @@ from odoo.exceptions import UserError
class SaleOrder(models.Model):
_inherit = "sale.order"
global_discount = fields.Boolean("Add Global Discount", readonly=True, states={'draft': [('readonly', False)]},)
global_discount = fields.Boolean("Add Global Discount", readonly=True, states={'draft': [('readonly', False),],'sent': [('readonly', False)]},)
discount_type = fields.Selection([('fixed','Fixed'),('percentage','Percentage')],
"Discount Type", readonly=True, states={'draft': [('readonly', False)]}, default='fixed')
discount_amount = fields.Float("Discount Amount", readonly=True, states={'draft': [('readonly', False)]},)
discount_percentage = fields.Float("Discount Percentage", readonly=True, states={'draft': [('readonly', False)]},)
"Discount Type", readonly=True, states={'draft': [('readonly', False)],'sent': [('readonly', False)]}, default='percentage')
discount_amount = fields.Float("Discount Amount", readonly=True, states={'draft': [('readonly', False)],'sent': [('readonly', False)]},)
discount_percentage = fields.Float("Discount Percentage", readonly=True, states={'draft': [('readonly', False)],'sent': [('readonly', False)]},)
@api.multi
def _discount_unset(self):

View File

@ -9,14 +9,14 @@
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='payment_term_id']" position="after">
<label for="global_discount"/>
<label for="global_discount" attrs="{'invisible': [('state','!=', 'draft'),('state','!=', 'sent')]}"/>
<div name='global_discount'>
<div>
<field name='global_discount' class="oe_inline" nolabel="1" attrs="{'invisible': [('state','!=', 'draft')]}"/>
<field name='discount_type' class="oe_inline" nolabel="1" attrs="{'invisible': ['|',('global_discount','=', False), ('state','!=', 'draft')], 'required':[('global_discount','!=', False)]}"/>
<field name='discount_amount' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False), ('state','!=', 'draft'),('discount_type','!=','fixed')]}"/>
<field name='discount_percentage' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False), ('state','!=', 'draft'),('discount_type','!=','percentage')]}"/>
<button name="create_discount" string="Add Line" type="object" class="oe_inline fa fa-arrow-right oe_link" attrs="{'invisible': ['|',('global_discount','=', False), ('state','!=', 'draft')]}"/>
<field name='global_discount' class="oe_inline" nolabel="1" attrs="{'invisible': [('state','!=', 'draft'),('state','!=', 'sent')]}"/>
<field name='discount_type' class="oe_inline" nolabel="1" attrs="{'invisible': ['|',('global_discount','=', False),'&amp;', ('state','!=', 'draft'),('state','!=', 'sent')], 'required':[('global_discount','!=', False)]}"/>
<field name='discount_amount' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False),('discount_type','!=','fixed'),'&amp;', ('state','!=', 'draft'),('state','!=', 'sent')]}"/>
<field name='discount_percentage' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False),('discount_type','!=','percentage'),'&amp;', ('state','!=', 'draft'),('state','!=', 'sent')]}"/>
<button name="create_discount" string="Add Line" type="object" class="oe_inline fa fa-arrow-right oe_link oe_edit_only" attrs="{'invisible': ['|',('state','not in', ['draft','sent']),('global_discount','=', False)]}"/>
</div>
</div>
</xpath>

View File

@ -46,7 +46,7 @@ class ResConfigSettings(models.TransientModel):
def set_values(self):
super(ResConfigSettings, self).set_values()
IrDefault = self.env['ir.default'].sudo()
IrDefault.set('res.config.settings', "wk_favicon", self.wk_favicon.decode("utf-8"))
IrDefault.set('res.config.settings', "wk_favicon", self.wk_favicon.decode("utf-8") if self.wk_favicon else False)
IrDefault.set('res.config.settings', "title_brand", self.title_brand)
IrDefault.set('res.config.settings', "odoo_text_replacement", self.odoo_text_replacement)
@ -62,4 +62,4 @@ class ResConfigSettings(models.TransientModel):
title_brand = title_brand,
odoo_text_replacement = odoo_text_replacement,
)
return res
return res

View File

@ -49,11 +49,9 @@
'wizards/wizard_confirm_print_invoice.xml',
'security/security.xml',
'data/dp_custom_data.xml',
'data/glaser_company_data.xml',
'data/tz_austria_company_data.xml',
'data/product_data.xml',
'data/tz_tax_data.xml',
'data/glaser_tax_data.xml',
'data/cron_job.xml',
'views/dp_custom_views.xml',
'views/res_line_views.xml',

View File

@ -14,17 +14,4 @@
</field>
</record>
<record id="cron_export_portal_prices_glaser" forcecreate='True' model="ir.cron">
<field name="name">Export Portal Prices Glaser</field>
<field eval="False" name="active"/>
<field name="nextcall" eval="DateTime(2017,1,1,1,0,0)" />
<field name="user_id" ref="dp_custom.glaser_admin_user"/>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="state">code</field>
<field name="code">model.cron_export_portal_prices()
</field>
</record>
</odoo>

View File

@ -18,12 +18,6 @@
(4,ref('dp_custom.group_allow_delete_so_attachments'))]"/>
</record>
<record id="base.main_company" model="res.company">
<field name="admin_user_id" eval="ref('tz_admin_user')"/>
<field name="inter_company_supplier_id" eval="ref('dp_custom.glaser_and_co_company')"/>
<field name="percentage_billing">70.00</field>
</record>
<function id="set_company_customer" model="res.company" name="set_company_customer">
<value eval="[ref('base.main_company')]"/>
</function>

View File

@ -62,8 +62,8 @@ class AccountInvoiceLine(models.Model):
self.env['stock.production.lot'].browse([lot_id.id]).write({
'intrastat_id': vals.get('intrastat_id')
})
elif vals.get('intrastat_id', False) and not lot_id:
raise UserError(_('Der Intrastrat Code kann nur gesetzt werden wenn ein Lot angegeben wurde.'))
# elif vals.get('intrastat_id', False) and not lot_id:
# raise UserError(_('Der Intrastrat Code kann nur gesetzt werden wenn ein Lot angegeben wurde.'))
return res

View File

@ -29,7 +29,7 @@ class ProductXCategory(models.Model):
_description = 'X-Kategorie'
_order = 'name'
name = fields.Char(string='Bezaichnung', required=True)
name = fields.Char(string='Bezeichnung', required=True)
_sql_constraints = [
('name_uniq', 'unique(name)', 'Die Bezeichnung muss eindeutig sein')

View File

@ -66,6 +66,14 @@ class SaleOrder(models.Model):
pg9_call_D = fields.Char(string='PG9-Auftrag_D', compute='_pg9_call', store=False)
pg9_call_T = fields.Char(string='PG9-Auftrag_T', compute='_pg9_call', store=False)
@api.multi
def _reset_sequence(self):
for rec in self:
current_sequence = 1
for line in rec.order_line:
line.sequence = current_sequence
current_sequence += 1
@api.multi
def _pg9_call(self):
for record in self:
@ -347,6 +355,8 @@ class SaleOrder(models.Model):
if vals.get('message_post',False):
self.message_post(body=vals.get('message_post'))
self._reset_sequence()
return res
@api.multi
@ -493,6 +503,23 @@ class SaleOrderLine(models.Model):
product_id = fields.Many2one(domain=_get_product_id_domain)
weight = fields.Float(string='Gewicht', compute='_compute_weight')
intrastat_id = fields.Many2one(comodel_name='report.intrastat.code', string='Intrastat Code')
sequence = fields.Integer(string='Sequence', default=9999)
@api.multi
@api.onchange('product_id')
def product_id_change(self):
result = super(SaleOrderLine,self).product_id_change()
product = self.product_id.with_context(
lang=self.order_id.partner_id.lang,
partner=self.order_id.partner_id.id
)
name = product.name
if product.description_sale:
name = product.description_sale
self.name = name
return result
@api.model
def create(self, vals):

View File

@ -74,6 +74,7 @@
<field name="city"/>
<field name="ref"/>
<field name="portal_id" string="PID"/>
<field name="type"/>
</field>
<field name="email" position="replace">
<field name="email" invisible="1"/>

View File

@ -29,8 +29,12 @@
<field name="pg9_call_T" widget="url" text="...gehe zu Auftrag in PG9"
attrs="{'invisible': ['|','|',('order_type','!=', 'T'),('assembly_state','not in',['wait','started','done','packed','delivered'])]}"/>
</field>
<field name="note" position="before">
<label for="weight_total">Gesamtgewicht: </label>
<field name="weight_total"/>
<div class="oe_clear"/>
</field>
<field name="note" position="after">
<separator/>
<group name="internal_notes" string="Notizen">
<field name="internal_notes"/>
</group>

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# datenpol gmbh
# Copyright (C) 2013-TODAY datenpol gmbh (<http://www.datenpol.at/>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

View File

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# datenpol gmbh
# Copyright (C) 2013-TODAY datenpol gmbh (<http://www.datenpol.at/>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# noinspection PyStatementEffect
{
'name': 'Unternehmen Glaser Daten',
'category': 'Custom',
'version': '11.0.1.0.0',
'description': """Fügt alle Daten für das Unternehmen Glaser & Co hinzu""",
'author': 'datenpol gmbh',
'website': 'http://www.datenpol.at/',
'depends': [
'base',
'account',
'sale_stock',
'queue_job',
'website',
'dp_custom'
],
'data': [
'data/glaser_company_data.xml',
'data/glaser_tax_data.xml',
'data/cron_job.xml',
],
'installable': True,
'auto_install': False,
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo noupdate="1">
<record id="dp_custom.cron_export_portal_prices_glaser" forcecreate='True' model="ir.cron">
<field name="name">Export Portal Prices Glaser</field>
<field eval="False" name="active"/>
<field name="nextcall" eval="DateTime(2017,1,1,1,0,0)" />
<field name="user_id" ref="dp_custom.glaser_admin_user"/>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="state">code</field>
<field name="code">model.cron_export_portal_prices()
</field>
</record>
</odoo>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">
<record id="glaser_and_co_company" model="res.company">
<record id="dp_custom.glaser_and_co_company" model="res.company">
<field name="name">Glaser &amp; Co.</field>
<field name="street">Neugasse 36</field>
<field name="city">Spannberg</field>
@ -15,21 +15,21 @@
<field name="vat_check_vies" eval="False"/>
</record>
<function id="set_company_supplier" model="res.company" name="set_company_supplier">
<value eval="[ref('glaser_and_co_company')]"/>
<function id="dp_custom.set_company_supplier" model="res.company" name="set_company_supplier">
<value eval="[ref('dp_custom.glaser_and_co_company')]"/>
</function>
<function id="set_company_logo" model="res.company" name="set_company_logo">
<value eval="[ref('glaser_and_co_company')]"/>
<function id="dp_custom.set_company_logo" model="res.company" name="set_company_logo">
<value eval="[ref('dp_custom.glaser_and_co_company')]"/>
<value>../static/src/img/logo_glaser.png</value>
</function>
<record id="glaser_admin_user" model="res.users">
<record id="dp_custom.glaser_admin_user" model="res.users">
<field name="lastname">Glaser &amp; Co. ADMIN</field>
<field name="login">glaser-admin</field>
<field name="email">admin@glaser.at</field>
<field name="company_id" eval="ref('glaser_and_co_company')"/>
<field name="company_ids" eval="[(6, 0, [ref('glaser_and_co_company')])]"/>
<field name="company_id" eval="ref('dp_custom.glaser_and_co_company')"/>
<field name="company_ids" eval="[(6, 0, [ref('dp_custom.glaser_and_co_company')])]"/>
<field name="groups_id"
eval="[(4,ref('account.group_account_manager')),
(4,ref('sales_team.group_sale_manager')),
@ -42,15 +42,21 @@
(4,ref('dp_custom.group_allow_delete_so_attachments'))]"/>
</record>
<record id="glaser_and_co_company" model="res.company">
<field name="admin_user_id" eval="ref('glaser_admin_user')"/>
<record id="dp_custom.glaser_and_co_company" model="res.company">
<field name="admin_user_id" eval="ref('dp_custom.glaser_admin_user')"/>
</record>
<record id="base.main_company" model="res.company">
<field name="admin_user_id" eval="ref('dp_custom.tz_admin_user')"/>
<field name="inter_company_supplier_id" eval="ref('dp_custom.glaser_and_co_company')"/>
<field name="percentage_billing">70.00</field>
</record>
<!--<function-->
<!--id="set_company_favicon"-->
<!--id="dp_custom.set_company_favicon"-->
<!--model="res.company"-->
<!--name="set_company_favicon"-->
<!--eval="[ref('glaser_and_co_company')]">-->
<!--eval="[ref('dp_custom.glaser_and_co_company')]">-->
<!--<value>../static/src/img/favicon_glaser.png</value>-->
<!--</function>-->

View File

@ -1,80 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">
<record id="glaser_account_tax_20_mwst" model="account.tax">
<record id="dp_custom.glaser_account_tax_20_mwst" model="account.tax">
<field name="name">20% MwSt.</field>
<field name="description">20% MwSt.</field>
<field name="type_tax_use">sale</field>
<field name="amount_type">percent</field>
<field name="amount">20</field>
<field name="bmd_tax_code">1</field>
<field name="company_id" eval="ref('glaser_and_co_company')"/>
<field name="company_id" eval="ref('dp_custom.glaser_and_co_company')"/>
</record>
<record id="glaser_account_tax_10_mwst" model="account.tax">
<record id="dp_custom.glaser_account_tax_10_mwst" model="account.tax">
<field name="name">10% MwSt.</field>
<field name="description">10% MwSt.</field>
<field name="type_tax_use">sale</field>
<field name="amount_type">percent</field>
<field name="amount">10</field>
<field name="bmd_tax_code">1</field>
<field name="company_id" eval="ref('glaser_and_co_company')"/>
<field name="company_id" eval="ref('dp_custom.glaser_and_co_company')"/>
</record>
<record id="glaser_account_tax_0_mwst" model="account.tax">
<record id="dp_custom.glaser_account_tax_0_mwst" model="account.tax">
<field name="name">0% MwSt.</field>
<field name="description">0% MwSt.</field>
<field name="type_tax_use">sale</field>
<field name="amount_type">percent</field>
<field name="amount">0</field>
<field name="bmd_tax_code">1</field>
<field name="company_id" eval="ref('glaser_and_co_company')"/>
<field name="company_id" eval="ref('dp_custom.glaser_and_co_company')"/>
</record>
<record id="glaser_account_tax_0_reverse_charge" model="account.tax">
<record id="dp_custom.glaser_account_tax_0_reverse_charge" model="account.tax">
<field name="name">0% Reverse Charge</field>
<field name="description">0% Rev. Chg.</field>
<field name="type_tax_use">sale</field>
<field name="amount_type">percent</field>
<field name="amount">0</field>
<field name="bmd_tax_code">7</field>
<field name="company_id" eval="ref('glaser_and_co_company')"/>
<field name="company_id" eval="ref('dp_custom.glaser_and_co_company')"/>
</record>
<record id="glaser_account_tax_0_drittland" model="account.tax">
<record id="dp_custom.glaser_account_tax_0_drittland" model="account.tax">
<field name="name">0% Drittland</field>
<field name="description">0% Drittland</field>
<field name="type_tax_use">sale</field>
<field name="amount_type">percent</field>
<field name="amount">0</field>
<field name="bmd_tax_code">5</field>
<field name="company_id" eval="ref('glaser_and_co_company')"/>
<field name="company_id" eval="ref('dp_custom.glaser_and_co_company')"/>
</record>
<record id="glaser_account_fiscal_position_ig_ausland" model="account.fiscal.position">
<record id="dp_custom.glaser_account_fiscal_position_ig_ausland" model="account.fiscal.position">
<field name="name">IG-Ausland</field>
<field name="note">Übergang der Steuerschuld auf den Leistungsempfänger gem § 19 Abs 1
UStG
</field>
<field name="company_id" eval="ref('glaser_and_co_company')"/>
<field name="company_id" eval="ref('dp_custom.glaser_and_co_company')"/>
</record>
<record id="glaser_account_fiscal_position_tax_ig_ausland" model="account.fiscal.position.tax">
<record id="dp_custom.glaser_account_fiscal_position_tax_ig_ausland" model="account.fiscal.position.tax">
<field name="tax_src_id" search="[('name','=','20% MwSt.')]"/>
<field name="tax_dest_id" search="[('name','=','0% Reverse Charge')]"/>
<field name="position_id" ref="glaser_account_fiscal_position_ig_ausland"/>
<field name="position_id" ref="dp_custom.glaser_account_fiscal_position_ig_ausland"/>
</record>
<record id="glaser_account_fiscal_position_drittland" model="account.fiscal.position">
<record id="dp_custom.glaser_account_fiscal_position_drittland" model="account.fiscal.position">
<field name="name">Drittland</field>
<field name="note"/>
<field name="company_id" eval="ref('glaser_and_co_company')"/>
<field name="company_id" eval="ref('dp_custom.glaser_and_co_company')"/>
</record>
<record id="glaser_account_fiscal_position_tax_drittland" model="account.fiscal.position.tax">
<record id="dp_custom.glaser_account_fiscal_position_tax_drittland" model="account.fiscal.position.tax">
<field name="tax_src_id" search="[('name','=','20% MwSt.')]"/>
<field name="tax_dest_id" search="[('name','=','0% Drittland')]"/>
<field name="position_id" ref="glaser_account_fiscal_position_drittland"/>
<field name="position_id" ref="dp_custom.glaser_account_fiscal_position_drittland"/>
</record>
</odoo>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1,7 +1,7 @@
# Copyright 2018-Today datenpol gmbh (<http://www.datenpol.at>)
# License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses).
from odoo import api, models
from odoo import api, fields, models
class AccountInvoice(models.Model):
@ -28,3 +28,47 @@ class AccountInvoice(models.Model):
if sale_order:
category['order_id'] = sale_order
return res
class AccountInvoiceLine(models.Model):
_inherit = "account.invoice.line"
order_line_ids = fields.Many2many(
comodel_name='sale.order.line',
relation='sale_order_line_invoice_rel',
column1='invoice_line_id',
column2='order_line_id',
string='Order Lines',
readonly=True,
)
prod_lot_ids = fields.Many2many(
comodel_name='stock.production.lot',
compute='_compute_prod_lots',
string="Production Lots",
)
lot_formatted_note = fields.Html(
string='Formatted Note',
compute='_compute_line_lots',
)
@api.multi
def _compute_prod_lots(self):
for line in self:
if not line.order_line_ids:
return
line.prod_lot_ids = self.mapped(
'order_line_ids.move_ids.move_line_ids.lot_id')
print('End')
@api.multi
def _compute_line_lots(self):
for line in self:
if line.prod_lot_ids:
note = u'<ul>'
note += u' '.join([
u'<li>S/N {0}</li>'.format(lot.name)
for lot in line.prod_lot_ids
])
note += u'</ul>'
line.lot_formatted_note = note

View File

@ -85,6 +85,8 @@
<t t-foreach="o.order_lines_layouted()" t-as="page" name="lines_layouted">
<table class="table table-condensed">
<t t-set="discount_is_set" t-value="field_set_in_lines(o.invoice_line_ids, 'discount')"/>
<t t-set="has_serial_number" t-value="o.invoice_line_ids.mapped('prod_lot_ids')"
groups="stock.group_production_lot"/>
<thead class="table-header">
<tr>
<th class="text-center">Pos.</th>
@ -183,6 +185,13 @@
<br/>
</span>
<span t-field="invoice_line.name"/>
<span t-if="invoice_line.product_id.tracking=='serial'">
<br/>
<strong>Serien Nr.:</strong>
<t t-if="has_serial_number">
<span t-field="invoice_line.lot_formatted_note" />
</t>
</span>
<p t-if="invoice_line.lot_id.notes">
<span t-field="invoice_line.lot_id.notes"/>
</p>

5
setup/connect-allinonept.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
PORT=9002
echo "Zugriff: http://localhost:$PORT"
ssh -p 3336 odoo-prod@5.9.67.35 -L $PORT:localhost:8069

View File

@ -126,6 +126,7 @@ def main():
'set_company',
'enable_res_config_for_company', # muss bei multicompany ausgefuehrt werden
'set_multicompany_data', # set_multicompany_data
'set_multicompany_admin_user',
'set_uom',
'set_taxes',
'set_fiscal_position',

View File

@ -47,7 +47,7 @@ class Config(object):
self.settings = {
# Einstellungen Allgemein
'auth_signup_reset_passwort': True,
# 'auth_signup_reset_passwort': True,
'group_multi_company': True,
# Einstellungen Verkauf
@ -92,6 +92,8 @@ class Config(object):
'module_mrp_byproduct': False,
'use_manufacturing_lead': False,
'manufacturing_lead': 0,
'external_report_layout': 'custom'
}
self.removal_strategy = 'fifo' # [fifo], [lifo], [fefo]
@ -127,7 +129,6 @@ class Config(object):
'dp_reports_account',
'dp_reports_purchase',
'dp_reports_stock',
# 'dp_reports_stock',
'account_cancel',
'stock',
'dp_changelogs',

View File

@ -0,0 +1,136 @@
# -*- coding: utf-8 -*-
from .config import Config
class ConfigAllInOnePT(Config):
def __init__(self):
super(ConfigAllInOnePT, self).__init__()
self.company_xmlid = 'base.main_company'
self.company_data = {
'name': 'TZ Technik Solution GesmbH',
'street': 'Althöflein 9/2',
'street2': False,
'city': 'Großkrut',
'zip': '2143',
'phone': False,
'email': False,
'website': False,
'company_registry': '405457k',
'country_id': 'at', # 'de' für Deutschland
'vat': False,
'vat_check_vies': True,
'logo': '../ext/custom-addons/dp_custom/static/src/img/logo.png',
# 'favicon_backend': '../ext/custom-addons/dp_custom/static/src/img/favicon.ico',
# 'favicon_backend_mimetype': 'image/x-icon'
}
self.multi_company_admin = {
'id': "ref('dp_custom.tz_admin_user')",
'lastname': 'TZ Technik ADMIN',
'login': 'tz-admin',
'company_id': "ref('base.main_company')",
'company_ids': ["ref('base.main_company')"],
'email': 'admin@tz-austria.at'
}
# Nur für Lager
# Wenn nicht gesetzt, dann wird der Firmenname genommen
self.warehouse_name = 'TZ Technik'
self.warehouse_code = 'TZ Technik'
self.tax_settings = {
'default_sale_tax_id': self.default_sales_tax
}
self.sequences = {
'sale.order': {
# 'number_next_actual': 1,
'prefix': 'ATOF%(range_y)s-',
'padding': 6,
'use_date_range': True,
'monthly_date_range': False
},
'account.invoice': {
# 'number_next_actual': 0001,
'prefix': '%(range_year)s-',
'padding': 6,
'use_date_range': True,
},
# Wenn 'account.invoice_refund' auskommentiert ist, dann wird
# für die Gutschrift der selbe Nummernkreis verwendet
# 'account.invoice_refund': {
# # 'number_next_actual': 0001,
# 'name': 'Gutschriften',
# 'implementation': 'no_gap',
# 'prefix': 'GL%(y)s',
# 'padding': 4,
# 'use_date_range': True,
# 'monthly_date_range': False
# },
# 'picking.out': {
# # 'number_next_actual': 1,
# 'prefix': 'LS-',
# 'padding': 5,
# },
# 'picking.in': {
# #'number_next_actual': 1,
# 'prefix': 'LS/IN/',
# 'padding': 4,
# },
# 'picking.int': {
# #'number_next_actual': 1,
# 'prefix': 'LS/INT/',
# 'padding': 4,
# },
# 'purchase.order': {
# 'number_next_actual': 1,
# 'prefix': 'B-',
# 'padding': 5,
# },
}
self.modules.extend([
'mrp',
'hr',
'board',
'mass_mailing'
'crm',
'crm_project',
'crm_livechat',
'sale_crm',
'wk_debrand_odoo',
'mobikul'
])
self.modules.extend([
'mrp',
'hr',
'board',
'mass_mailing'
'crm',
'crm_project',
'crm_livechat',
'sale_crm',
'wk_debrand_odoo',
'mobikul'
])
self.multi_website_modules.extend([
'website_customer_group',
'website_blog',
'website_crm',
'website_mass_mailing',
'website_hr',
])
self.websites = [
{
'name': 'Prosolutions Online',
'domain': 'www.prosolutions.online',
'company_xml_id': 'base.main_company'
},
]

View File

@ -89,3 +89,16 @@ class ConfigTZA(Config):
# 'padding': 5,
# },
}
self.websites = [
{
'name': 'IR Heizpaneele',
'domain': 'www.irheizpaneele.at',
'company_xml_id': 'base.main_company'
},
{
'name': 'Heizpaneele',
'domain': 'www.heizpaneele.at',
'company_xml_id': 'base.main_company'
},
]

View File

@ -2,6 +2,7 @@
from .config_tza import ConfigTZA
from .config_glaser import ConfigGlaser
from .config_allinonept import ConfigAllInOnePT
class Environment():
def __init__(self, host, port, dbname, username, pwd=None, super_admin_pw=None, demo=False, config=False):
@ -41,6 +42,7 @@ ENVIRONMENTS = {
'br-glaser' : Environment('http://localhost', '8080', 'tz-austria_1', 'glaser-admin', 'x', 'admin', config = ConfigGlaser()),
'aa' : Environment('http://localhost', '8080', 'tz-austria_1', 'admin', 'x', 'admin', config = ConfigTZA()),
'aa-allinonept': Environment('http://localhost', '8080', 'tz-austria_allinonept', 'admin', 'x', 'admin', config = ConfigAllInOnePT()),
'aa-tz' : Environment('http://localhost', '8080', 'tz-austria_1', 'tz-admin', 'x', 'admin', config = ConfigTZA()),
'aa-glaser' : Environment('http://localhost', '8080', 'tz-austria_1', 'glaser-admin', 'x', 'admin', config = ConfigGlaser()),
@ -66,4 +68,6 @@ ENVIRONMENTS = {
'prod': Environment('http://localhost', '9002', 'odoo-prod', 'admin', config = ConfigTZA()),
'prod-glaser': Environment('http://localhost', '9002', 'odoo-prod', 'glaser-admin', config = ConfigGlaser()),
'allinonept': Environment('http://localhost', '9002', 'allinonept', 'admin', config=ConfigAllInOnePT()),
}

View File

@ -155,7 +155,6 @@ class DatenpolFunctions(object):
def enable_res_config_for_company(self):
"""Setze beim portal_template_user die Company als zulässiges Unternehmen"""
portal_template_user = self.odoo.env.ref('auth_signup.default_template_user')
vals = {}
companies = self.odoo.env['res.company'].search([])
vals_company = []
for company in companies:
@ -183,6 +182,36 @@ class DatenpolFunctions(object):
return res_settings.browse(wizard_id).execute()
return True
def set_multicompany_admin_user(self):
"""Multicompany User erstellen oder """
admin_user_data = self.config.multi_company_admin
if not admin_user_data:
return True
user_obj = self.odoo.env['res.users']
for key, value in admin_user_data.items():
if type(value) is str:
if value.startswith("ref('") and value.endswith("')"):
xml_id = value.replace("ref('", "").replace("')", "")
admin_user_data[key] = self.odoo.env.ref(xml_id).id
if type(value) is list:
for idx, rec in enumerate(value):
if rec.startswith("ref('") and rec.endswith("')"):
xml_id = rec.replace("ref('", "").replace("')", "")
admin_user_data[key][idx] = self.odoo.env.ref(xml_id).id
if admin_user_data.get('id'):
user_id = admin_user_data['id']
del admin_user_data['id']
user_obj.browse(user_id).write(admin_user_data)
else:
if 'id' in admin_user_data.keys():
del admin_user_data['id']
vals = user_obj.default_get([])
vals.update(admin_user_data)
user_obj.create(vals)
return True
def load_languages(self):
"""Lade zusätzliche Sprachen"""
@ -264,79 +293,48 @@ class DatenpolFunctions(object):
ir_model_obj = self.odoo.env['ir.model.data']
crm_team_obj = self.odoo.env['crm.team']
# if not ir_model_obj.search([('module', '=', 'website_multi_theme'), ('name', '=', 'clarico_multi')]):
# # Create Theme
# clarico_theme = self.odoo.env['website.theme'].create({
# 'name': 'Multiwebsite Clarico Theme',
# 'converted_theme_addon': 'theme_clarico'
# })
#
# vals = {
# 'model': 'website.theme',
# 'module': 'website_multi_theme',
# 'name': 'clarico_multi',
# 'res_id': str(clarico_theme),
# 'noupdate': False,
# }
# ir_model_obj.create(vals)
#
# clarico_theme = self.odoo.env.ref('website_multi_theme.clarico_multi')
websites = self.config.websites
# self.odoo.env.ref('website.default_website').multi_theme_reload()
# create salesteam
for idx, website in enumerate(websites):
cr_team = crm_team_obj.search([('name', '=', website['name'])])
if not cr_team:
crm_team_vals = {
'name': website['name'],
'team_type': 'website',
'company_id': self.odoo.env.ref(website['company_xml_id']).id,
}
cr_team = crm_team_obj.browse([crm_team_obj.create(crm_team_vals)])
else:
cr_team = crm_team_obj.browse(cr_team)
# create Salesteam for all websites
cr_team_ir_heizpaneel = crm_team_obj.search([('name', '=', 'IR Heizpaneele')])
if not cr_team_ir_heizpaneel:
crm_team_vals = {
'name': 'IR Heizpaneele',
'team_type': 'website',
'company_id': self.odoo.env.ref('base.main_company').id,
website_vals = {
'name': website['name'],
'domain': website['domain'],
'company_id': self.odoo.env.ref(website['company_xml_id']).id,
'salesteam_id': cr_team.id,
'multi_theme_id': self.odoo.env.ref('website_multi_theme.theme_default').id
}
cr_team_ir_heizpaneel = crm_team_obj.browse([crm_team_obj.create(crm_team_vals)])
else:
cr_team_ir_heizpaneel = crm_team_obj.browse(cr_team_ir_heizpaneel)
cr_team_heizpaneel = crm_team_obj.search([('name', '=', 'Heizpaneele')])
if not cr_team_heizpaneel:
crm_team_vals = {
'name': 'Heizpaneele',
'team_type': 'website',
'company_id': self.odoo.env.ref('base.main_company').id,
}
cr_team_heizpaneel = crm_team_obj.browse([crm_team_obj.create(crm_team_vals)])
else:
cr_team_heizpaneel = crm_team_obj.browse(cr_team_heizpaneel)
# Create and configure Websites
default_website = self.odoo.env.ref('website.default_website')
default_website.write({
'name': 'IR Heizpaneele',
'domain': 'www.irheizpaneele.at',
'company_id': self.odoo.env.ref('base.main_company').id,
'salesteam_id': cr_team_ir_heizpaneel.id,
'multi_theme_id': self.odoo.env.ref('website_multi_theme.theme_default').id
})
heizpaneele_vals = {
'name': 'Heizpaneele',
'domain': 'www.heizpaneele.at',
'company_id': self.odoo.env.ref('base.main_company').id,
'salesteam_id': cr_team_heizpaneel.id,
'multi_theme_id': self.odoo.env.ref('website_multi_theme.theme_default').id
}
if not ir_model_obj.search([('module', '=', 'dp_website'), ('name', '=', 'tz_heizpaneele')]):
heizpaneele = self.odoo.env['website'].create(heizpaneele_vals)
vals = {
'model': 'website',
'module': 'dp_website',
'name': 'tz_heizpaneele',
'res_id': str(heizpaneele),
'noupdate': True,
}
ir_model_obj.create(vals)
else:
heizpaneele = self.odoo.env.ref('dp_website.tz_heizpaneele')
heizpaneele.write(heizpaneele_vals)
# Create and configure Websites
if idx == 0:
default_website = self.odoo.env.ref('website.default_website')
default_website.write(website_vals)
else:
website_id = website['name'].lower().replace('-', '_').replace(' ', '_').replace('.', '_')
if not ir_model_obj.search([('module', '=', 'dp_website'), ('name', '=', website_id)]):
created_website = self.odoo.env['website'].create(website_vals)
vals = {
'model': 'website',
'module': 'dp_website',
'name': website_id,
'res_id': str(created_website),
'noupdate': True,
}
ir_model_obj.create(vals)
else:
created_website = self.odoo.env.ref('dp_website.'+website_id)
created_website.write(website_vals)
res_settings = self.odoo.env['res.config.settings']
vals = res_settings.default_get([])
@ -349,7 +347,7 @@ class DatenpolFunctions(object):
wizard_id = res_settings.create(vals)
res_settings.execute(wizard_id)
#
# Make all pricelists not selectable
self.odoo.env['product.pricelist'].browse(self.odoo.env['product.pricelist'].search([])).write({
'selectable': False
})
@ -375,9 +373,16 @@ class DatenpolFunctions(object):
def configure_payment_providers(self):
"""Zahlungsmethoden konfigurieren"""
websites = self.config.websites
website_ids = []
for idx, website in enumerate(websites):
if idx == 0:
website_ids.append(self.odoo.env.ref('website.default_website').id)
else:
website_xml_id = website['name'].lower().replace('-', '_').replace(' ', '_').replace('.', '_')
website_ids.append(self.odoo.env.ref('dp_website.'+website_xml_id).id)
vals = {
'website_ids': [(6, 0, [self.odoo.env.ref('dp_website.tz_heizpaneele').id,
self.odoo.env.ref('website.default_website').id])]
'website_ids': [(6, 0, website_ids)]
}
paypal = self.odoo.env.ref('payment.payment_acquirer_paypal')

View File

@ -1,5 +1,5 @@
[local]
localhost ansible_connection=local
[tzaustria]
5.9.67.35:3333 ansible_connection=ssh ansible_user=datenpol
[tzaustria_allinonept]
5.9.67.35:3336 ansible_connection=ssh ansible_user=datenpol

View File

@ -0,0 +1,36 @@
---
# This playbook deploys the whole application stack in this site.
- name: Odoo Prod
hosts: tzaustria_allinonept
become: yes
# deactivate gather_facts when python is not installed on server
# gather_facts: false
# pre_tasks:
# - raw: which python || apt-get update
# - raw: (which python && which aptitude) || apt-get install -y python python-apt aptitude
# - setup: # aka gather_facts
roles:
- role: odoo
odoo_repo_rev: master
odoo_user: odoo-prod
odoo_service: odoo-prod
odoo_version: 11.0
odoo_config_http_port: 8069
odoo_config_admin_passwd: ainbeyos
odoo_config_db_passwd: aroneyna
odoo_general_user_passwd: elewcaph
odoo_instance: "prod"
odoo_config_dbfilter: "^{{ odoo_instance }}_.*"
# remove the following paramters to install odoo from github
odoo_repo_url: "ssh://git@gitlab.datenpol.at:122/odoo/tz-austria.git"
odoo_config_addons_path:
- "/data/{{ odoo_user }}/odoo/ext/odoo/odoo/addons"
- "/data/{{ odoo_user }}/odoo/ext/odoo/addons"
- "/data/{{ odoo_user }}/odoo/ext/custom-addons"
- "/data/{{ odoo_user }}/odoo/ext/3rd-party-addons"
odoo_workdir: "/data/{{ odoo_user }}/odoo"
odoo_rootdir: "/data/{{ odoo_user }}/odoo"
odoo_coredir: "/data/{{ odoo_user }}/odoo/ext/odoo"
odoo_config_file: "/data/{{ odoo_user }}/{{ odoo_service }}.conf"
odoo_config_data_dir: "/data/{{ odoo_user }}/.local/share/Odoo"

View File

@ -19,23 +19,12 @@
tags:
- odoo_user
- name: Add general odoo user
user: name=odoo shell=/bin/bash
password={{ odoo_general_user_passwd }} update_password=on_create
move_home=yes
home=/data/odoo
become: yes
become_method: "sudo"
tags:
- odoo_user
- name: Allow general odoo user to have passwordless sudo
- name: Allow odoo user to have passwordless sudo for restart
lineinfile:
dest: /etc/sudoers
state: present
regexp: '^odoo$'
line: 'odoo ALL=(ALL:ALL) NOPASSWD: ALL'
line: '{{ odoo_instance }} ALL=(root) NOPASSWD: /etc/init.d/{{ odoo_instance }}'
validate: visudo -cf %s
- name: Create log directory