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

develop
Andreas Osim 2017-11-30 17:28:40 +01:00
commit cc7f652735
16 changed files with 112 additions and 22 deletions

View File

@ -19,8 +19,8 @@ show_debug = 1
workers = 0 workers = 0
server_wide_modules = web,base_sparse_field,queue_job server_wide_modules = web,base_sparse_field,queue_job
portal_url = https://erp.tzaustria.info portal_url = https://dev-portal.tzaustria.info/
portal_secret = secret portal_secret = hH43413$74O0
[queue_job] [queue_job]
channels = root:4 channels = root:4

View File

@ -23,7 +23,7 @@ values = {
"phone": "+43 564564", "phone": "+43 564564",
"mobile": "+43 677 564564", "mobile": "+43 677 564564",
"endkunde": True, "endkunde": True,
"portal_id": "333333", "portal_id": "6",
"company": "Bier AG", "company": "Bier AG",
"info_uid": "habe keine", "info_uid": "habe keine",
"info_kundennr": "K1234", "info_kundennr": "K1234",

View File

@ -24,6 +24,7 @@ values = {
"xcat_id": "Kategorie 1", "xcat_id": "Kategorie 1",
"notes": "notes", "notes": "notes",
"material_type_id": "Holz", "material_type_id": "Holz",
"categ_id": "all",
"intrastat_id": "Code", "intrastat_id": "Code",
"sale_ok": True, "sale_ok": True,
"assembly_line_ids": ["12345", "12346"], "assembly_line_ids": ["12345", "12346"],

View File

@ -19,7 +19,7 @@ values = {
"fax": "+43 55567051", "fax": "+43 55567051",
"phone": "+43 5556705", "phone": "+43 5556705",
"endkunde": True, "endkunde": True,
"portal_id": "111111", "portal_id": "31",
"email": "company@test.at", "email": "company@test.at",
"opt_out": True, "opt_out": True,
"ref": "A144S3", "ref": "A144S3",

View File

@ -38,12 +38,14 @@
'data/dp_custom_data.xml', 'data/dp_custom_data.xml',
'data/glaser_company_data.xml', 'data/glaser_company_data.xml',
'data/tz_austria_company_data.xml', 'data/tz_austria_company_data.xml',
'data/product_data.xml',
'data/cron_job.xml', 'data/cron_job.xml',
'views/dp_custom_views.xml', 'views/dp_custom_views.xml',
'views/res_line_views.xml', 'views/res_line_views.xml',
'views/res_partner_views.xml', 'views/res_partner_views.xml',
'views/stock_views.xml', 'views/stock_views.xml',
'views/sale_views.xml', 'views/sale_views.xml',
'views/account_views.xml',
'views/material_type_views.xml', 'views/material_type_views.xml',
'views/product_views.xml', 'views/product_views.xml',
'views/ir_attachment_views.xml', 'views/ir_attachment_views.xml',

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">
<record id="product_discount" model="product.template">
<field name="name">Rabatt</field>
<field name="type">service</field>
</record>
</odoo>

View File

@ -29,3 +29,4 @@ from . import sale
from . import material_type from . import material_type
from . import product from . import product
from . import ir_attachment from . import ir_attachment
from . import account

View File

@ -0,0 +1,34 @@
# -*- 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/>.
#
##############################################################################
from odoo import api, fields, models, _
class AccountInvoiceLine(models.Model):
_inherit = 'account.invoice.line'
intrastat_id = fields.Many2one(comodel_name='report.intrastat.code', string='Intrastat Code')
@api.model
def create(self, vals):
if vals.get('product_id', False) and not vals.get('intrastat_id', False):
vals.update(intrastat_id=vals['product_id'].intrastat_id.id)
return super(AccountInvoiceLine, self).create(vals)

View File

@ -55,6 +55,7 @@ class ProductTemplate(models.Model):
material_type_id = fields.Many2one(comodel_name='material.type', string='Materialtyp') material_type_id = fields.Many2one(comodel_name='material.type', string='Materialtyp')
assembly_line_ids = fields.Many2many(comodel_name='res.line', string='Produktionslinien') assembly_line_ids = fields.Many2many(comodel_name='res.line', string='Produktionslinien')
notes = fields.Text(string='Notizen') notes = fields.Text(string='Notizen')
can_be_sold_unconfigured = fields.Boolean(string='Darf unkonfiguriert verkauft werden')
@api.model @api.model
def create_product(self, vals): def create_product(self, vals):
@ -77,6 +78,14 @@ class ProductTemplate(models.Model):
raise ValidationError( raise ValidationError(
_("X-Kategorie \'%s\' kann nicht zugeordnet werden" % vals['xcat_id'])) _("X-Kategorie \'%s\' kann nicht zugeordnet werden" % vals['xcat_id']))
if vals.get('categ_id', False):
categ_id = self.env['product.category'].search([('code', '=', vals['categ_id'])])
if categ_id:
vals['categ_id'] = categ_id.id
else:
raise ValidationError(
_("Kategorie \'%s\' kann nicht zugeordnet werden" % vals['categ_id']))
if vals.get('material_type_id', False): if vals.get('material_type_id', False):
material_type = self.env['material.type'].search([('name', '=', vals['material_type_id'])]) material_type = self.env['material.type'].search([('name', '=', vals['material_type_id'])])
if material_type: if material_type:
@ -110,7 +119,7 @@ class ProductTemplate(models.Model):
def _get_specified_fields(self): def _get_specified_fields(self):
return ['default_code', 'name', 'length', 'width', 'thickness', 'surface', 'active', 'weight', 'is_internal', 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', 'xcat_id', 'notes', 'material_type_id', 'intrastat_id', 'sale_ok', 'assembly_line_ids', 'list_price',
'height'] 'height', 'categ_id']
class ProductCategory(models.Model): class ProductCategory(models.Model):

View File

@ -19,6 +19,7 @@
# #
############################################################################## ##############################################################################
import requests import requests
import json
from odoo import tools, api, fields, models, _ from odoo import tools, api, fields, models, _
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
@ -152,21 +153,25 @@ class Partner(models.Model):
if not partner_id.portal_id: if not partner_id.portal_id:
raise ValidationError(_("Der Partner mit der ID %s hat keine Portal-ID" % partner_id.id)) raise ValidationError(_("Der Partner mit der ID %s hat keine Portal-ID" % partner_id.id))
pricelist = partner_id.property_product_pricelist pricelist = partner_id.property_product_pricelist
data = {'portal_id': partner_id.portal_id, data = []
'rules': [] for item in pricelist.item_ids:
}
for item in pricelist.items_ids:
if item.compute_price == 'percentage' and item.applied_on in ['3_global', '2_product_category', if item.compute_price == 'percentage' and item.applied_on in ['3_global', '2_product_category',
'1_product']: '1_product']:
category_code = item.product_tmpl_id.categ_id.code if item.applied_on == '2_product_category' else False code = False
product_code = item.product_tmpl_id.default_code if item.applied_on == '1_product' else False if item.applied_on == '2_product_category':
data['rules'].append({'category_code': category_code, code = item.categ_id.code
'product_code': product_code, if item.applied_on == '1_product':
'factor': 1 - (item.percent_price / 100) code = item.product_tmpl_id.default_code
}) data.append({
'customer_id': partner_id.portal_id,
'code': code,
'discount': 1 - (item.percent_price / 100)
})
portal_url = tools.config.get('portal_url') portal_url = tools.config.get('portal_url')
application_id = tools.config.get('portal_secret') application_id = tools.config.get('portal_secret')
requests.post(portal_url + '/customer/api/v1/set-discounts/?secret=' + application_id, data=data) response = requests.post(portal_url + '/api/v1/set-discounts/?secret=' + application_id, data=json.dumps(data))
if response.status_code != 200:
raise ValidationError(_('Rabatt konnte nicht gesetzt werden.'))
class PartnerSector(models.Model): class PartnerSector(models.Model):

View File

@ -183,6 +183,7 @@ class SaleOrderLine(models.Model):
lot_id = fields.Many2one(comodel_name='stock.production.lot', string='Lot') lot_id = fields.Many2one(comodel_name='stock.production.lot', string='Lot')
from_designbox = fields.Boolean(string='Import von Designbox', readonly=True) from_designbox = fields.Boolean(string='Import von Designbox', readonly=True)
product_id = fields.Many2one(domain=[('sale_ok', '=', True), ('can_be_sold_unconfigured', '=', True)])
@api.model @api.model
def correct_values(self, vals): def correct_values(self, vals):

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_invoice_form_view" model="ir.ui.view">
<field name="name">account_invoice_form_view</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_line_ids']/tree//field[@name='name']" position="after">
<field name="intrastat_id"/>
</xpath>
</field>
</record>
</odoo>

View File

@ -5,6 +5,9 @@
<field name="model">product.template</field> <field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/> <field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="volume" position="after">
<field name="can_be_sold_unconfigured"/>
</field>
<div name="volume" position="after"> <div name="volume" position="after">
<field name="length"/> <field name="length"/>
<field name="width"/> <field name="width"/>

View File

@ -1,2 +1,6 @@
"id","name","print_default_code" "id","name","print_default_code"
"dp_dmi.unique_material_id","Material Name","True" "1","Trägermaterial","True"
"2","Laminat","True"
"3","Kante","True"
"4","Roh Material","True"
"5","Beschlag","True"

1 id name print_default_code
2 dp_dmi.unique_material_id 1 Material Name Trägermaterial True
3 2 Laminat True
4 3 Kante True
5 4 Roh Material True
6 5 Beschlag True

View File

@ -1,8 +1,13 @@
"id","name","description" "id","name","description"
"l0000","0000","Desigbox Material"
"l0000I","0000I","Desigbox Material (internal)"
"l0001","0001","TZ Austria" "l0001","0001","TZ Austria"
"l0001I","0001","TZ Austria (internal)" "l0001I","0001I","TZ Austria (internal)"
"l0002","0002","TZ Bandung" "l0002","0002","TZ Bandung"
"l0002I","0002I","TZ Bandung (internal)" "l0002I","0002I","TZ Bandung (internal)"
"l0003","0003","TZ Malaysia" "l0003","0003","TZ Malaysia"
"l0003I","0003I","TZ Malaysia (internal)" "l0003I","0003I","TZ Malaysia (internal)"
"l9998","9998","Test Line 9998"
"l9998I","9998I","Test Line 9998 (internal)"
"l9999","9999","Test Line 9999"
"l9999I","9999I","Test Line 9999 (internal)"

1 id name description
2 l0000 0000 Desigbox Material
3 l0000I 0000I Desigbox Material (internal)
4 l0001 0001 TZ Austria
5 l0001I 0001 0001I TZ Austria (internal)
6 l0002 0002 TZ Bandung
7 l0002I 0002I TZ Bandung (internal)
8 l0003 0003 TZ Malaysia
9 l0003I 0003I TZ Malaysia (internal)
10 l9998 9998 Test Line 9998
11 l9998I 9998I Test Line 9998 (internal)
12 l9999 9999 Test Line 9999
13 l9999I 9999I Test Line 9999 (internal)

View File

@ -31,7 +31,7 @@ ENVIRONMENTS = {
'tzdev' : Environment('http://10.1.2.195', "8080", "tz-austria_1", "admin", "x", "admin", config = ConfigTZA()), 'tzdev' : Environment('http://10.1.2.195', "8080", "tz-austria_1", "admin", "x", "admin", config = ConfigTZA()),
'tzdev-tz' : Environment('http://10.1.2.195', "8080", "tz-austria_1", "tz-admin", "x", "admin", config = ConfigTZA()), 'tzdev-tz' : Environment('http://10.1.2.195', "8080", "tz-austria_1", "tz-admin", "x", "admin", config = ConfigTZA()),
'tzdev-glaser': Environment("http://10.1.2.195", "8080", "tz-austria_1", "glaser-admin", "x", "admin", config = ConfigGlaser()), 'tzdev-glaser': Environment("http://10.1.2.195", "8080", "tz-austria_1", "glaser-admin", "x", "admin", config = ConfigGlaser()),
'oa' : Environment('http://localhost', "8080", "tz-austria_1", "admin", "x", "admin", config = ConfigTZA()), 'oa' : Environment('http://localhost', "8080", "tz-austria_1", "admin", "x", "admin", config = ConfigTZA()),
'oa-tz' : Environment('http://localhost', "8080", "tz-austria_1", "tz-admin", "x", "admin", config = ConfigTZA()), 'oa-tz' : Environment('http://localhost', "8080", "tz-austria_1", "tz-admin", "x", "admin", config = ConfigTZA()),
'oa-glaser' : Environment('http://localhost', "8080'" "tz-austria_1", "admin", "x", "admin", config = ConfigGlaser()), 'oa-glaser' : Environment('http://localhost', "8080'" "tz-austria_1", "admin", "x", "admin", config = ConfigGlaser()),
@ -42,8 +42,9 @@ ENVIRONMENTS = {
'aa' : Environment('http://localhost', '8080', 'tz-austria_1', 'admin', 'x', 'admin', config = ConfigTZA()), 'aa' : Environment('http://localhost', '8080', 'tz-austria_1', 'admin', 'x', 'admin', config = ConfigTZA()),
'aa-tz' : Environment('http://localhost', '8080', 'tz-austria_1', 'tz-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_1', 'glaser-admin', 'x', 'admin', config = ConfigGlaser()),
# Remote environments are always listed without passwords! # Remote environments are always listed without passwords!
# Do not store them here, you have to type them anyway! # Do not store them here, you have to type them anyway!
'test': Environment('https://tz-austria.datenpol.at', '443', 'tz-austria_1', 'admin'), 'test': Environment('https://erp.tzaustria.info', '443', 'odoo-test', 'admin', config = ConfigTZA()),
'test-glaser': Environment('https://erp.tzaustria.info', '443', 'odoo-test', 'glaser-admin', config = ConfigGlaser()),
} }