fix autorelease (reset flag in res_confirmation_queue); mark pricelist as 'portal_managed'; change report_procuction (confirmation_nr)
							parent
							
								
									96e40b52da
								
							
						
					
					
						commit
						c7849069fa
					
				|  | @ -97,6 +97,8 @@ class Partner(models.Model): | ||||||
|         inverse="_inverse_product_pricelist", company_dependent=False,  # NOT A REAL PROPERTY |         inverse="_inverse_product_pricelist", company_dependent=False,  # NOT A REAL PROPERTY | ||||||
|         help="This pricelist will be used, instead of the default one, for sales to the current partner") |         help="This pricelist will be used, instead of the default one, for sales to the current partner") | ||||||
| 
 | 
 | ||||||
|  |     portal_managed_pricelist = fields.Boolean(string='Preisliste im Portal verwaltet', default=False) | ||||||
|  | 
 | ||||||
|     _sql_constraints = [ |     _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') |         ('portal_id_uniq', 'unique(portal_id)', 'Die Portal-ID muss eindeutig sein') | ||||||
|  | @ -183,7 +185,7 @@ class Partner(models.Model): | ||||||
| 
 | 
 | ||||||
| #        portal_url = tools.config.get('portal_url') | #        portal_url = tools.config.get('portal_url') | ||||||
| #        portal_url = self.env['ir.config_parameter'].sudo().get_param('ribbon.name') | #        portal_url = self.env['ir.config_parameter'].sudo().get_param('ribbon.name') | ||||||
|         portal_url = self.env['ir.config_parameter'].get_param('ribbon.name') | #        portal_url = self.env['ir.config_parameter'].get_param('ribbon.name') | ||||||
| 
 | 
 | ||||||
|         self.with_context(sst_1=True).check_not_specified_fields(vals) |         self.with_context(sst_1=True).check_not_specified_fields(vals) | ||||||
|         vals = self.correct_values(vals) |         vals = self.correct_values(vals) | ||||||
|  | @ -285,6 +287,27 @@ class Partner(models.Model): | ||||||
|                 partner.id) |                 partner.id) | ||||||
|         return True |         return True | ||||||
| 
 | 
 | ||||||
|  |     @api.model | ||||||
|  |     def portal_update_pricelist(self, vals): | ||||||
|  |         """ | ||||||
|  |         SST-16 | ||||||
|  |         :param vals: | ||||||
|  |         :return: | ||||||
|  |         """ | ||||||
|  |         self.with_context(sst_16=True).check_not_specified_fields(vals) | ||||||
|  |         vals = self.with_context(sst_16=True).correct_values(vals) | ||||||
|  |         portal_prefix = self.env.user.company_id.portal_prefix | ||||||
|  |         if portal_prefix: | ||||||
|  |             vals['portal_id'] = portal_prefix + '.' + vals['portal_id'] | ||||||
|  | 
 | ||||||
|  |         partner = self.with_context(active_test=False).search([('portal_id', '=', vals['portal_id'])]) | ||||||
|  |         if partner: | ||||||
|  |             if not partner.is_company: | ||||||
|  |                 raise ValidationError( | ||||||
|  |                     _("Der Partner mit der Internen Referenz '%s' ist kein Unternehmen") % vals['ref']) | ||||||
|  |             partner.write(vals) | ||||||
|  |         return True | ||||||
|  | 
 | ||||||
|     @api.model |     @api.model | ||||||
|     def correct_values(self, vals): |     def correct_values(self, vals): | ||||||
|         if vals.get('country_id', False): |         if vals.get('country_id', False): | ||||||
|  | @ -331,7 +354,16 @@ class Partner(models.Model): | ||||||
|                     _("Die Zahlungsbedingung mit dem Code \'%s\' kann nicht zugeordnet werden") % vals[ |                     _("Die Zahlungsbedingung mit dem Code \'%s\' kann nicht zugeordnet werden") % vals[ | ||||||
|                         'property_payment_term_id']) |                         'property_payment_term_id']) | ||||||
| 
 | 
 | ||||||
|         if vals.get('property_product_pricelist', False): |         if self.env.context.get('sst_16', False): | ||||||
|  |             product_pricelist = self.env['product.pricelist'].search( | ||||||
|  |                 [('name', '=', vals['property_product_pricelist']),('id', '=', vals['property_product_pricelist_id'])]) | ||||||
|  |             if product_pricelist: | ||||||
|  |                 vals['property_product_pricelist'] = vals['property_product_pricelist_id'] | ||||||
|  |                 del vals['property_product_pricelist_id'] | ||||||
|  |             else: | ||||||
|  |                 raise ValidationError(_("Die Preisliste \'%s\' mit der ID \'%s\' ist nicht vorhanden") % | ||||||
|  |                     vals['property_product_pricelist'],vals['property_product_pricelist']) | ||||||
|  |         elif vals.get('property_product_pricelist', False): | ||||||
|             product_pricelist = self.env['product.pricelist'].search( |             product_pricelist = self.env['product.pricelist'].search( | ||||||
|                 [('currency_id.name', '=', vals['property_product_pricelist'])]) |                 [('currency_id.name', '=', vals['property_product_pricelist'])]) | ||||||
|             if product_pricelist: |             if product_pricelist: | ||||||
|  | @ -405,7 +437,7 @@ class Partner(models.Model): | ||||||
|     @api.model |     @api.model | ||||||
|     def _get_specified_fields(self): |     def _get_specified_fields(self): | ||||||
|         common_list = ['street', 'street2', 'zip', 'city', 'country_id', 'fax', 'phone', 'mobile', |         common_list = ['street', 'street2', 'zip', 'city', 'country_id', 'fax', 'phone', 'mobile', | ||||||
|                        'endkunde', 'line_ids', 'lang', 'portal_id', 'email', 'opt_out', 'property_product_pricelist'] |                        'endkunde', 'line_ids', 'lang', 'portal_id', 'email', 'opt_out', 'property_product_pricelist', 'portal_managed_pricelist'] | ||||||
|         if self.env.context.get('sst_1', False): |         if self.env.context.get('sst_1', False): | ||||||
|             common_list.extend(['name', 'name2', 'info_kundennr', 'info_uid', 'comment', 'retail_partner_id']) |             common_list.extend(['name', 'name2', 'info_kundennr', 'info_uid', 'comment', 'retail_partner_id']) | ||||||
|             return common_list |             return common_list | ||||||
|  | @ -418,6 +450,9 @@ class Partner(models.Model): | ||||||
|         elif self.env.context.get('sst_14', False): |         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'] | ||||||
|             return common_list |             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'] | ||||||
|  |             return common_list | ||||||
|         elif self.env.context.get('delivery_partner', False): |         elif self.env.context.get('delivery_partner', False): | ||||||
|             common_list = ['firstname', 'lastname', 'midname', 'street', 'street2', 'zip', 'city', 'country_id', 'fax', |             common_list = ['firstname', 'lastname', 'midname', 'street', 'street2', 'zip', 'city', 'country_id', 'fax', | ||||||
|                            'phone', 'mobile', 'email', 'portal_id', 'property_product_pricelist'] |                            'phone', 'mobile', 'email', 'portal_id', 'property_product_pricelist'] | ||||||
|  | @ -452,6 +487,7 @@ 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 = [] |         data = [] | ||||||
|         for item in pricelist.item_ids: |         for item in pricelist.item_ids: | ||||||
|  | @ -463,7 +499,7 @@ class Partner(models.Model): | ||||||
|                 if item.applied_on == '0_product_variant': |                 if item.applied_on == '0_product_variant': | ||||||
|                     code = item.product_id.product_tmpl_id.default_code |                     code = item.product_id.product_tmpl_id.default_code | ||||||
|                 data.append({ |                 data.append({ | ||||||
|                     'customer_id': partner_id.commercial_partner_id.portal_id, |                     'customer_id': partner_id.commercial_partner_id.portal_id.split('.')[1], | ||||||
|                     'code': code, |                     'code': code, | ||||||
|                     'discount': 1 - (item.percent_price / 100) |                     'discount': 1 - (item.percent_price / 100) | ||||||
|                 }) |                 }) | ||||||
|  | @ -485,6 +521,12 @@ class Partner(models.Model): | ||||||
|         :param partner_id: |         :param partner_id: | ||||||
|         :return: |         :return: | ||||||
|         """ |         """ | ||||||
|  |         if partner_id.portal_managed_pricelist: | ||||||
|  |             return | ||||||
|  | 
 | ||||||
|  |         if not partner_id.portal_id: | ||||||
|  |             raise ValidationError(_("Der Partner mit der ID %s hat keine Portal-ID") % partner_id.id) | ||||||
|  | 
 | ||||||
|         try: |         try: | ||||||
|             _create_unverified_https_context = ssl._create_unverified_context |             _create_unverified_https_context = ssl._create_unverified_context | ||||||
|         except AttributeError: |         except AttributeError: | ||||||
|  | @ -494,9 +536,6 @@ class Partner(models.Model): | ||||||
|             # Handle target environment that doesn't support HTTPS verification |             # Handle target environment that doesn't support HTTPS verification | ||||||
|             ssl._create_default_https_context = _create_unverified_https_context |             ssl._create_default_https_context = _create_unverified_https_context | ||||||
| 
 | 
 | ||||||
|         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 |         pricelist = partner_id.property_product_pricelist | ||||||
|         lPortal_id = partner_id.commercial_partner_id.portal_id.split('.')[1] |         lPortal_id = partner_id.commercial_partner_id.portal_id.split('.')[1] | ||||||
|         data = { |         data = { | ||||||
|  |  | ||||||
|  | @ -71,15 +71,20 @@ class SaleOrder(models.Model): | ||||||
|     weight_total = fields.Float(string='Gesamtgewicht', compute='_compute_weight_total') |     weight_total = fields.Float(string='Gesamtgewicht', compute='_compute_weight_total') | ||||||
|     confirmation_nr = fields.Char('Freigabenummer',track_visibility='onchange') |     confirmation_nr = fields.Char('Freigabenummer',track_visibility='onchange') | ||||||
|     order_type = fields.Selection(ORDER_TYPES, string='Auftragsart', default='M') |     order_type = fields.Selection(ORDER_TYPES, string='Auftragsart', default='M') | ||||||
|     clerk_id = fields.Many2one('res.users', string='Sachbearbeiter', domain=[('clerk_name', '!=', '')]) |     clerk_id = fields.Many2one('res.users', string='Sachbearbeiter', domain=[('clerk_name', '!=', '')],track_visibility='onchange') | ||||||
|     desired_delivery_date = fields.Date(string='Wunschlieferdatum') |     desired_delivery_date = fields.Date(string='Wunschlieferdatum') | ||||||
|     delivery_date_warning = fields.Boolean(compute='_compute_dlv_date_warn', store=False) |     delivery_date_warning = fields.Boolean(compute='_compute_dlv_date_warn', store=False) | ||||||
|     warn_vat_date = fields.Boolean(compute='_get_vat_warn_date', store=False, default=False) |     warn_vat_date = fields.Boolean(compute='_get_vat_warn_date', store=False, default=False) | ||||||
|     date_vat_check = fields.Date(related='partner_invoice_id.date_vat_check') |     date_vat_check = fields.Date(related='partner_invoice_id.date_vat_check') | ||||||
|     vat = fields.Char(related='partner_invoice_id.vat') |     vat = fields.Char(related='partner_invoice_id.vat') | ||||||
| 
 | 
 | ||||||
|  |     client_order_ref = fields.Char(track_visibility='onchange') | ||||||
|     origin = fields.Char(track_visibility='onchange') |     origin = fields.Char(track_visibility='onchange') | ||||||
| 
 | 
 | ||||||
|  |     partner_id = fields.Many2one(track_visibility='onchange') | ||||||
|  |     partner_invoice_id = fields.Many2one(track_visibility='onchange') | ||||||
|  |     partner_shipping_id = fields.Many2one(track_visibility='onchange') | ||||||
|  | 
 | ||||||
| #    pg9_call = fields.Char(string='PG9-Auftrag', compute='_pg9_call', store=False) | #    pg9_call = fields.Char(string='PG9-Auftrag', compute='_pg9_call', store=False) | ||||||
|     pg9_call_D = fields.Char(string='PG9-Auftrag_D', compute='_pg9_call', store=False) |     pg9_call_D = fields.Char(string='PG9-Auftrag_D', compute='_pg9_call', store=False) | ||||||
|     pg9_call_T = fields.Char(string='PG9-Auftrag_T', compute='_pg9_call', store=False) |     pg9_call_T = fields.Char(string='PG9-Auftrag_T', compute='_pg9_call', store=False) | ||||||
|  | @ -269,6 +274,7 @@ class SaleOrder(models.Model): | ||||||
|             else: |             else: | ||||||
|                 cq = self.env['res.confirmation_queue'].search([('origin', '=', origin)]) |                 cq = self.env['res.confirmation_queue'].search([('origin', '=', origin)]) | ||||||
|                 if cq: |                 if cq: | ||||||
|  |                     vals['confirmation_processed'] = False | ||||||
|                     cq.write(vals) |                     cq.write(vals) | ||||||
|                 else: |                 else: | ||||||
|                     cq.create(vals) |                     cq.create(vals) | ||||||
|  | @ -587,7 +593,8 @@ class SaleOrder(models.Model): | ||||||
|             new_vals['name'] = new_name |             new_vals['name'] = new_name | ||||||
| 
 | 
 | ||||||
|         pg_release_mode = self.env['ir.config_parameter'].get_param('pg_release_mode','MANUAL') |         pg_release_mode = self.env['ir.config_parameter'].get_param('pg_release_mode','MANUAL') | ||||||
|         if (self.confirmation_nr and self.confirmation_nr != '') and self.order_type == 'D' and pg_release_mode == 'auto': |         if (self.confirmation_nr and self.confirmation_nr != '') and self.order_type == 'D' \ | ||||||
|  |                 and self.assembly_state == 'created' and pg_release_mode == 'auto': | ||||||
| #            self.assembly_state = 'approved' | #            self.assembly_state = 'approved' | ||||||
|             new_vals['assembly_state'] = 'approved' |             new_vals['assembly_state'] = 'approved' | ||||||
|             new_vals['message_post'] = 'PG9 autoreleased' |             new_vals['message_post'] = 'PG9 autoreleased' | ||||||
|  |  | ||||||
|  | @ -16,4 +16,8 @@ | ||||||
|         <field name="name">Ändern des PG-Status erlauben</field> |         <field name="name">Ändern des PG-Status erlauben</field> | ||||||
|         <field name="comment">Ändern des PG-Status erlauben</field> |         <field name="comment">Ändern des PG-Status erlauben</field> | ||||||
|     </record> |     </record> | ||||||
|  |     <record id="group_allow_change__portal_managed_pricelist" model="res.groups"> | ||||||
|  |         <field name="name">Ändern des Flags 'Preisliste im Portal verwaltet' erlauben</field> | ||||||
|  |         <field name="comment">Ändern des Flags 'Preisliste im Portal verwaltet' erlauben</field> | ||||||
|  |     </record> | ||||||
| </odoo> | </odoo> | ||||||
|  |  | ||||||
|  | @ -41,6 +41,15 @@ | ||||||
|                 <field name="fax" widget="phone" string="Fax"/> |                 <field name="fax" widget="phone" string="Fax"/> | ||||||
|             </xpath> |             </xpath> | ||||||
| 
 | 
 | ||||||
|  |             <xpath expr="//field[@name='property_product_pricelist']" position="attributes"> | ||||||
|  |                 <attribute name="attrs">{'readonly':[('portal_managed_pricelist', '=', True)]}</attribute> | ||||||
|  |             </xpath> | ||||||
|  | 
 | ||||||
|  |             <xpath expr="//field[@name='property_product_pricelist']" position="after"> | ||||||
|  |                 <field name="portal_managed_pricelist" groups="dp_custom.group_allow_change_portal_managed_pricelist"/> | ||||||
|  |                 <field name="portal_managed_pricelist" attrs="{'readonly': True}" groups="!dp_custom.group_allow_change_portal_managed_pricelist"/> | ||||||
|  |             </xpath> | ||||||
|  | 
 | ||||||
|             <field name="opt_out" position="attributes"> |             <field name="opt_out" position="attributes"> | ||||||
|                 <attribute name="groups"/> |                 <attribute name="groups"/> | ||||||
|             </field> |             </field> | ||||||
|  |  | ||||||
|  | @ -19,6 +19,7 @@ | ||||||
| 
 | 
 | ||||||
|     <template id="external_layout_custom"> |     <template id="external_layout_custom"> | ||||||
|         <t t-set="DlvLogo" t-value="False"/> |         <t t-set="DlvLogo" t-value="False"/> | ||||||
|  |         <t t-set="DlvRetailLogo" t-value="False"/> | ||||||
|         <t t-set="OcLogo" t-value="False"/> |         <t t-set="OcLogo" t-value="False"/> | ||||||
| <!-- | <!-- | ||||||
|         <t t-foreach="o.partner_id.retail_partner_id.category_id" t-as="cat"> |         <t t-foreach="o.partner_id.retail_partner_id.category_id" t-as="cat"> | ||||||
|  | @ -31,12 +32,19 @@ | ||||||
|         </t> |         </t> | ||||||
| --> | --> | ||||||
|         <t t-if="(o._name == 'stock.picking' and is_picking)"> |         <t t-if="(o._name == 'stock.picking' and is_picking)"> | ||||||
|             <t t-foreach="o.sale_id.partner_id.retail_partner_id.category_id" t-as="cat"> |             <t t-foreach="o.sale_id.partner_id.category_id" t-as="cat"> | ||||||
|                 <t t-if="cat.name == 'DlvLogo'"> |                 <t t-if="cat.name == 'DlvLogo'"> | ||||||
|                     <t t-set="DlvLogo" t-value="True"/> |                     <t t-set="DlvLogo" t-value="True"/> | ||||||
|                 </t> |                 </t> | ||||||
|             </t> |             </t> | ||||||
|         </t> |         </t> | ||||||
|  |         <t t-if="(o._name == 'stock.picking' and is_picking)"> | ||||||
|  |             <t t-foreach="o.sale_id.partner_id.retail_partner_id.category_id" t-as="cat"> | ||||||
|  |                 <t t-if="cat.name == 'DlvLogo'"> | ||||||
|  |                     <t t-set="DlvRetailLogo" t-value="True"/> | ||||||
|  |                 </t> | ||||||
|  |             </t> | ||||||
|  |         </t> | ||||||
|         <t t-if="(not (data or {}).get('tz_report_production', False) and o.state not in ['draft','sent'])"> |         <t t-if="(not (data or {}).get('tz_report_production', False) and o.state not in ['draft','sent'])"> | ||||||
|             <t t-foreach="o.partner_id.retail_partner_id.category_id" t-as="cat"> |             <t t-foreach="o.partner_id.retail_partner_id.category_id" t-as="cat"> | ||||||
|                 <t t-if="cat.name == 'OcLogo'"> |                 <t t-if="cat.name == 'OcLogo'"> | ||||||
|  |  | ||||||
|  | @ -85,10 +85,17 @@ | ||||||
|                         <span class="col-xs-2">Telefon:</span> |                         <span class="col-xs-2">Telefon:</span> | ||||||
|                     </strong> |                     </strong> | ||||||
|                     <span class="col-xs-3" t-field="o.user_id.phone"/> |                     <span class="col-xs-3" t-field="o.user_id.phone"/> | ||||||
|  |                     <strong> | ||||||
|  |                         <span class="col-xs-2">Freigabe-Nr:</span> | ||||||
|  |                     </strong> | ||||||
|  |                     <span class="col-xs-2" t-field="o.confirmation_nr"/> | ||||||
|  |                 </div> | ||||||
|  |                 <br/> | ||||||
|  |                 <div class="row"> | ||||||
|                     <strong> |                     <strong> | ||||||
|                         <span class="col-xs-2">Bezeichnung:</span> |                         <span class="col-xs-2">Bezeichnung:</span> | ||||||
|                     </strong> |                     </strong> | ||||||
|                     <span class="col-xs-2" t-field="o.client_order_ref"/> |                     <span class="col-xs-10" t-field="o.client_order_ref"/> | ||||||
|                 </div> |                 </div> | ||||||
|                 <div class="row mt32 dp_note"> |                 <div class="row mt32 dp_note"> | ||||||
|                     <p t-if="o.note1"> |                     <p t-if="o.note1"> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue