diff --git a/modules/stock/delivery_note.fodt b/modules/stock/delivery_note.fodt index c0d57e9c2c..da448255cb 100644 --- a/modules/stock/delivery_note.fodt +++ b/modules/stock/delivery_note.fodt @@ -514,7 +514,7 @@ - <for each="move in shipment.outgoing_moves"> + <for each="move in moves(shipment)"> diff --git a/modules/stock/shipment.py b/modules/stock/shipment.py index e21e6288c0..0a4034b47c 100644 --- a/modules/stock/shipment.py +++ b/modules/stock/shipment.py @@ -3033,23 +3033,8 @@ class AssignPartial(ModelView): help="The moves that were not assigned.") -class DeliveryNote(CompanyReport): - 'Delivery Note' - __name__ = 'stock.shipment.out.delivery_note' - - @classmethod - def execute(cls, ids, data): - with Transaction().set_context(address_with_party=False): - return super(DeliveryNote, cls).execute(ids, data) - - class ShipmentReport(CompanyReport): - @classmethod - def execute(cls, ids, data): - with Transaction().set_context(address_with_party=True): - return super(ShipmentReport, cls).execute(ids, data) - @classmethod def moves(cls, shipment): raise NotImplementedError @@ -3065,6 +3050,25 @@ class ShipmentReport(CompanyReport): return report_context +class DeliveryNote(ShipmentReport): + 'Delivery Note' + __name__ = 'stock.shipment.out.delivery_note' + + @classmethod + def execute(cls, ids, data): + with Transaction().set_context(address_with_party=False): + return super(DeliveryNote, cls).execute(ids, data) + + @classmethod + def moves(cls, shipment): + moves = shipment.outgoing_moves + return sort(moves, cls.moves_order(shipment)) + + @classmethod + def moves_order(cls, shipment): + return shipment.__class__.outgoing_moves.order + + class PickingList(ShipmentReport): 'Picking List' __name__ = 'stock.shipment.out.picking_list' @@ -3120,6 +3124,11 @@ class InteralShipmentReport(ShipmentReport): 'Interal Shipment Report' __name__ = 'stock.shipment.internal.report' + @classmethod + def execute(cls, ids, data): + with Transaction().set_context(address_with_party=True): + return super(ShipmentReport, cls).execute(ids, data) + @classmethod def moves(cls, shipment): if shipment.transit_location: