Add method to get shipment report.

This commit refs #21800
This commit is contained in:
Jesús Moreno Ramírez 2022-01-24 11:35:35 +01:00 committed by Sergio Morillo
parent 9a5efcdcb9
commit 330bf70d27

View file

@ -174,6 +174,10 @@ class ShipmentWebLinkMixin(object):
def get_to_email(self):
return self.warehouse.address.party.email
@classmethod
def get_weblink_report_file(cls, shipments):
raise NotImplementedError()
class ShipmentOut(ShipmentWebLinkMixin, metaclass=PoolMeta):
__name__ = 'stock.shipment.out'
@ -194,6 +198,13 @@ class ShipmentOut(ShipmentWebLinkMixin, metaclass=PoolMeta):
return self.get_email(
'stock.shipment.out.web_link', self, self.get_languages(user))
@classmethod
def get_weblink_report_file(cls, shipments):
ReportShipmentOut = Pool().get('stock.shipment.out.delivery_note',
type='report')
return ReportShipmentOut.execute(list(map(int, shipments)), {})
class ShipmentIn(ShipmentWebLinkMixin, metaclass=PoolMeta):
__name__ = 'stock.shipment.in'
@ -231,6 +242,13 @@ class ShipmentIn(ShipmentWebLinkMixin, metaclass=PoolMeta):
super(ShipmentIn, cls).send_link(shipments, length=length, from_=from_,
email=email, send_mail=send_mail, raise_error=raise_error)
@classmethod
def get_weblink_report_file(cls, shipments):
ReportShipmentIn = Pool().get('stock.shipment.in.delivery_receipt',
type='report')
return ReportShipmentIn.execute(list(map(int, shipments)), {})
class ShipmentInternal(ShipmentWebLinkMixin, metaclass=PoolMeta):
__name__ = 'stock.shipment.internal'
@ -254,6 +272,12 @@ class ShipmentInternal(ShipmentWebLinkMixin, metaclass=PoolMeta):
def get_to_email(self):
return self.company.party.email
@classmethod
def get_weblink_report_file(cls, shipments):
ReportShipmentInternal = Pool().get('stock.shipment.internal.report',
type='report')
return ReportShipmentInternal.execute(list(map(int, shipments)), {})
class SendLinkStart(ModelView):
"""Shipment Send Link Start"""