Support more than 1 carrier

Continuing the discussion from Managing incoterms on tryton:

Rational

In some case the delivery must be managed by many carriers. Ex: a first carrier to move shipment from the company warehouse to a port, a main carrier for the boat and another carrier from the destination port to the customer warehouse.

Proposal

We add a generic Model carrier.carriage to store carriers for sale and shipments. It includes:

  • document: Reference
  • type: Selection: before, after
  • sequence: Integer
  • carrier: Many2One to carrier
  • shipment_cost_method: Selection
  • from/to address: Many2One to party.address (used to compute selection)

On sale, we add:

  • before_carriages: One2Many to carrier.carriage (using a filter domain).
  • after_carriages: One2Many to carrier.carriage (using a filter domain), only allowed if carrier is filled.
  • carrier_from/to_address: Many2One to party.address used to compute from/to_country if before/after_carriers is filled.

The before/after_carriers are copied to the shipments.

On shipments (in, out and out return), we add:

  • before/after_carriage: One2Many to carrier.carriage (using a filter domain).

The compute cost methods are extended to add the cost (or sale cost) of the list of carriers.

The Incoterms are extended to add:

  • before_carriages: Selection like carrier
  • after_carriages: Selection like carrier

Incotern pattern is filled:

  • before_carriage is:
    • seller if before_carriages is filled with at least one shipment cost method or not filled with a shipment cost method
    • buyer if before_carriages is filled with no shipment cost method and not filled with no shipment cost method
  • after_carrier is:
    • seller if after_carriages is filled with at least one shipment cost method
    • buyer if after_carriages is filled with any shipment cost method

Implementation

1 Like