Manage shipping for supplier shipment returns
We move the shipping code in mixin's such that it can be applied on other shipments. We define properties to abstract the information needed by the create shipping wizards. Such that they can be execute on any shipment. issue9850 review324521002
This commit is contained in:
1 parent
7f94cbfcd1
commit
db72760175
2 files changed
+16
-7
No files matched your search
@@ -12,6 +12,7 @@ def register():
|
||||
carrier.CredentialDPD,
|
||||
carrier.Carrier,
|
||||
stock.ShipmentOut,
|
||||
stock.ShipmentInReturn,
|
||||
module='stock_package_shipping_dpd', type_='model')
|
||||
Pool.register(
|
||||
stock.CreateShipping,
|
||||
|
||||
@@ -21,17 +21,24 @@ from .configuration import get_client, SHIPMENT_SERVICE
|
||||
from .exceptions import DPDError
|
||||
|
||||
|
||||
class ShipmentOut(metaclass=PoolMeta):
|
||||
__name__ = 'stock.shipment.out'
|
||||
class ShippingDPDMixin:
|
||||
|
||||
def validate_packing_dpd(self):
|
||||
warehouse_address = self.warehouse.address
|
||||
if not warehouse_address:
|
||||
warehouse = self.shipping_warehouse
|
||||
if not warehouse.address:
|
||||
raise PackingValidationError(
|
||||
gettext('stock_package_shipping_dpd'
|
||||
'.msg_warehouse_address_required',
|
||||
shipment=self.rec_name,
|
||||
warehouse=self.warehouse.rec_name))
|
||||
warehouse=warehouse.rec_name))
|
||||
|
||||
|
||||
class ShipmentOut(ShippingDPDMixin, metaclass=PoolMeta):
|
||||
__name__ = 'stock.shipment.out'
|
||||
|
||||
|
||||
class ShipmentInReturn(ShippingDPDMixin, metaclass=PoolMeta):
|
||||
__name__ = 'stock.shipment.in.return'
|
||||
|
||||
|
||||
class CreateShipping(metaclass=PoolMeta):
|
||||
@@ -218,9 +225,10 @@ class CreateDPDShipping(Wizard):
|
||||
'sendingDepot': credential.depot,
|
||||
'product': shipment.carrier.dpd_product,
|
||||
'sender': self.shipping_party(
|
||||
shipment.company.party, shipment.warehouse.address),
|
||||
shipment.company.party,
|
||||
shipment.shipping_warehouse.address),
|
||||
'recipient': self.shipping_party(
|
||||
shipment.customer, shipment.delivery_address),
|
||||
shipment.shipping_to, shipment.shipping_to_address),
|
||||
},
|
||||
'parcels': [self.get_parcel(p) for p in packages],
|
||||
'productAndServiceData': {
|
||||
|
||||
Reference in new issue
Block a user