show pg9_complete for usergroup "dp_custom.group_allow_change_pg_status"; finetuning signature for delivery sheet
							parent
							
								
									1e8343255a
								
							
						
					
					
						commit
						0544c3b2bf
					
				|  | @ -56,6 +56,26 @@ class StockPicking(models.Model): | |||
|     dlv_partner_ref = fields.Text(compute='_get_partner_ref', store=False, string='Interne Referenz') | ||||
|     picking_signature = fields.Binary(string='Customer Signature', default=None) | ||||
|     shopping_cart_ref = fields.Text(compute='_get_shopping_cart_ref', store=True, string='Warenkorb') | ||||
|     free_over = fields.Boolean(help="If the order total amount (shipping excluded) is above or equal to this value, the customer benefits from a free shipping \nIf this value = 0, no freight item is added to the order") | ||||
|     show_to_sign = fields.Text( | ||||
|         compute='_compute_show_to_sign', | ||||
|         help='Technical field used to compute whether the to_sign should be shown.') | ||||
| 
 | ||||
|     @api.multi | ||||
|     @api.depends('state', 'picking_signature') | ||||
|     def _compute_show_to_sign(self): | ||||
|         for picking in self: | ||||
|             picking.show_to_sign = '' | ||||
|             if picking.picking_signature == '' or picking.picking_signature == None or len(self['picking_signature']) == 3012: | ||||
|                 picking.show_to_sign = 'btn-primary' | ||||
| 
 | ||||
|     @api.multi | ||||
|     def _add_delivery_cost_to_so(self): | ||||
|         self.ensure_one() | ||||
|         sale_order = self.sale_id | ||||
|         if sale_order.invoice_shipping_on_delivery and not (self.carrier_id.free_over and self.carrier_id.amount < 0.001): | ||||
|             sale_order._create_delivery_line(self.carrier_id, self.carrier_price) | ||||
| 
 | ||||
| 
 | ||||
|     @api.multi | ||||
|     def write(self, vals): | ||||
|  |  | |||
|  | @ -43,7 +43,9 @@ | |||
|                 <field name="order_type"/> | ||||
|                 <field name="assembly_state" groups="dp_custom.group_allow_change_pg_status"/> | ||||
|                 <field name="assembly_state" attrs="{'readonly': True}" groups="!dp_custom.group_allow_change_pg_status"/> | ||||
| <!-- | ||||
|                 <field name="pg9_complete" groups="dp_custom.group_allow_change_pg_status"/> | ||||
| 
 | ||||
|                 <!-- | ||||
|                 <field name="pg9_call" widget="url" text="...gehe zu Auftrag in PG9" | ||||
|                        attrs="{'invisible': [('order_type','not in',['T','D']),('assembly_state','in',['','created','failed'])]}"/> | ||||
| --> | ||||
|  |  | |||
|  | @ -38,10 +38,14 @@ | |||
|                 <label for="picking_signature" string="Signature" class="oe_edit_only"/> | ||||
|                 <h2> | ||||
|                     <field name="picking_signature" widget="signature" style="width: 500px; height: 200px"/> | ||||
|                     <field name="show_to_sign" attrs="{'invisible':True}"/> | ||||
|                 </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'),]}"/> | ||||
|                 <button name="%(dp_custom.action_wizard_sign_delivery)d" type="action" string="Sign Delivery" | ||||
|                         attrs="{'invisible':['|',('state', '!=', 'done'),('show_to_sign', '=', 'btn-primary')]}"/> | ||||
|                 <button name="%(dp_custom.action_wizard_sign_delivery)d" type="action" string="Sign Delivery" | ||||
|                         attrs="{'invisible':['|',('state', '!=', 'done'),('show_to_sign', '!=', 'btn-primary')]}" class="btn-primary"/> | ||||
|             </xpath> | ||||
|             <xpath expr="//field[@name='move_lines']/tree//field[@name='product_id']" position="after"> | ||||
|                 <field name="manu_lots_visible" invisible="1"/> | ||||
|  |  | |||
|  | @ -4,9 +4,6 @@ | |||
| from odoo import tools, api, fields, models, _ | ||||
| from odoo.exceptions import ValidationError, UserError, Warning | ||||
| 
 | ||||
| import json | ||||
| import requests | ||||
| 
 | ||||
| class WizardSignDelivery(models.TransientModel): | ||||
|     _name = 'wizard.sign_delivery' | ||||
|     _description = 'Sign Delivery' | ||||
|  | @ -31,27 +28,9 @@ class WizardSignDelivery(models.TransientModel): | |||
|                     raise ValidationError(_(info)) | ||||
| 
 | ||||
|                 for dlv in delivery: | ||||
|                     # msg = '' | ||||
|                     # if not wizard['picking_signature'] or len(wizard['picking_signature']) == 3012: | ||||
|                     #     if dlv['picking_signature'] or len(dlv['picking_signature']) == 3012: | ||||
|                     #         msg = 'X Unterschrift wurde entfernt' | ||||
|                     # else: | ||||
|                     #     if not dlv['picking_signature'] or len(dlv['picking_signature']) == 3012: | ||||
|                     #         msg = 'X Lieferschein wurde unterschrieben' | ||||
|                     #     elif wizard['picking_signature'] != dlv['picking_signature']: | ||||
|                     #         msg = 'X Unterschrift wurde geändert' | ||||
|                     # | ||||
|                     # if msg != '': | ||||
| 
 | ||||
|                     dlv.picking_signature = wizard['picking_signature'] | ||||
| #                    dlv.message_post(body=msg) | ||||
| 
 | ||||
|                 action = self.env.ref('stock.stock_picking_action_picking_type').read()[0] | ||||
|                 action['domain'] = [('id', 'in', active_ids)] | ||||
|                 action['context'] = [{}] | ||||
|             return action | ||||
| 
 | ||||
|     def sign_delivery_status(self, order_id): | ||||
|         info = 'Done' | ||||
| 
 | ||||
|         return info | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue