Fälle 4449, 4447, 4441 und Feedback 1132

develop
Ahmed Aly 2017-11-30 14:13:11 +01:00
parent 08f38d941f
commit 14166f3462
14 changed files with 98 additions and 19 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -38,12 +38,14 @@
'data/dp_custom_data.xml',
'data/glaser_company_data.xml',
'data/tz_austria_company_data.xml',
'data/product_data.xml',
'data/cron_job.xml',
'views/dp_custom_views.xml',
'views/res_line_views.xml',
'views/res_partner_views.xml',
'views/stock_views.xml',
'views/sale_views.xml',
'views/account_views.xml',
'views/material_type_views.xml',
'views/product_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 product
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')
assembly_line_ids = fields.Many2many(comodel_name='res.line', string='Produktionslinien')
notes = fields.Text(string='Notizen')
can_be_sold_unconfigured = fields.Boolean(string='Darf unkonfiguriert verkauft werden')
@api.model
def create_product(self, vals):
@ -77,6 +78,14 @@ class ProductTemplate(models.Model):
raise ValidationError(
_("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):
material_type = self.env['material.type'].search([('name', '=', vals['material_type_id'])])
if material_type:
@ -110,7 +119,7 @@ class ProductTemplate(models.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']
'height', 'categ_id']
class ProductCategory(models.Model):

View File

@ -19,6 +19,7 @@
#
##############################################################################
import requests
import json
from odoo import tools, api, fields, models, _
from odoo.exceptions import ValidationError
@ -152,21 +153,23 @@ class Partner(models.Model):
if not partner_id.portal_id:
raise ValidationError(_("Der Partner mit der ID %s hat keine Portal-ID" % partner_id.id))
pricelist = partner_id.property_product_pricelist
data = {'portal_id': partner_id.portal_id,
'rules': []
}
for item in pricelist.items_ids:
data = []
for item in pricelist.item_ids:
if item.compute_price == 'percentage' and item.applied_on in ['3_global', '2_product_category',
'1_product']:
category_code = item.product_tmpl_id.categ_id.code if item.applied_on == '2_product_category' else False
product_code = item.product_tmpl_id.default_code if item.applied_on == '1_product' else False
data['rules'].append({'category_code': category_code,
'product_code': product_code,
'factor': 1 - (item.percent_price / 100)
})
code = False
if item.applied_on == '2_product_category':
code = item.categ_id.code
if item.applied_on == '1_product':
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')
application_id = tools.config.get('portal_secret')
requests.post(portal_url + '/customer/api/v1/set-discounts/?secret=' + application_id, data=data)
requests.post(portal_url + '/customer/api/v1/set-discounts/?secret=' + application_id, data=json.dumps(data))
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')
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
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="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<field name="volume" position="after">
<field name="can_be_sold_unconfigured"/>
</field>
<div name="volume" position="after">
<field name="length"/>
<field name="width"/>

View File

@ -45,5 +45,6 @@ ENVIRONMENTS = {
# Remote environments are always listed without passwords!
# 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()),
}