Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Tryton Tryton
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 707
    • Issues 707
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 60
    • Merge requests 60
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

April 05-07 - Mercurial Paris Conference 2023 - One day of workshop dedicated to Heptapod and Mercurial usage and workflow. There are still places available for both workshops and talks!

  • TrytonTryton
  • TrytonTryton
  • Issues
  • #11998
Closed
Open
Issue created Jan 11, 2023 by Juanjo Garcia@juanjogpDeveloper

KeyError when processing a sale with modules sale_shipment_cost and sale_shipment_grouping installed.

Tested in default.

  1. Install the modules sale_shipment_cost and sale_shipment_grouping and its dependencies.
  2. Create a party customer, and a party carrier
  3. Create a goods product with the salable check
  4. Create a service product to the carrier
  5. Create a carrier with the party carrier created in point 2 and the product from the point 4. With the carrier cost method "Product Price" and with the allocation method "By Cost"
  6. In the sale configuration, use:
  • Sale Invoice Method: On Shipment Send
  • Sale Shipment Method: On Order Processed
  • Sale Shipment Cost Method: On Shipment
  • Sale Shipment Grouping Method: Standard
  1. Create a sale where:
  • The party is the party customer
  • With the carrier from the point 5
  • The invoice method, shipment method and shipment cost method must be the same that we have configured (in the "Other Info" party)
  • Create a line with the salable product from the point 3 where we have negative quantity.
  1. When we try to process the sale, the KeyError appears:
Traceback (most recent call last):
  File "/home/juanjo/Projectes/tryton_core/trytond/trytond/protocols/wrappers.py", line 178, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/home/juanjo/Projectes/tryton_core/trytond/trytond/protocols/dispatcher.py", line 200, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/home/juanjo/Projectes/tryton_core/trytond/trytond/model/modelview.py", line 697, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/home/juanjo/Projectes/tryton_core/trytond/trytond/modules/sale_shipment_cost/sale.py", line 230, in process
    super().process(sales)
  File "/home/juanjo/Projectes/tryton_core/trytond/trytond/model/modelview.py", line 697, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/home/juanjo/Projectes/tryton_core/trytond/trytond/modules/sale/sale.py", line 1013, in process
    cls._process_shipment(sales)
  File "/home/juanjo/Projectes/tryton_core/trytond/trytond/modules/sale_shipment_grouping/sale.py", line 72, in _process_shipment
    super()._process_shipment([sale])
  File "/home/juanjo/Projectes/tryton_core/trytond/trytond/modules/sale/sale.py", line 1044, in _process_shipment
    shipments = sale.create_shipment('return')
  File "/home/juanjo/Projectes/tryton_core/trytond/trytond/modules/sale/sale.py", line 922, in create_shipment
    shipment = self._get_shipment_sale(Shipment, key)
  File "/home/juanjo/Projectes/tryton_core/trytond/trytond/modules/sale_shipment_cost/sale.py", line 323, in _get_shipment_sale
    shipment = super()._get_shipment_sale(Shipment, key)
  File "/home/juanjo/Projectes/tryton_core/trytond/trytond/modules/sale_shipment_grouping/sale.py", line 59, in _get_shipment_sale
    domain = self._get_grouped_shipment_domain(shipment)
  File "/home/juanjo/Projectes/tryton_core/trytond/trytond/modules/sale_shipment_grouping/sale.py", line 41, in _get_grouped_shipment_domain
    defaults = Shipment.default_get(self._shipment_grouping_fields,
  File "/home/juanjo/Projectes/tryton_core/trytond/trytond/model/model.py", line 150, in default_get
    field = cls._fields[field_name]
KeyError: 'delivery_address'

The error appears because the "delivery_address" field it is not on the "shipment.out.return" model (https://foss.heptapod.net/tryton/tryton/-/blob/branch/default/modules/sale_shipment_grouping/sale.py#L21-23).

I think the same problem will appear with the "cost_method" field in the sale_shipment_cost module (https://foss.heptapod.net/tryton/tryton/-/blob/branch/default/modules/sale_shipment_cost/sale.py#L308-310).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking