From bfc605f86f521a623bc7e0a7eab025a112af0d55 Mon Sep 17 00:00:00 2001 From: Ahmed Aly Date: Fri, 24 Nov 2017 11:31:12 +0100 Subject: [PATCH] Schnittstellen bug fixes --- dev/odoo-server-dev-aa.conf | 2 +- .../interfaces/sst03_pg_create_quotation.py | 2 +- ...g_get_orders.py => sst04_pg_get_orders.py} | 0 ..._company.py => sst11_pg_create_company.py} | 0 .../dp_custom/models/dp_custom.py | 2 +- ext/custom-addons/dp_custom/models/product.py | 1 + .../dp_custom/models/res_partner.py | 27 +++++++++----- ext/custom-addons/dp_custom/models/sale.py | 3 +- .../dp_custom/views/product_views.xml | 36 +++++++++++++++---- 9 files changed, 53 insertions(+), 20 deletions(-) rename dev/scripts/interfaces/{pg_get_orders.py => sst04_pg_get_orders.py} (100%) rename dev/scripts/interfaces/{pg_create_company.py => sst11_pg_create_company.py} (100%) diff --git a/dev/odoo-server-dev-aa.conf b/dev/odoo-server-dev-aa.conf index 7f9451fc..a9bf5a9a 100644 --- a/dev/odoo-server-dev-aa.conf +++ b/dev/odoo-server-dev-aa.conf @@ -8,7 +8,7 @@ db_port = 5432 db_user = False db_password = False -addons_path = ext/odoo/addons,ext/3rd-party-addons,ext/custom-addons,dmi/run1 +addons_path = ext/odoo/addons,ext/3rd-party-addons,ext/custom-addons ; For enterprise use the addons path bellow ; addons_path = ext/enterprise-addons,ext/odoo/addons,ext/3rd-party-addons,ext/custom-addons,dmi/run1 timezone = Europe/Vienna diff --git a/dev/scripts/interfaces/sst03_pg_create_quotation.py b/dev/scripts/interfaces/sst03_pg_create_quotation.py index 7eecb65d..81e1a59f 100755 --- a/dev/scripts/interfaces/sst03_pg_create_quotation.py +++ b/dev/scripts/interfaces/sst03_pg_create_quotation.py @@ -21,7 +21,7 @@ values = { "portal_delivery_id": "222222", "delivery_firstname": "Ahmed", "delivery_lastname": "Aly", - "delivery_midname": False, + "delivery_lastname2": False, "delivery_street": "Zeilergasse 7-11", "delivery_street2": False, "delivery_zip": "1170", diff --git a/dev/scripts/interfaces/pg_get_orders.py b/dev/scripts/interfaces/sst04_pg_get_orders.py similarity index 100% rename from dev/scripts/interfaces/pg_get_orders.py rename to dev/scripts/interfaces/sst04_pg_get_orders.py diff --git a/dev/scripts/interfaces/pg_create_company.py b/dev/scripts/interfaces/sst11_pg_create_company.py similarity index 100% rename from dev/scripts/interfaces/pg_create_company.py rename to dev/scripts/interfaces/sst11_pg_create_company.py diff --git a/ext/custom-addons/dp_custom/models/dp_custom.py b/ext/custom-addons/dp_custom/models/dp_custom.py index 600b9f8b..74a76b8d 100644 --- a/ext/custom-addons/dp_custom/models/dp_custom.py +++ b/ext/custom-addons/dp_custom/models/dp_custom.py @@ -44,4 +44,4 @@ class AbstractHelper(models.AbstractModel): @api.model def _get_specified_fields(self): raise ValidationError( - _('Method \'%s\' isn\'t Implemented in model \'%s\'', (self._get_specified_fields.__name__, self._name))) + _('Method \'%s\' isn\'t Implemented in model \'%s\'' % (self._get_specified_fields.__name__, self._name))) diff --git a/ext/custom-addons/dp_custom/models/product.py b/ext/custom-addons/dp_custom/models/product.py index b28eca33..9bd88a62 100644 --- a/ext/custom-addons/dp_custom/models/product.py +++ b/ext/custom-addons/dp_custom/models/product.py @@ -51,6 +51,7 @@ class ProductTemplate(models.Model): xcat_id = fields.Many2one(comodel_name='product.xcategory', string='X-Kategorie') 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') @api.model def create_product(self, vals): diff --git a/ext/custom-addons/dp_custom/models/res_partner.py b/ext/custom-addons/dp_custom/models/res_partner.py index 2bf35751..41ed9914 100644 --- a/ext/custom-addons/dp_custom/models/res_partner.py +++ b/ext/custom-addons/dp_custom/models/res_partner.py @@ -39,12 +39,13 @@ class Partner(models.Model): active = fields.Boolean(track_visibility='onchange') _sql_constraints = [ - ('ref_uniq', 'unique(ref)', 'Die Interne Referenz muss eindeutig sein') + ('ref_uniq', 'unique(ref)', 'Die Interne Referenz muss eindeutig sein'), + ('portal_id_uniq', 'unique(portal_id)', 'Die Portal-ID muss eindeutig sein') ] @api.model def portal_create_partner(self, vals): - vals = self.remove_not_specified_fields(vals) + vals = self.with_context(sst_1=True).remove_not_specified_fields(vals) vals = self.correct_values(vals) if not vals.get('active', False): vals['active'] = False @@ -52,12 +53,13 @@ class Partner(models.Model): @api.model def pg_create_company(self, vals): - vals = self.remove_not_specified_fields(vals) + vals = self.with_context(sst_11=True).remove_not_specified_fields(vals) vals = self.correct_values(vals) partner = self.with_context(active_test=False).search([('ref', '=', vals['ref'])]) if partner: if not partner.is_company: - raise ValidationError(_("Der Partner mit der Internen Referenz '%s' ist kein Unternehmen" % vals['ref'])) + raise ValidationError( + _("Der Partner mit der Internen Referenz '%s' ist kein Unternehmen" % vals['ref'])) partner = self.write(vals) else: if not vals.get('is_company', False): @@ -83,7 +85,7 @@ class Partner(models.Model): vals['line_ids'] = [(6, 0, line_ids.ids)] else: raise ValidationError( - _("Die Produktionslinie mit dem Code \'%s\' kann nicht zugeordnet werden", vals['line_ids'])) + _("Die Produktionslinie mit dem Code \'%s\' kann nicht zugeordnet werden" % vals['line_ids'])) if vals.get('lang', False): temp = vals['lang'] @@ -107,10 +109,17 @@ class Partner(models.Model): @api.model def _get_specified_fields(self): - return ['name', 'firstname', 'lastname', 'street', 'street2', 'zip', 'city', 'country_id', 'tax', 'phone', 'mobile', - 'endkunde', 'line_ids', 'lang', 'portal_id', 'email', 'opt_out', 'ref', - 'partner_sector_id', 'comment', 'vat', 'property_payment_term_id', - 'property_pricelist_id', 'date_vat_check', 'active'] + 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', 'lastname2', 'company', 'info_kundennr', 'info_uid']) + 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', + 'property_pricelist_id', 'date_vat_check', 'active']) + return common_list + else: + return super(Partner, self)._get_specified_fields() class PartnerSector(models.Model): diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index 81851e16..199fbb74 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -57,7 +57,8 @@ class SaleOrder(models.Model): 'name': order.name, 'attachments': attachment_list, 'internal_notes': order.internal_notes, - 'assembly_notes': order.assembly_notes + 'assembly_notes': order.assembly_notes, + 'user_id': order.user_id }) return order_list diff --git a/ext/custom-addons/dp_custom/views/product_views.xml b/ext/custom-addons/dp_custom/views/product_views.xml index 1e434d2a..5c0040dd 100644 --- a/ext/custom-addons/dp_custom/views/product_views.xml +++ b/ext/custom-addons/dp_custom/views/product_views.xml @@ -1,9 +1,9 @@ - - product_template_form_view + + product_form_view product.template - +
@@ -11,17 +11,39 @@
- - - - + + + + + +
+ + + product_template_form_view + product.template + + + + + + product_product_form_view + product.product + + + + + + + product_xcategory_form_view