03.02.26
This commit is contained in:
@@ -710,14 +710,21 @@ class ShipmentIn(metaclass=PoolMeta):
|
|||||||
|
|
||||||
for sh in shipments:
|
for sh in shipments:
|
||||||
sh.result = "Email not sent"
|
sh.result = "Email not sent"
|
||||||
attachment = None
|
attachment = []
|
||||||
if sh.add_bl:
|
if sh.add_bl:
|
||||||
attachments = Attachment.search([
|
attachments = Attachment.search([
|
||||||
('resource', '=', 'stock.shipment.in,' + str(sh.id)),
|
('resource', '=', 'stock.shipment.in,' + str(sh.id)),
|
||||||
])
|
])
|
||||||
if attachments:
|
if attachments:
|
||||||
attachment = attachments[0]
|
content_b64 = base64.b64encode(attachments[0].data).decode('ascii')
|
||||||
|
attachment = [
|
||||||
|
{
|
||||||
|
"filename": attachments[0].name,
|
||||||
|
"content": content_b64,
|
||||||
|
"content_type": attachments[0].mimetype or "application/pdf"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
if sh.controller:
|
if sh.controller:
|
||||||
Contact = Pool().get('party.contact_mechanism')
|
Contact = Pool().get('party.contact_mechanism')
|
||||||
contact = Contact.search(['party','=',sh.controller.id])
|
contact = Contact.search(['party','=',sh.controller.id])
|
||||||
@@ -726,13 +733,7 @@ class ShipmentIn(metaclass=PoolMeta):
|
|||||||
"to": [contact[0].value],
|
"to": [contact[0].value],
|
||||||
"subject": "Request for control",
|
"subject": "Request for control",
|
||||||
"body": sh.html_to_text(sh.instructions),
|
"body": sh.html_to_text(sh.instructions),
|
||||||
"attachments": [
|
"attachments": attachment,
|
||||||
{
|
|
||||||
"filename": attachment.name,
|
|
||||||
"content": attachment.data,
|
|
||||||
"content_type": "application/pdf"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"meta": {
|
"meta": {
|
||||||
"shipment": sh.bl_number,
|
"shipment": sh.bl_number,
|
||||||
"controller": sh.controller.id
|
"controller": sh.controller.id
|
||||||
|
|||||||
Reference in New Issue
Block a user