From 6301e2333812f35d0be712bec14cda8cb0065ea9 Mon Sep 17 00:00:00 2001 From: Roman Widmann Date: Fri, 26 Jan 2018 08:01:03 +0100 Subject: [PATCH] =?UTF-8?q?F=C3=A4lle=204605,=204602?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interfaces/sst01_portal_create_partner.py | 6 +++++- .../interfaces/sst03_pg_create_quotation.py | 11 +++++++---- ext/custom-addons/dp_custom/models/res_partner.py | 15 +++++++++++++-- ext/custom-addons/dp_custom/models/sale.py | 4 +++- ext/custom-addons/dp_custom/models/stock.py | 1 + ext/custom-addons/dp_custom/views/stock_views.xml | 1 + .../dp_reports_sale/reports/sale.xml | 6 +++++- 7 files changed, 35 insertions(+), 9 deletions(-) diff --git a/dev/scripts/interfaces/sst01_portal_create_partner.py b/dev/scripts/interfaces/sst01_portal_create_partner.py index d139227c..1b9ee558 100755 --- a/dev/scripts/interfaces/sst01_portal_create_partner.py +++ b/dev/scripts/interfaces/sst01_portal_create_partner.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # -*- coding: utf-8 -*- import odoorpc @@ -30,7 +31,10 @@ values = { "email": "max@musterman.at", "line_ids": ["12345"], "opt_out": True, - "lang": "de" + "lang": "de", + "collective_bill": False, + "retailer": True, + "incoterm": "EXW", } res_partner_obj = odoo.env['res.partner'] diff --git a/dev/scripts/interfaces/sst03_pg_create_quotation.py b/dev/scripts/interfaces/sst03_pg_create_quotation.py index 857bb869..b22a7895 100755 --- a/dev/scripts/interfaces/sst03_pg_create_quotation.py +++ b/dev/scripts/interfaces/sst03_pg_create_quotation.py @@ -1,7 +1,8 @@ +#!/usr/bin/env python # -*- coding: utf-8 -*- import odoorpc -# host = 'erp.tzaustria.info' +# host = 'localhost' # port = 8080 # db = 'tz-austria_1' # user = 'tz-admin' @@ -12,9 +13,10 @@ port = 443 db = 'odoo-test' user = 'tz-admin' pw = '12tza345' -protocol="jsonrpc+ssl" +protocol = "jsonrpc+ssl" odoo = odoorpc.ODOO(host, protocol=protocol, port=port) +#odoo = odoorpc.ODOO(host, port=port) odoo.login(db, user, pw) values = { @@ -24,7 +26,7 @@ values = { "date_order": "2017-11-21", "assembled": True, "line_id": "0000", - "portal_id": "111111", + "portal_id": "59-0001", "portal_delivery_id": "111112", "delivery_firstname": "Huber", "delivery_lastname": "Bauer", @@ -48,7 +50,8 @@ values = { "price_unit": 50.00, "product_uom_qty": 4.0, "lot_id": { - "name": "AAA0123", + "name": "AAA012345678", + "weight": 5.5, "notes": "notes", "attachment_ids": [{ "filename": "logo.gif", diff --git a/ext/custom-addons/dp_custom/models/res_partner.py b/ext/custom-addons/dp_custom/models/res_partner.py index b99ecebc..361ba381 100644 --- a/ext/custom-addons/dp_custom/models/res_partner.py +++ b/ext/custom-addons/dp_custom/models/res_partner.py @@ -56,7 +56,7 @@ class Partner(models.Model): active = fields.Boolean(track_visibility='onchange') portal_export_pending = fields.Boolean(string='Portal Export ausständig') date_vat_check = fields.Date(string='Datum der letzten UID-Prüfung') - collective_bill = fields.Boolean(string='Sammelrechnung') + collective_bill = fields.Boolean(string='Sammelrechnung', default=True) _sql_constraints = [ ('ref_uniq', 'unique(ref)', 'Die Interne Referenz muss eindeutig sein'), @@ -153,6 +153,16 @@ class Partner(models.Model): raise ValidationError(_("Der Händler mit der Internen Referenz \'%s\' kann nicht zugeordnet werden" % vals[ 'retail_partner_id'])) + if vals.get('incoterm', False): + incoterm = self.env['stock.incoterms'].search( + [('code', '=', vals['incoterm'])]) + if incoterm: + vals['sale_incoterm_id'] = incoterm.id + del vals['incoterm'] + else: + raise ValidationError(_("Die Lieferbedingung mit dem Code \'%s\' kann nicht zugeordnet werden" % vals[ + 'incoterm'])) + return vals @api.model @@ -160,7 +170,8 @@ class Partner(models.Model): common_list = ['street', 'street2', 'zip', 'city', 'country_id', 'fax', 'phone', 'mobile', 'endkunde', 'line_ids', 'lang', 'portal_id', 'email', 'opt_out'] if self.env.context.get('sst_1', False): - common_list.extend(['firstname', 'lastname', 'midname', 'company', 'info_kundennr', 'info_uid']) + common_list.extend(['firstname', 'lastname', 'midname', 'company', 'info_kundennr', + 'info_uid', 'collective_bill', 'retailer', 'incoterm']) return common_list elif self.env.context.get('sst_11', False): common_list.extend(['name', 'ref', 'partner_sector_id', 'comment', 'vat', 'property_payment_term_id', diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index 20c9c221..85d0c226 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -154,7 +154,8 @@ class SaleOrder(models.Model): 'user_id': partner.user_id.id, 'payment_term_id': partner.property_payment_term_id.id, 'partner_shipping_id': delivery_partner.id, - 'partner_invoice_id': partner.id + 'partner_invoice_id': partner.id, + 'incoterm': partner.sale_incoterm_id.id }) order_id = self.create(vals) if attachment_vals: @@ -187,6 +188,7 @@ class SaleOrder(models.Model): lot = self.env['stock.production.lot'].create({ 'name': vals['lot_id']['name'], 'product_id': vals['product_id'], + 'weight': vals['lot_id'].get('weight'), 'notes': vals['lot_id']['notes'] }) for lot_attachment_vals in lot_attachment_values: diff --git a/ext/custom-addons/dp_custom/models/stock.py b/ext/custom-addons/dp_custom/models/stock.py index 9cd7e24e..4670f1a6 100644 --- a/ext/custom-addons/dp_custom/models/stock.py +++ b/ext/custom-addons/dp_custom/models/stock.py @@ -26,3 +26,4 @@ class StockProductionLot(models.Model): _inherit = 'stock.production.lot' notes = fields.Text() + weight = fields.Float(string='Gewicht') diff --git a/ext/custom-addons/dp_custom/views/stock_views.xml b/ext/custom-addons/dp_custom/views/stock_views.xml index 27bb2490..d0bfbfbf 100644 --- a/ext/custom-addons/dp_custom/views/stock_views.xml +++ b/ext/custom-addons/dp_custom/views/stock_views.xml @@ -7,6 +7,7 @@ + diff --git a/ext/custom-addons/dp_reports_sale/reports/sale.xml b/ext/custom-addons/dp_reports_sale/reports/sale.xml index 95c250fc..83064202 100644 --- a/ext/custom-addons/dp_reports_sale/reports/sale.xml +++ b/ext/custom-addons/dp_reports_sale/reports/sale.xml @@ -137,10 +137,14 @@ - + + + + +