add signature to delivery_sheet
parent
9039f1aea3
commit
7e5f971c56
|
|
@ -0,0 +1,57 @@
|
||||||
|
# Copyright 2018-Today datenpol gmbh (<http://www.datenpol.at>)
|
||||||
|
# License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses).
|
||||||
|
|
||||||
|
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'
|
||||||
|
|
||||||
|
picking_signature = fields.Binary()
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def button_sign_delivery(self):
|
||||||
|
for wizard in self:
|
||||||
|
error_at_dlv = False
|
||||||
|
info = 'Bitte prüfen Sie den Lieferscheinstatus:'
|
||||||
|
active_ids = self.env.context.get('active_ids', [])
|
||||||
|
delivery = self.env['stock.picking'].browse(active_ids)
|
||||||
|
if delivery.exists():
|
||||||
|
for dlv in delivery:
|
||||||
|
if dlv.state != 'cancel':
|
||||||
|
info += "\n %s -- OK" % dlv.name
|
||||||
|
else:
|
||||||
|
info += "\n %s state='%s'" % (dlv.name,dlv.state)
|
||||||
|
error_at_dlv = True
|
||||||
|
if error_at_dlv:
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright 2018-Today datenpol gmbh(<http://www.datenpol.at>)
|
||||||
|
License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses). -->
|
||||||
|
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="view_wizard_sign_delivery_form" model="ir.ui.view">
|
||||||
|
<field name="name">view_wizard_sign_delivery_form</field>
|
||||||
|
<field name="model">wizard.sign_delivery</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Wizard Sign Delivery">
|
||||||
|
<p>Wollen Sie die markierten Lieferscheine unterschreiben?</p>
|
||||||
|
<field name="picking_signature" string="" widget="signature" style="width: 500px; height: 200px"/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<group>
|
||||||
|
<field name="name"/>
|
||||||
|
</group>
|
||||||
|
-->
|
||||||
|
<footer>
|
||||||
|
<button name="button_sign_delivery"
|
||||||
|
string="Lieferschein unterschreiben"
|
||||||
|
class="btn-primary"
|
||||||
|
type="object"/>
|
||||||
|
<button string="Abbrechen"
|
||||||
|
class="btn-default"
|
||||||
|
special="cancel"/>
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<act_window id="action_wizard_sign_delivery"
|
||||||
|
name="Lieferschein unterschreiben"
|
||||||
|
src_model="stock.picking"
|
||||||
|
res_model="wizard.sign_delivery"
|
||||||
|
view_type="form"
|
||||||
|
view_mode="form"
|
||||||
|
key2="client_action_multi"
|
||||||
|
target="new"/>
|
||||||
|
</odoo>
|
||||||
Loading…
Reference in New Issue