diff --git a/ext/custom-addons/dp_custom/models/res_partner.py b/ext/custom-addons/dp_custom/models/res_partner.py index 64ca2398..3659a054 100644 --- a/ext/custom-addons/dp_custom/models/res_partner.py +++ b/ext/custom-addons/dp_custom/models/res_partner.py @@ -231,7 +231,9 @@ class Partner(models.Model): vals['active'] = False vals['is_company'] = True vals['portal_pending'] = True - vals['root'] = True + if not vals.get('root'): + vals['root'] = True + # send mail activity to usergroup(with group 'informieren bei neuem Portalkunden, if new company was created recordset = self.create(vals) @@ -476,7 +478,7 @@ class Partner(models.Model): def _get_specified_fields(self): common_list = ['street', 'street2', 'zip', 'city', 'country_id', 'fax', 'phone', 'mobile', 'endkunde', 'line_ids', 'lang', 'portal_id', 'email', 'opt_out', - 'property_product_pricelist', 'property_product_pricelist_id', 'portal_managed_pricelist'] + 'property_product_pricelist', 'property_product_pricelist_id', 'portal_managed_pricelist','root'] if self.env.context.get('sst_1', False): common_list.extend(['name', 'name2', 'info_kundennr', 'info_uid', 'comment', 'retail_partner_id']) return common_list @@ -487,7 +489,7 @@ class Partner(models.Model): 'is_retailer', 'name2', 'carrier_id', 'collective_bill', 'fiscal_position', 'partner_flash']) return common_list elif self.env.context.get('sst_14', False): - common_list = ['firstname', 'lastname', 'midname', 'email', 'company_odoo_id', 'portal_id', 'opt_out', 'property_product_pricelist'] + common_list = ['firstname', 'lastname', 'midname', 'email', 'company_odoo_id', 'portal_id', 'opt_out', 'property_product_pricelist','root'] return common_list elif self.env.context.get('sst_16', False): common_list = ['company_odoo_id', 'portal_id', 'portal_managed_pricelist','property_product_pricelist','property_product_pricelist_id'] @@ -581,6 +583,7 @@ class Partner(models.Model): 'customer_id': lPortal_id, 'pricelist_id': pricelist.id, 'pricelist_name': pricelist.name, + 'portal_prefix': self.env.user.company_id.portal_prefix, } portal_url = tools.config.get('portal_url') @@ -602,6 +605,9 @@ class Partner(models.Model): @api.multi def write(self, vals): + if not self.company_id and self.user_ids and self.env.uid != 1: + raise ValidationError(_('Dieser Datensatz gehört zu einem Benutzer und darf nur vom System-Administrator bearbeitet werden!')) + fields_to_check = ['ref', 'portal_id'] for field in fields_to_check: if field in vals and vals[field] == '': diff --git a/ext/custom-addons/tz_reports_production/reports/report_production.xml b/ext/custom-addons/tz_reports_production/reports/report_production.xml index 48dfa438..37af54b5 100644 --- a/ext/custom-addons/tz_reports_production/reports/report_production.xml +++ b/ext/custom-addons/tz_reports_production/reports/report_production.xml @@ -118,7 +118,7 @@ Pos. - + # Artikel