Use shipment report mixin for delivery note

This commit is contained in:
Cédric Krier committed 2024-04-18 14:49:14 +02:00
1 parent 53c0edfe05
commit 567719b1ab
2 files changed
+25 -16

No files matched your search

+1 -1
View File
@@ -514,7 +514,7 @@
</table:table-header-rows>
<table:table-row>
<table:table-cell table:style-name="Table1.A2" table:number-columns-spanned="2" office:value-type="string">
<text:p text:style-name="P11"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;move in shipment.outgoing_moves&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P11"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;move in moves(shipment)&quot;&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
</table:table-row>
+24 -15
View File
@@ -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: