From 7cc2b40942d0f069b386e448c8f0df71e8191e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 26 Aug 2023 12:51:51 +0200 Subject: [PATCH] Display shipment state and warehouse country on delivery note Closes #12501 Closes #5224 --- modules/stock/delivery_note.fodt | 81 ++++++++++++++----- .../tests/scenario_stock_shipment_out.rst | 5 +- 2 files changed, 64 insertions(+), 22 deletions(-) diff --git a/modules/stock/delivery_note.fodt b/modules/stock/delivery_note.fodt index 2e655637b7..8d39aa66c3 100644 --- a/modules/stock/delivery_note.fodt +++ b/modules/stock/delivery_note.fodt @@ -1,30 +1,31 @@ - - LibreOffice/7.3.3.2$Linux_X86_64 LibreOffice_project/30$Build-22008-06-07T15:29:022009-03-26T18:33:131PT0S + + LibreOffice/7.4.6.2$Linux_X86_64 LibreOffice_project/40$Build-22008-06-07T15:29:022009-03-26T18:33:131PT0S - 0 + 6562 0 48129 - 23021 + 24026 true false view2 - 37596 - 8964 + 31313 + 21579 0 - 0 + 6562 48128 - 23019 + 30586 0 0 false 100 false false + false false @@ -55,6 +56,7 @@ true true false + false false false false @@ -82,13 +84,14 @@ false true false + false true true false true true - 2929175 + 3086801 true false @@ -102,6 +105,7 @@ false false true + 0 false false false @@ -109,6 +113,7 @@ true false false + false false false @@ -156,11 +161,11 @@ - + - + @@ -396,15 +401,31 @@ - + + + + + + + + + + + + + + + + + @@ -436,7 +457,7 @@ <line> </for> </if> - 2/2 + 3/3 @@ -458,13 +479,31 @@ <for each="line in shipment.delivery_address.full_address.split('\n')"> <line> </for> - Delivery Note - Shipment Number: <shipment.number>Customer Code: <shipment.customer.code>Reference: <shipment.origins or ''><', ' if (shipment.origins and shipment.reference) else ''><shipment.reference or ''>Date: <format_date(shipment.effective_date or datetime.date.today(), shipment.delivery_address.party.lang)> + <choose> + <when test="shipment.state in ['packed', 'done']"> + Delivery Note N°: <shipment.number> + </when> + <when test="shipment.state == 'cancelled'"> + Cancelled Delivery Note + </when> + <otherwise> + Draft Delivery Note + </otherwise> + </choose> + <if test="shipment.customer.code"> + Customer Code: <shipment.customer.code> + </if> + Reference: <shipment.origins or ''><', ' if (shipment.origins and shipment.reference) else ''><shipment.reference or ''> + <if test="shipment.warehouse.address and shipment.warehouse.address.country"> + Location: <shipment.warehouse.address.country.name> + </if> + Date: <format_date(shipment.effective_date or datetime.date.today(), shipment.delivery_address.party.lang)> - + + Product @@ -473,13 +512,13 @@ - - + + <for each="move in shipment.outgoing_moves"> - + <move.product.rec_name> @@ -487,8 +526,8 @@ <format_number_symbol(move.quantity, shipment.delivery_address.party.lang, move.unit, digits=move.unit.digits)> - - + + </for> diff --git a/modules/stock/tests/scenario_stock_shipment_out.rst b/modules/stock/tests/scenario_stock_shipment_out.rst index ab456c71e9..ed6c27d419 100644 --- a/modules/stock/tests/scenario_stock_shipment_out.rst +++ b/modules/stock/tests/scenario_stock_shipment_out.rst @@ -6,7 +6,7 @@ Imports:: >>> import datetime as dt >>> from decimal import Decimal - >>> from proteus import Model, Wizard + >>> from proteus import Model, Report >>> from trytond.tests.tools import activate_modules, set_user >>> from trytond.modules.company.tests.tools import create_company, \ ... get_company @@ -185,6 +185,9 @@ Ignore non assigned moves and pack shipment:: ... sum([m.quantity for m in shipment_out.outgoing_moves]) True + >>> delivery_note = Report('stock.shipment.out.delivery_note') + >>> _ = delivery_note.execute([shipment_out]) + Set the state as Done:: >>> shipment_out.click('done')