add signature to delivery_sheet
							parent
							
								
									5cbac414a1
								
							
						
					
					
						commit
						9039f1aea3
					
				|  | @ -46,6 +46,7 @@ | |||
|         'wizards/wizard_confirm_production.xml', | ||||
|         'wizards/wizard_import_tzbox.xml', | ||||
|         'wizards/wizard_reset_order.xml', | ||||
|         'wizards/wizard_sign_delivery.xml', | ||||
|         'wizards/portal_assign_company.xml', | ||||
|         'wizards/wizard_confirm_print_invoice.xml', | ||||
|         'security/security.xml', | ||||
|  | @ -55,11 +56,13 @@ | |||
|         'data/tz_tax_data.xml', | ||||
|         'data/cron_job.xml', | ||||
|         'data/tz_config_data.xml', | ||||
|         'data/mail_template_data.xml', | ||||
|         'views/dp_template.xml', | ||||
|         'views/dp_custom_views.xml', | ||||
|         'views/res_line_views.xml', | ||||
|         'views/res_partner_views.xml', | ||||
|         'views/stock_views.xml', | ||||
|         'views/stock_picking_views.xml', | ||||
|         'views/sale_views.xml', | ||||
|         'views/account_views.xml', | ||||
|         'views/material_type_views.xml', | ||||
|  | @ -67,6 +70,7 @@ | |||
|         'views/ir_attachment_views.xml', | ||||
|         'views/res_company_views.xml', | ||||
|         'views/res_users_views.xml', | ||||
|         'views/delivery_view.xml', | ||||
|         'security/ir.model.access.csv', | ||||
|     ], | ||||
|     'installable': True, | ||||
|  |  | |||
|  | @ -0,0 +1,89 @@ | |||
| <?xml version='1.0' encoding='utf-8'?> | ||||
| <odoo> | ||||
|   <data noupdate="1"> | ||||
|     <record id="mail_template_data_confirmation_to_office" model="mail.template"> | ||||
|       <field name="name">Delivery: Info to Office</field> | ||||
|       <field name="subject">${object.company_id.name} Delivery Order (Ref ${object.name or 'n/a' })</field> | ||||
|       <field name="partner_to">${object.partner_id.id}</field> | ||||
|       <field name="model_id" ref="delivery.model_stock_picking"/> | ||||
|       <field name="report_template" ref="stock.action_report_delivery"/> | ||||
|       <field name="report_name">${(object.name or '').replace('/','_')}</field> | ||||
|       <field name="lang">${object.partner_id.lang}</field> | ||||
|       <field name="body_html" type="xml"> | ||||
| <p>Dear ${object.partner_id.name},</p> | ||||
| <p>We are glad to inform you that your order has been shipped.</p> | ||||
| <p> | ||||
| %if object.carrier_tracking_ref: | ||||
|   Your tracking reference: | ||||
|   %if object.carrier_tracking_url: | ||||
|     <a href="${object.carrier_tracking_url}" target="_blank">${object.carrier_tracking_ref}</a>. | ||||
|   %else: | ||||
|     ${object.carrier_tracking_ref}. | ||||
|   %endif | ||||
| %endif | ||||
| </p> | ||||
| <p>Find your delivery order attached for more details.</p> | ||||
| <p>Thank you,</p> | ||||
|       </field> | ||||
|     </record> | ||||
|     <!--Email Notification template for Delivery--> | ||||
|     <record id="mail_template_data_notification_to_office" model="mail.template"> | ||||
|       <field name="name">Delivery: Custom Notification Email</field> | ||||
|       <field name="subject">${object.subject}</field> | ||||
|       <field name="model_id" ref="mail.model_mail_message"/> | ||||
|       <field name="auto_delete" eval="True"/> | ||||
|       <field name="body_html" type="xml"> | ||||
|         <table border="0" width="100%" cellpadding="0" bgcolor="#ededed" style="font-family:Arial,Helvetica,sans-serif; padding: 20px; background-color: #ededed" summary="o_mail_notification"> | ||||
|           <tbody> | ||||
|             <!-- HEADER --> | ||||
|             <tr> | ||||
|               <td align="center" style="min-width: 590px;"> | ||||
|                 <table width="650" border="0" cellpadding="0" bgcolor="#875A7B" style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px;"> | ||||
|                   <tr> | ||||
|                     <td valign="middle"> | ||||
|                       <span style="font-size:20px; color:white; font-weight: bold;">${object.record_name}</span> | ||||
|                     </td> | ||||
|                     <td valign="middle" align="right"> | ||||
|                       <img src="/logo.png" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}"/> | ||||
|                     </td> | ||||
|                   </tr> | ||||
|                 </table> | ||||
|               </td> | ||||
|             </tr> | ||||
|             <!-- CONTENT --> | ||||
|             <tr> | ||||
|               <td align="center" style="min-width: 590px;"> | ||||
|                 <table width="650" border="0" cellpadding="0" bgcolor="#ffffff" style="min-width: 590px; background-color: rgb(255, 255, 255); padding: 20px;"> | ||||
|                   <tbody> | ||||
|                     <td valign="top" style="color: #555; font-size: 14px;">${object.body | safe}</td> | ||||
|                   </tbody> | ||||
|                 </table> | ||||
|               </td> | ||||
|             </tr> | ||||
|             <!-- FOOTER --> | ||||
|             <tr> | ||||
|               <td align="center" style="min-width: 590px;"> | ||||
|                 <table width="650" border="0" cellpadding="0" bgcolor="#875A7B" style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px;"> | ||||
|                   <tr> | ||||
|                     <td valign="middle" align="left" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;">${user.company_id.name}<br/>${user.company_id.phone or ''}</td> | ||||
|                     <td valign="middle" align="right" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"> | ||||
|                       % if user.company_id.email: | ||||
|                       <a href="mailto:${user.company_id.email}" style="text-decoration:none; color: white;">${user.company_id.email}</a><br/> | ||||
|                       % endif | ||||
|                       % if user.company_id.website: | ||||
|                         <a href="${user.company_id.website}" style="text-decoration:none; color: white;">${user.company_id.website}</a> | ||||
|                       % endif | ||||
|                     </td> | ||||
|                   </tr> | ||||
|                 </table> | ||||
|               </td> | ||||
|             </tr> | ||||
|             <tr> | ||||
|               <td align="center">Powered by <a href="https://www.odoo.com">Odoo</a>.</td> | ||||
|             </tr> | ||||
|           </tbody> | ||||
|         </table> | ||||
|       </field> | ||||
|     </record> | ||||
|   </data> | ||||
| </odoo> | ||||
|  | @ -194,3 +194,39 @@ msgstr "" | |||
| "Odoo hilft Ihnen alle Aktivitäten zu einem Kunden\n" | ||||
| "leicht zu überblicken: Diskussionen, Verlauf der \n" | ||||
| "Geschäftschancen, Dokumente, usw." | ||||
| 
 | ||||
| #. module: dp_custom | ||||
| #: model:mail.template,report_name:dp_custom.mail_template_data_confirmation_to_office | ||||
| msgid "${(object.name or '').replace('/','_')}" | ||||
| msgstr "${(object.name or '').replace('/','_')}" | ||||
| 
 | ||||
| #. module: dp_custom | ||||
| #: model:mail.template,subject:dp_custom.mail_template_data_confirmation_to_office | ||||
| msgid "" | ||||
| "${object.company_id.name} Delivery Order (Ref ${object.name or 'n/a' })" | ||||
| msgstr "" | ||||
| "${object.company_id.name} Lieferschein (Ref. ${object.name or 'n/a' })" | ||||
| 
 | ||||
| #. module: dp_custom | ||||
| #: model:mail.template,subject:dp_custom.mail_template_data_notification_to_office | ||||
| msgid "${object.subject}" | ||||
| msgstr "${object.subject}" | ||||
| 
 | ||||
| #. module: dp_custom | ||||
| #: model:mail.template,body_html:dp_custom.mail_template_data_confirmation_to_office | ||||
| msgid "" | ||||
| "<?xml version=\"1.0\"?>\n" | ||||
| "<data><p>Shopping Cart XYZ, Delivery Note ${object.name or 'n/a' } has been picked up by ${object.partner_id.name},</p>\n" | ||||
| "<p>\n" | ||||
| "<p>Find the delivery order attached for more details.</p>\n" | ||||
| "<p>Thank you,</p>\n" | ||||
| "      </data>" | ||||
| msgstr "" | ||||
| "<?xml version=\"1.0\"?>\n" | ||||
| "<data><p>Der Warenkorb XYZ, Lieferschein ${object.name or 'n/a' } wurde von ${object.partner_id.name} abgeholt,</p>\n" | ||||
| "<p>\n" | ||||
| "<p>Weitere Informationen finden Sie im angehängten Lieferschein.</p>\n" | ||||
| "<p>Vielen Dank,</p>\n" | ||||
| "      </data>" | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -25,6 +25,7 @@ from . import res_partner | |||
| from . import res_company | ||||
| from . import res_line | ||||
| from . import stock | ||||
| from . import stock_picking | ||||
| from . import sale | ||||
| from . import material_type | ||||
| from . import product | ||||
|  |  | |||
|  | @ -26,6 +26,7 @@ class Attachment(models.Model): | |||
|     _inherit = 'ir.attachment' | ||||
| 
 | ||||
|     from_designbox = fields.Boolean(string='Import von Designbox', readonly=True) | ||||
|     customer_signed = fields.Boolean(string='Unterschrift vom Kunden', readonly=True) | ||||
| 
 | ||||
|     @api.multi | ||||
|     def write(self, vals): | ||||
|  | @ -33,6 +34,9 @@ class Attachment(models.Model): | |||
|             if record.from_designbox and not self.env.user.has_group('dp_custom.group_allow_delete_so_attachments'): | ||||
|                 raise ValidationError( | ||||
|                     _("Dokumente, die aus der Designbox importiert wurden, können nicht gelöscht werden.")) | ||||
|             if record.customer_signed and not self.env.user.has_group('dp_custom.group_allow_delete_signature'): | ||||
|                 raise ValidationError( | ||||
|                     _("Unterschriften des Kunden können nicht gelöscht werden.")) | ||||
| 
 | ||||
|         return super(Attachment, self).write(vals) | ||||
| 
 | ||||
|  | @ -42,5 +46,8 @@ class Attachment(models.Model): | |||
|             if record.from_designbox and not self.env.user.has_group('dp_custom.group_allow_delete_so_attachments'): | ||||
|                 raise ValidationError( | ||||
|                     _("Dokumente, die aus der Designbox importiert wurden, können nicht gelöscht werden.")) | ||||
|             if record.customer_signed and not self.env.user.has_group('dp_custom.group_allow_delete_signature'): | ||||
|                 raise ValidationError( | ||||
|                     _("Unterschriften des Kunden können nicht gelöscht werden.")) | ||||
| 
 | ||||
|         return super(Attachment, self).unlink() | ||||
|  |  | |||
|  | @ -80,7 +80,7 @@ class Partner(models.Model): | |||
|                                                               'Sobald das Unternehmen manuell zugewiesen wurde, ' | ||||
|                                                               'wird das Flag wieder entfernt') | ||||
|     line_ids = fields.Many2many(comodel_name='res.line', string='Produktionslinien') | ||||
|     portal_id = fields.Char(string='Portal-ID',copy=False) | ||||
|     portal_id = fields.Char(string='Portal-ID',copy=False,track_visibility='onchange') | ||||
|     partner_sector_id = fields.Many2one(comodel_name='res.partner.sector', string='Branche') | ||||
|     active = fields.Boolean(track_visibility='onchange') | ||||
|     portal_export_pending = fields.Boolean(string='Portal Export ausständig') | ||||
|  |  | |||
|  | @ -22,7 +22,7 @@ | |||
| from odoo import fields, models, api, tools, _ | ||||
| from odoo.exceptions import ValidationError | ||||
| from odoo.tools.float_utils import float_compare, float_is_zero | ||||
| 
 | ||||
| import base64 | ||||
| 
 | ||||
| class StockProductionLot(models.Model): | ||||
|     _inherit = 'stock.production.lot' | ||||
|  | @ -54,13 +54,61 @@ class StockPicking(models.Model): | |||
|     _inherit = 'stock.picking' | ||||
| 
 | ||||
|     dlv_partner_ref = fields.Text(compute='_get_partner_ref', store=False, string='Interne Referenz') | ||||
|     picking_signature = fields.Binary(string='Customer Signature') | ||||
|     picking_signature = fields.Binary(string='Customer Signature', default=None) | ||||
|     shopping_cart_ref = fields.Text(compute='_get_shopping_cart_ref', store=True, string='Warenkorb') | ||||
| 
 | ||||
|     @api.multi | ||||
|     def write(self, vals): | ||||
| 
 | ||||
|         if 'picking_signature' in vals: | ||||
|             msg = '' | ||||
|             prime_signature = "" | ||||
|             if not vals['picking_signature'] or len(vals['picking_signature']) == 3012: | ||||
|                 if self['picking_signature'] or len(self['picking_signature']) == 3012: | ||||
|                     prime_signature = self['picking_signature'] | ||||
|                     msg='Unterschrift wurde entfernt' | ||||
|             else: | ||||
|                 if not self['picking_signature'] or len(self['picking_signature']) == 3012: | ||||
|                     prime_signature = vals['picking_signature'] | ||||
|                     msg='Lieferschein wurde unterschrieben' | ||||
|                 elif vals['picking_signature'] != self['picking_signature'].decode(): | ||||
|                     prime_signature = vals['picking_signature'] | ||||
|                     msg='Unterschrift wurde geändert' | ||||
| 
 | ||||
|             if msg != '': | ||||
| #                signature2attach = [] | ||||
|                 ps = prime_signature.encode('ascii') | ||||
|                 signature2attach = { | ||||
|                     "filename": r'Signature.jpg', | ||||
|                     "binary" : ps | ||||
|                 } | ||||
|                 self.create_attachment(signature2attach) | ||||
|                 self.message_post(body=msg) | ||||
| 
 | ||||
|         return super(StockPicking, self).write(vals) | ||||
| 
 | ||||
|     @api.model | ||||
|     def create_attachment(self, vals): | ||||
|         attachment_vals = { | ||||
|             'name': vals['filename'], | ||||
|             'datas': vals['binary'], | ||||
|             'datas_fname': vals['filename'], | ||||
|             'res_model': self._name, | ||||
|             'res_id': self.id, | ||||
|             'customer_signed' : True, | ||||
|         } | ||||
|         self.env['ir.attachment'].create(attachment_vals) | ||||
| 
 | ||||
|     @api.multi | ||||
|     def _get_partner_ref(self): | ||||
|         for record in self: | ||||
|             record.dlv_partner_ref = record.partner_id.ref | ||||
| 
 | ||||
|     @api.multi | ||||
|     def _get_shopping_cart_ref(self): | ||||
|         for record in self: | ||||
|             record.shopping_cart_ref = record.sale_id.origin | ||||
| 
 | ||||
|     @api.model | ||||
|     def _formatLang(self, value): | ||||
|         lang = self.partner_id.lang | ||||
|  |  | |||
|  | @ -0,0 +1,33 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # Part of Odoo. See LICENSE file for full copyright and licensing details. | ||||
| 
 | ||||
| from odoo import models, fields, api, _ | ||||
| from odoo.exceptions import UserError | ||||
| 
 | ||||
| 
 | ||||
| class StockPicking(models.Model): | ||||
|     _inherit = 'stock.picking' | ||||
| 
 | ||||
|     @api.multi | ||||
|     def action_send_confirmation_to_office(self): | ||||
|         self.ensure_one() | ||||
|         delivery_template_id = self.env.ref('dp_custom.mail_template_data_confirmation_to_office').id | ||||
|         compose_form_id = self.env.ref('mail.email_compose_message_wizard_form').id | ||||
|         ctx = dict( | ||||
|             default_composition_mode='comment', | ||||
|             default_res_id=self.id, | ||||
|             default_model='stock.picking', | ||||
|             default_use_template=bool(delivery_template_id), | ||||
|             default_template_id=delivery_template_id, | ||||
|             custom_layout='dp_custom.mail_template_data_notification_to_office' | ||||
|         ) | ||||
|         return { | ||||
|             'type': 'ir.actions.act_window', | ||||
|             'view_type': 'form', | ||||
|             'view_mode': 'form', | ||||
|             'res_model': 'mail.compose.message', | ||||
|             'view_id': compose_form_id, | ||||
|             'target': 'new', | ||||
|             'context': ctx, | ||||
|         } | ||||
| 
 | ||||
