Merge branch 'develop' of https://gitlab.datenpol.at/odoo/tz-austria into develop

develop
Andreas Osim 2018-05-18 08:54:46 +02:00
commit 85986d15db
20 changed files with 129 additions and 75 deletions

View File

@ -30,7 +30,6 @@ values = {
"line_ids": ["0000"],
"opt_out": True,
"lang": "de",
"is_retailer": True,
}
res_partner_obj = odoo.env['res.partner']

View File

@ -7,14 +7,15 @@ db = 'tz-austria_1'
user = 'admin'
pw = 'x'
host = 'erp.tzaustria.info'
port = 443
db = 'odoo-test'
user = 'tz-admin'
pw = '12tza345'
protocol="jsonrpc+ssl"
# host = 'erp.tzaustria.info'
# port = 443
# db = 'odoo-test'
# user = 'tz-admin'
# pw = '12tza345'
# protocol="jsonrpc+ssl"
odoo = odoorpc.ODOO(host, protocol=protocol, port=port)
odoo = odoorpc.ODOO(host, port=port)
# odoo = odoorpc.ODOO(host, protocol=protocol, port=port)
odoo.login(db, user, pw)
sale_order_obj = odoo.env['sale.order']

View File

@ -7,14 +7,15 @@ db = 'tz-austria_1'
user = 'tz-admin'
pw = 'x'
host = 'erp.tzaustria.info'
port = 443
db = 'odoo-test'
user = 'tz-admin'
pw = '12tza345'
protocol="jsonrpc+ssl"
# host = 'erp.tzaustria.info'
# port = 443
# db = 'odoo-test'
# user = 'tz-admin'
# pw = '12tza345'
# protocol="jsonrpc+ssl"
odoo = odoorpc.ODOO(host, protocol=protocol, port=port)
odoo = odoorpc.ODOO(host, port=port)
# odoo = odoorpc.ODOO(host, protocol=protocol, port=port)
odoo.login(db, user, pw)
values = {
@ -28,16 +29,17 @@ values = {
"weight": 80.45,
"active": True,
"is_internal": True,
"xcat_id": "Kategorie 1",
"xcat_id": "XCategory Name",
"notes": "notes",
"material_type_id": "Holz",
"categ_id": "all",
"material_type_id": "Roh Material",
"categ_id": "__connector",
"intrastat_id": "34052000",
"sale_ok": True,
"assembly_line_ids": ["0000"],
"list_price": 50.00,
"can_be_sold_unconfigured": True,
'image': "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
"image": "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
"tax": "20% MwSt.",# oder "10% MwSt.", "0% MwSt."
}
product_obj = odoo.env['product.template']

View File

@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import odoorpc
from urllib.parse import urlparse
host = 'localhost'
port = 8080
@ -32,7 +31,7 @@ values = {
"vat": False,
"lang": "de",
"line_ids": ["0000"],
"property_payment_term_id": "15 Tage",
"property_payment_term_id": "7",
"property_product_pricelist": "EUR",
"date_vat_check": "2017-08-04",
"active": True,

View File

@ -31,3 +31,4 @@ from . import product
from . import ir_attachment
from . import account
from . import commission_account
from . import res_users

View File

@ -27,14 +27,12 @@ class AbstractHelper(models.AbstractModel):
_description = 'Abstract Helper'
@api.model
def remove_not_specified_fields(self, vals):
def check_not_specified_fields(self, vals):
specified_fields = self._get_specified_fields()
remove_fields = []
for key in list(vals.keys()):
if key not in specified_fields:
remove_fields.append(key)
for key in remove_fields:
del vals[key]
raise ValidationError(
_('Es befinden sich unerlaubte Felder in Ihrem Aufruf. Bitte entfernen Sie diese.'))
return vals
@api.model

View File

@ -18,11 +18,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo.addons.component.core import Component
from odoo import fields, models, api, _
from odoo.exceptions import ValidationError
from odoo.addons.component.core import Component
class ProductXCategory(models.Model):
_name = 'product.xcategory'
@ -66,7 +66,7 @@ class ProductTemplate(models.Model):
:param vals:
:return:
"""
vals = self.remove_not_specified_fields(vals)
self.check_not_specified_fields(vals)
vals = self.correct_values(vals)
product_template = self.with_context(active_test=False).search([('default_code', '=', vals['default_code'])])
if product_template:
@ -120,13 +120,23 @@ class ProductTemplate(models.Model):
_("Produktionslinie \'%s\' kann nicht zugeordnet werden") % assembly_line_code)
vals['assembly_line_ids'] = [(6, 0, assembly_line_ids)]
if vals.get('tax', False):
if vals['tax'] not in ["20% MwSt.", "10% MwSt.", "0% MwSt."]:
raise ValidationError(_("Die Steuer \'%s\' ist nicht gültig.") % vals['tax'])
tax = self.env['account.tax'].search([('name', '=', vals['tax'])])
if tax:
vals['taxes_id'] = [(6, 0, [tax.id])]
else:
raise ValidationError(_("Die Steuer \'%s\' kann nicht zugeordnet werden") % vals['tax'])
return vals
@api.model
def _get_specified_fields(self):
return ['default_code', 'name', 'length', 'width', 'thickness', 'surface', 'active', 'weight', 'is_internal',
'xcat_id', 'notes', 'material_type_id', 'intrastat_id', 'sale_ok', 'assembly_line_ids', 'list_price',
'height', 'categ_id', 'can_be_sold_unconfigured', 'image']
'height', 'categ_id', 'can_be_sold_unconfigured', 'image', 'tax']
class ProductCategory(models.Model):
@ -142,21 +152,30 @@ class ProductPricelistItemEventListener(Component):
@api.model
def on_record_write(self, record, fields=None):
partners = self.env['res.partner'].search([('property_product_pricelist', '=', record.id)])
partners = self.env['res.partner'].search([('property_product_pricelist', '=', record.pricelist_id.id)])
for partner in partners:
if partner.portal_id and partner.active:
if partner.portal_id and partner.company_type == 'company':
partner.portal_export_pending = True
@api.model
def on_record_create(self, record, fields=None):
partners = self.env['res.partner'].search([('property_product_pricelist', '=', record.id)])
partners = self.env['res.partner'].search([('property_product_pricelist', '=', record.pricelist_id.id)])
for partner in partners:
if partner.portal_id:
if partner.portal_id and partner.company_type == 'company':
partner.portal_export_pending = True
@api.model
def on_record_unlink(self, record):
partners = self.env['res.partner'].search([('property_product_pricelist', '=', record.id)])
partners = self.env['res.partner'].search([('property_product_pricelist', '=', record.pricelist_id.id)])
for partner in partners:
if partner.portal_id:
if partner.portal_id and partner.company_type == 'company':
partner.portal_export_pending = True
class ProductPricelistItem(models.Model):
_inherit = 'product.pricelist.item'
applied_on = fields.Selection(selection=[
('3_global', 'Global'),
('2_product_category', ' Product Category'),
('0_product_variant', 'Product Variant')])

View File

@ -34,17 +34,13 @@ class PartnerEventListener(Component):
_apply_on = ['res.partner']
def on_record_write(self, record, fields=None):
if record.active and record.portal_id:
if 'company_type' in fields:
if record.company_type == 'company' and record.type != 'delivery':
self.env['res.partner'].with_delay().job_export_portal_price(record)
if 'property_product_pricelist' in fields:
for contact in record.child_ids:
if contact.type != 'delivery':
self.env['res.partner'].with_delay().job_export_portal_price(contact)
if 'parent_id' in fields:
if record.type != 'delivery':
self.env['res.partner'].with_delay().job_export_portal_price(record)
if record.active and record.portal_id and record.company_type == 'company':
if 'company_type' in fields or 'property_product_pricelist' in fields:
self.env['res.partner'].with_delay().job_export_portal_price(record)
def on_record_create(self, record, fields=None):
if record.active and record.portal_id and record.company_type == 'company':
self.env['res.partner'].with_delay().job_export_portal_price(record)
class Partner(models.Model):
@ -97,7 +93,7 @@ class Partner(models.Model):
:param vals:
:return:
"""
vals = self.with_context(sst_1=True).remove_not_specified_fields(vals)
self.with_context(sst_1=True).check_not_specified_fields(vals)
vals = self.correct_values(vals)
if not vals.get('active', False):
vals['active'] = False
@ -113,7 +109,7 @@ class Partner(models.Model):
:param vals:
:return:
"""
vals = self.with_context(sst_14=True).remove_not_specified_fields(vals)
self.with_context(sst_14=True).check_not_specified_fields(vals)
vals = self.correct_values(vals)
return self.create(vals).id
@ -124,7 +120,7 @@ class Partner(models.Model):
:param vals:
:return:
"""
vals = self.with_context(sst_11=True).remove_not_specified_fields(vals)
self.with_context(sst_11=True).check_not_specified_fields(vals)
vals = self.correct_values(vals)
partner = self.with_context(active_test=False).search([('ref', '=', vals['ref'])])
if partner:
@ -283,8 +279,7 @@ class Partner(models.Model):
def cron_export_portal_prices(self):
partners = self.search([('portal_export_pending', '=', True), ('company_id', '=', self.env.user.company_id.id)])
for partner in partners:
if partner.type != 'delivery':
self.with_delay().job_export_portal_price(partner)
self.with_delay().job_export_portal_price(partner)
partner.portal_export_pending = False
@api.multi
@ -296,14 +291,14 @@ class Partner(models.Model):
data = []
for item in pricelist.item_ids:
if item.compute_price == 'percentage' and item.applied_on in ['3_global', '2_product_category',
'1_product']:
'0_product_variant']:
code = False
if item.applied_on == '2_product_category':
code = item.categ_id.code
if item.applied_on == '1_product':
if item.applied_on == '0_product_variant':
code = item.product_tmpl_id.default_code
data.append({
'customer_id': partner_id.portal_id,
'customer_id': partner_id.commercial_partner_id.portal_id,
'code': code,
'discount': 1 - (item.percent_price / 100)
})

View File

@ -0,0 +1,14 @@
# 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
class Users(models.Model):
_inherit = 'res.users'
@api.model
def create(self, vals):
vals['customer'] = False
return super(Users, self).create(vals)

View File

@ -202,7 +202,7 @@ class SaleOrder(models.Model):
if key.startswith('delivery_'):
delivery_vals[key.replace('delivery_', '')] = vals[key]
delivery_vals = delivery_partner.with_context(delivery_partner=True).remove_not_specified_fields(delivery_vals)
delivery_partner.with_context(delivery_partner=True).check_not_specified_fields(delivery_vals)
delivery_vals = delivery_partner.correct_values(delivery_vals)
delivery_vals['parent_id'] = partner.id
@ -219,7 +219,7 @@ class SaleOrder(models.Model):
attachment_vals = vals.get('attachment_ids', False)
order_line_vals = vals.get('order_lines', False)
vals = self.remove_not_specified_fields(vals)
self.check_not_specified_fields(vals)
vals = self.correct_values(vals)
payment_term = partner.property_payment_term_id
if partner.retail_partner_id:

View File

@ -62,6 +62,17 @@
</field>
</record>
<record id="dp_product_pricelist_item_form_view" model="ir.ui.view">
<field name="name">dp_product_pricelist_item_form_view</field>
<field name="model">product.pricelist.item</field>
<field name="inherit_id" ref="product.product_pricelist_item_form_view"/>
<field name="arch" type="xml">
<field name="applied_on" position="attributes">
<attribute name="attrs">{'invisible':[('applied_on', '=', '1_product')]}</attribute>
</field>
</field>
</record>
<record id="product_xcategory_form_view" model="ir.ui.view">
<field name="name">product_xcategory_form_view</field>
<field name="model">product.xcategory</field>

View File

@ -64,7 +64,7 @@ class PortalAssignCompany(models.TransientModel):
# Wichtig hier ist, dass dieser Call vor dem ersten Write stattfindet, da das Portal
# parallel einen Call absetzt, dann dann blockieren würde.
self.send_to_portal(partner.portal_id, partner.id)
# self.send_to_portal(partner.portal_id, partner.id)
partner.write({'portal_pending': False, 'active': True})
return True

View File

@ -4,7 +4,6 @@
<template id="report_assets_common" inherit_id="web.report_assets_common">
<xpath expr="." position="inside">
<link rel="stylesheet" type="text/less" href="/dp_reports/static/src/less/report_backend.less"/>
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,700" rel="stylesheet"/>
</xpath>
</template>
@ -89,7 +88,7 @@
&#183;
<span t-esc="company.email"/>
&#183;
<span t-esc="company.website"/>
<span t-esc="company.website.replace('http://', '').replace('https://', '')"/>
</strong>
</div>
</div>
@ -98,7 +97,7 @@
<strong>
IBAN:
<!-- <span t-if="company.bank_ids" t-esc="company.bank_ids[0].acc_number"/> -->
<span>AT46 3250 1000 0200 9306</span>
<span>AT 46 3250 1000 0200 9306</span>
&#183;
BIC:
<!-- <span t-if="company.bank_ids" t-esc="company.bank_ids[0].bank_id.bic"/> -->
@ -121,7 +120,7 @@
<div class="row" style="padding-left:0;">
<div class="col-xs-12 text-center">
<strong>
Die AGBs sind auf der Homepage verfügbar.
Die AGBs finden Sie auf unserer Website.
</strong>
</div>
</div>
@ -167,7 +166,7 @@
</div>
<div>
<strong>
<span t-esc="company.partner_id.website"/>
<span t-esc="company.partner_id.website.replace('http://', '').replace('https://', '')"/>
</strong>
</div>
</template>

View File

@ -106,9 +106,15 @@
<strong>
<t t-esc="layout_category['name']"/>
<t t-if="layout_category.get('order_id')">
<t t-if="layout_category['order_id'].partner_id.ref">
-
<t t-esc="layout_category['order_id'].partner_id.ref"/>
<t t-f="o.partner_id.id != layout_category['order_id'].partner_id.id">
<t t-if="layout_category['order_id'].partner_id.ref">
-
<t t-esc="layout_category['order_id'].partner_id.ref"/>
</t>
<t t-if="layout_category['order_id'].partner_id.name">
-
<t t-esc="layout_category['order_id'].partner_id.name"/>
</t>
</t>
<t t-if="layout_category['order_id'].origin">
-

View File

@ -2,6 +2,7 @@
@odoo-brand-optional: #a72523;
@navbar-default-color: #a72523;
@brand-primary: #a72523;
@font-family-sans-serif: Raleway, "Lucida Grande", Helvetica, Verdana, Arial, sans-serif;
@navbar-default-bg: #ffffff;
@odoo-control-panel-background-color: #ffffff;

View File

@ -0,0 +1,3 @@
body {
font-family: Raleway, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

View File

@ -1,10 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_backend" name="dp_style assets" inherit_id="web.assets_backend">
<template id="assets_backend" name="dp_style assets_backend" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" type="text/less" href="/dp_style/static/src/less/variables.less"/>
</xpath>
</template>
<template id="assets_editor" name="dp_style assets_editor" inherit_id="web_editor.assets_editor">
<xpath expr="." position="inside">
<link rel="stylesheet" type="text/less" href="/dp_style/static/src/less/web_variables.less"/>
</xpath>
</template>
</odoo>

View File

@ -15,7 +15,7 @@ class ConfigGlaser(Config):
'street2': False,
'city': 'Spannberg',
'zip': '2244',
'phone': '+43 2538/8628 0',
'phone': '+43 2538/86280',
'email': 'office@tzaustria.com',
'website': 'https://www.glaser-co.at',
'company_registry': 'FN 61793 y',

View File

@ -15,15 +15,15 @@ class ConfigTZA(Config):
'street2': False,
'city': 'Spannberg',
'zip': '2244',
'phone': '+43 2538/8628 0',
'phone': '+43 2538/86280',
'email': 'office@tzaustria.com',
'website': 'https://www.tzaustria.com/',
'company_registry': 'FN 224119m',
'website': 'www.tzaustria.com',
'company_registry': 'FN2244119m',
'country_id': 'at', # 'de' für Deutschland
'vat': 'ATU 54619104',
'vat': 'ATU 546 19 104',
'vat_check_vies': True,
'logo': '../ext/custom-addons/dp_custom/static/src/img/logo.png',
'eori_nr': 'ATEOS 100011273',
'eori_nr': 'ATEOS1 0000 11273',
#'favicon_backend': '../ext/custom-addons/dp_custom/static/src/img/favicon.ico',
#'favicon_backend_mimetype': 'image/x-icon'
}

View File

@ -40,9 +40,9 @@ ENVIRONMENTS = {
'br-tz' : Environment('http://localhost', '8080', 'tz-austria_1', 'tz-admin', 'x', 'admin', config = ConfigTZA()),
'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' : Environment('http://localhost', '8080', 'tz-austria_2', 'admin', 'x', 'admin', config = ConfigTZA()),
'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()),
'aa-glaser' : Environment('http://localhost', '8080', 'tz-austria_2', 'glaser-admin', 'x', 'admin', config = ConfigGlaser()),
'rw' : Environment('http://localhost', '8080', 'tz-austria_1', 'admin', 'x', 'admin', config = ConfigTZA()),
'rw-tz' : Environment('http://localhost', '8080', 'tz-austria_1', 'tz-admin', 'x', 'admin', config = ConfigTZA()),