Skip to content

Commit

Permalink
Merge PR #992 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by yvaucher
  • Loading branch information
OCA-git-bot committed Nov 11, 2024
2 parents 0488c41 + 5940ff8 commit 001d9e6
Show file tree
Hide file tree
Showing 6 changed files with 236 additions and 11 deletions.
7 changes: 5 additions & 2 deletions base_wamas_ubl/lib/wamas/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
ausk,
auskq,
ausp,
auspq,
bkorr,
kretk,
kretkq,
Expand Down Expand Up @@ -49,6 +50,7 @@
"ART": "Product",
"AUSK": "Picking",
"AUSKQ": "PickingResponse",
"AUSPQ": "PickingResponse",
"KRETK": "Return",
"KRETKQ": "ReturnResponse",
"KST": "Customer",
Expand Down Expand Up @@ -77,6 +79,7 @@
"WEAK": weak.grammar,
"WEAP": weap.grammar,
"AUSKQ": auskq.grammar,
"AUSPQ": auspq.grammar,
"KRETKQ": kretkq.grammar,
"KRETPQ": kretpq.grammar,
"KST": kst.grammar,
Expand All @@ -96,7 +99,7 @@
# WAMAS TO UBL
##

LST_TELEGRAM_TYPE_IGNORE_W2D = ["AUSPQ", "TOURQ", "TAUSPQ"]
LST_TELEGRAM_TYPE_IGNORE_W2D = ["TOURQ", "TAUSPQ"]

DICT_UBL_TEMPLATE = {
"ReceptionResponse": "ubl_template/reception.xml",
Expand Down Expand Up @@ -166,7 +169,7 @@

DICT_CONVERT_WAMAS_TYPE = {
"AUSK": ["AUSKQ", "WATEKQ"],
"AUSP": ["WATEPQ"],
"AUSP": ["AUSPQ", "WATEPQ"],
"KRETK": ["KRETKQ"],
"KRETP": ["KRETPQ"],
"WEAK": ["WEAKQ"],
Expand Down
21 changes: 18 additions & 3 deletions base_wamas_ubl/lib/wamas/ubl_template/picking.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<cbc:ID><t t-raw="record.IvAusk_RahmenTourId_TourNr" /></cbc:ID>
</cac:Shipment>
<cac:DespatchLine t-foreach="record.lines" t-as="line">
<cac:Shipment>
<cac:Shipment t-if="line.package">
<cac:TransportHandlingUnit>
<cac:ActualPackage>
<cbc:ID><t t-raw="line.package.IvTek_TeId" /></cbc:ID>
Expand All @@ -139,9 +139,19 @@
</cac:Shipment>
<cbc:ID><t t-raw="line.IvAusp_HostPosNr" /></cbc:ID>
<cbc:DeliveredQuantity
t-if="line.Mngs_Mng"
t-att-unitCode="line.IvArt_Bestand_Einheit"
unitCodeListAgencyName="WAMAS"
><t t-raw="line.Mngs_Mng" /></cbc:DeliveredQuantity>
>
<t t-raw="line.Mngs_Mng" />
</cbc:DeliveredQuantity>
<cbc:DeliveredQuantity
t-if="line.IvAusp_LiefMngsWamas_Mng"
t-att-unitCode="line.IvArt_Bestand_Einheit"
unitCodeListAgencyName="WAMAS"
>
<t t-raw="line.IvAusp_LiefMngsWamas_Mng" />
</cbc:DeliveredQuantity>
<cac:OrderLineReference>
<cbc:LineID />
</cac:OrderLineReference>
Expand All @@ -150,7 +160,12 @@
<cbc:ID />
</cac:BuyersItemIdentification>
<cac:SellersItemIdentification>
<cbc:ID><t t-raw="line.IvArt_AId_ArtNr" /></cbc:ID>
<cbc:ID t-if="line.IvArt_AId_ArtNr">
<t t-raw="line.IvArt_AId_ArtNr" />
</cbc:ID>
<cbc:ID t-if="line.IvAusp_MId_AId_ArtNr">
<t t-raw="line.IvAusp_MId_AId_ArtNr" />
</cbc:ID>
</cac:SellersItemIdentification>
</cac:Item>
</cac:DespatchLine>
Expand Down
7 changes: 5 additions & 2 deletions base_wamas_ubl/lib/wamas/wamas2ubl.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,11 @@ def dict2ubl(msg_type, data, extra_data=False):
extractor.get_line("KRETPQ", "IvKretp_KretId_KretNr")
elif msg_type == "PickingResponse":
extractor.get_head("AUSKQ", "IvAusk_AusId_AusNr")
extractor.get_head("WATEKQ", "IvTek_TeId", extractor.packages)
extractor.get_line("WATEPQ", "IvAusp_UrAusId_AusNr", "IvTep_TeId")
if "WATEKQ" not in extractor.data and "WATEPQ" not in extractor.data:
extractor.get_line("AUSPQ", "IvAusp_UrAusId_AusNr")
else:
extractor.get_head("WATEKQ", "IvTek_TeId", extractor.packages)
extractor.get_line("WATEPQ", "IvAusp_UrAusId_AusNr", "IvTep_TeId")
else:
raise Exception("Invalid message type: %s" % msg_type)

Expand Down
2 changes: 2 additions & 0 deletions base_wamas_ubl/lib/wamas/wamas_grammar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
weap,
ausk,
ausp,
auskq,
auspq,
kretkq,
kretpq,
kretk,
Expand Down
190 changes: 190 additions & 0 deletions base_wamas_ubl/lib/wamas/wamas_grammar/auspq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
from collections import OrderedDict

grammar = OrderedDict(
{
"Telheader_Quelle": {
"type": "str",
"length": 10,
"dp": False,
"dict_key": False,
"df_val": False,
"df_func": "get_source_q",
},
"Telheader_Ziel": {
"type": "str",
"length": 10,
"dp": False,
"dict_key": False,
"df_val": False,
"df_func": "get_destination_q",
},
"Telheader_TelSeq": {
"type": "int",
"length": 6,
"dp": False,
"dict_key": False,
"df_val": False,
"df_func": "get_sequence_number",
},
"Telheader_AnlZeit": {
"type": "datetime",
"length": 14,
"dp": False,
"dict_key": False,
"df_val": False,
"df_func": "get_current_datetime",
},
"Satzart": {
"type": "str",
"length": 9,
"dp": False,
"dict_key": False,
"df_val": "AUSPQ0051",
"df_func": False,
},
"IvAusp_UrAusId_Mand": {
"type": "str",
"length": 3,
"dp": False,
"dict_key": "RxAusp_AusId_Mand",
"df_val": False,
"df_func": False,
},
"IvAusp_UrAusId_AusNr": {
"type": "str",
"length": 20,
"dp": False,
"dict_key": "RxAusp_AusId_AusNr",
"df_val": False,
"df_func": False,
},
"IvAusp_UrAusId_HostAusKz": {
"type": "str",
"length": 5,
"dp": False,
"dict_key": "RxAusp_AusId_HostAusKz",
"df_val": False,
"df_func": False,
},
"IvAusp_ExtRef": {
"type": "str",
"length": 20,
"dp": False,
"dict_key": "RxAusp_ExtRef",
"df_val": False,
"df_func": False,
},
"IvAusp_HostPosNr": {
"type": "int",
"length": 6,
"dp": False,
"dict_key": "RxAusp_HostPosNr",
"df_val": False,
"df_func": False,
},
"IvAusp_MId_AId_Mand": {
"type": "str",
"length": 3,
"dp": False,
"dict_key": "RxAusp_MId_AId_Mand",
"df_val": False,
"df_func": False,
},
"IvAusp_MId_AId_ArtNr": {
"type": "str",
"length": 20,
"dp": False,
"dict_key": "RxAusp_MId_AId_ArtNr",
"df_val": False,
"df_func": False,
},
"IvAusp_MId_AId_Var": {
"type": "str",
"length": 5,
"dp": False,
"dict_key": "RxAusp_MId_AId_Var",
"df_val": False,
"df_func": False,
},
"IvMatqk_HMATQ_HMatQ": {
"type": "str",
"length": 20,
"dp": False,
"dict_key": False,
"df_val": False,
"df_func": False,
},
"IvAusp_LiefMngsWamas_Mng": {
"type": "int",
"length": 12,
"dp": False,
"dict_key": "BestMng",
"df_val": False,
"df_func": False,
},
"IvAusp_LiefMngsWamas_Gew": {
"type": "int",
"length": 12,
"dp": False,
"dict_key": False,
"df_val": False,
"df_func": False,
},
"IvArt_HOSTUNITS_HostEinh": {
"type": "str",
"length": 5,
"dp": False,
"dict_key": "HostEinheit",
"df_val": False,
"df_func": False,
},
"IvArt_Bestand_Einheit": {
"type": "str",
"length": 5,
"dp": False,
"dict_key": "HostEinheit",
"df_val": False,
"df_func": False,
},
"IvAusp_MId_Charge": {
"type": "str",
"length": 20,
"dp": False,
"dict_key": "RxAusp_MId_Charge",
"df_val": False,
"df_func": False,
},
"IvAusp_Info": {
"type": "str",
"length": 40,
"dp": False,
"dict_key": "RxAusp_Info",
"df_val": False,
"df_func": False,
},
"IvAusp_MId_MHD": {
"type": "date",
"length": 8,
"dp": False,
"dict_key": False,
"df_val": False,
"df_func": False,
},
"LiefSNr": {
"type": "str",
"length": 20,
"dp": False,
"dict_key": False,
"df_val": False,
"df_func": False,
},
"AUSPQ0051": {
"type": "bool",
"length": 1,
"dp": False,
"dict_key": False,
"df_val": False,
"df_func": False,
},
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@
</cac:GrossWeightMeasure>
</cac:Shipment>
<cbc:ID>101</cbc:ID>
<cbc:DeliveredQuantity unitCode="TETRA" unitCodeListAgencyName="WAMAS">7.0</cbc:DeliveredQuantity>
<cbc:DeliveredQuantity unitCode="TETRA" unitCodeListAgencyName="WAMAS">
7.0
</cbc:DeliveredQuantity>

<cac:OrderLineReference>
<cbc:LineID/>
</cac:OrderLineReference>
Expand All @@ -90,7 +93,10 @@
<cbc:ID/>
</cac:BuyersItemIdentification>
<cac:SellersItemIdentification>
<cbc:ID>15455</cbc:ID>
<cbc:ID>
15455
</cbc:ID>

</cac:SellersItemIdentification>
</cac:Item>
</cac:DespatchLine><cac:DespatchLine>
Expand All @@ -106,7 +112,10 @@
</cac:GrossWeightMeasure>
</cac:Shipment>
<cbc:ID>102</cbc:ID>
<cbc:DeliveredQuantity unitCode="TETRA" unitCodeListAgencyName="WAMAS">8.0</cbc:DeliveredQuantity>
<cbc:DeliveredQuantity unitCode="TETRA" unitCodeListAgencyName="WAMAS">
8.0
</cbc:DeliveredQuantity>

<cac:OrderLineReference>
<cbc:LineID/>
</cac:OrderLineReference>
Expand All @@ -115,7 +124,10 @@
<cbc:ID/>
</cac:BuyersItemIdentification>
<cac:SellersItemIdentification>
<cbc:ID>15455</cbc:ID>
<cbc:ID>
15455
</cbc:ID>

</cac:SellersItemIdentification>
</cac:Item>
</cac:DespatchLine>
Expand Down

0 comments on commit 001d9e6

Please sign in to comment.