|  | @ -1,5 +1,9 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <odoo> | ||||
|     <record id="group_allow_delete_signature" model="res.groups"> | ||||
|         <field name="name">Löschen von Unterschriften in Lieferscheinen erlauben</field> | ||||
|         <field name="comment">Löschen von Unterschriften in Lieferscheinen erlauben</field> | ||||
|     </record> | ||||
|     <record id="group_allow_delete_so_attachments" model="res.groups"> | ||||
|         <field name="name">Löschen von Anhängen in Angeboten erlauben</field> | ||||
|         <field name="comment">Löschen von Anhängen in Angeboten erlauben</field> | ||||
|  |  | |||
|  | @ -0,0 +1,17 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <odoo> | ||||
| 
 | ||||
|         <record id="view_picking_withcarrier_out_form" model="ir.ui.view"> | ||||
|             <field name="name">delivery.stock.picking_withcarrier.form.view</field> | ||||
|             <field name="model">stock.picking</field> | ||||
|             <field name="inherit_id" ref="stock.view_picking_form"/> | ||||
|             <field name="arch" type="xml"> | ||||
|               <data> | ||||
|                 <xpath expr="//button[@name='do_print_picking']" position="after"> | ||||
|                     <button name="action_send_confirmation_to_office" string="Confirmation to Office" type="object" attrs="{'invisible':['|', ('state', '!=', 'done'),]}"/> | ||||
|                 </xpath> | ||||
|               </data> | ||||
|             </field> | ||||
|         </record> | ||||
| 
 | ||||
| </odoo> | ||||
|  | @ -0,0 +1,13 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <odoo> | ||||
|         <record id="view_picking_internal_search" model="ir.ui.view"> | ||||
|             <field name="name">stock.picking.internal.search</field> | ||||
|             <field name="model">stock.picking</field> | ||||
|             <field name="inherit_id" ref="stock.view_picking_internal_search"/> | ||||
|             <field name="arch" type="xml"> | ||||
|                 <field name="partner_id" position="after"> | ||||
|                     <field name="shopping_cart_ref"  string="Warenkorb" filter_domain="[('shopping_cart_ref','ilike',self)]"/> | ||||
|                 </field> | ||||
|             </field> | ||||
|         </record> | ||||
| </odoo> | ||||
|  | @ -33,11 +33,15 @@ | |||
|             <field name="partner_id" position="after"> | ||||
|                 <field name="dlv_partner_ref" string="Interne Referenz"/> | ||||
|             </field> | ||||
|             <xpath expr="//field[@name='origin']" position="after"> | ||||
|             <field name="origin" position="after"> | ||||
|                 <field name="shopping_cart_ref" string="Warenkorb" attrs="{'readonly': True}"/> | ||||
|                 <label for="picking_signature" string="Signature" class="oe_edit_only"/> | ||||
|                 <h2> | ||||
|                     <field name="picking_signature" widget="signature"/> | ||||
|                     <field name="picking_signature" widget="signature" style="width: 500px; height: 200px"/> | ||||
|                 </h2> | ||||
|             </field> | ||||
|             <xpath expr="//button[@name='do_print_picking']" position="before"> | ||||
|                 <button name="%(dp_custom.action_wizard_sign_delivery)d" type="action" string="Sign Delivery" attrs="{'invisible':['|', ('state', '!=', 'done'),]}"/> | ||||
|             </xpath> | ||||
|             <xpath expr="//field[@name='move_lines']/tree//field[@name='product_id']" position="after"> | ||||
|                 <field name="manu_lots_visible" invisible="1"/> | ||||
|  |  | |||
|  | @ -4,4 +4,5 @@ from . import wizard_confirm_null_invoice | |||
| from . import wizard_confirm_print_invoice | ||||
| from . import portal_assign_company | ||||
| from . import wizard_reset_order | ||||
| from . import wizard_sign_delivery | ||||
| 
 | ||||
|  |  | |||
|  | @ -309,6 +309,17 @@ | |||
|                             available. | ||||
|                         </t> | ||||
|                     </p> | ||||
| 
 | ||||
|                     <div class="col-xs-5 text-right"> | ||||
|                         <p t-if="o.picking_signature"> | ||||
| 
 | ||||
|                             Signature | ||||
| 
 | ||||
|                         </p> | ||||
|                         <img t-if="o.picking_signature" t-att-src="'data:image/png;base64,%s' % o.picking_signature.decode()" | ||||
|                              style="max-height: 85px;"/> | ||||
|                     </div> | ||||
| 
 | ||||
|                 </div> | ||||
|             </t> | ||||
|         </template> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue