Shipment creation bug
This commit is contained in:
@@ -791,6 +791,13 @@ class ShipmentIn(metaclass=PoolMeta):
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
new_args = cls._normalize_transport_write_args(args)
|
||||
if not new_args:
|
||||
return
|
||||
return super().write(*new_args)
|
||||
|
||||
@classmethod
|
||||
def _normalize_transport_write_args(cls, args):
|
||||
new_args = []
|
||||
for index in range(0, len(args), 2):
|
||||
records = args[index]
|
||||
@@ -799,7 +806,7 @@ class ShipmentIn(metaclass=PoolMeta):
|
||||
new_args.extend([
|
||||
[record],
|
||||
cls._normalize_transport_values(values, record)])
|
||||
super().write(*new_args)
|
||||
return new_args
|
||||
|
||||
@classmethod
|
||||
def _stock_move_origin(cls, move):
|
||||
|
||||
@@ -5427,6 +5427,17 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
'vessel': None,
|
||||
})
|
||||
|
||||
def test_shipment_in_write_ignores_empty_record_groups(self):
|
||||
'shipment write normalization keeps empty internal writes as no-op'
|
||||
ShipmentIn = Pool().get('stock.shipment.in')
|
||||
|
||||
self.assertEqual(
|
||||
ShipmentIn._normalize_transport_write_args((
|
||||
[],
|
||||
{'cost_price': Decimal('12.34')},
|
||||
)),
|
||||
[])
|
||||
|
||||
def test_invoice_report_transportation_uses_truck_label(self):
|
||||
'invoice_melya Transportation displays By Truck for truck shipments'
|
||||
Invoice = Pool().get('account.invoice')
|
||||
|
||||
Reference in New Issue
Block a user