Issue 11900

Title
Can not create sale from opportunity
Priority
bug
Status
chatting
Nosy list
ced, resteve
Assigned to
Keywords

Created on 2022-11-18.18:19:04 by resteve, last changed 1 week ago by ced.

Messages

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-11-18.19:24:30

So it is the combination of both module. It will be so much easier with a clear description.

Author: [hidden] (resteve)
Date: 2022-11-18.19:04:59

Traceback create sales from opportunity:

Traceback (most recent call last):
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/tests/test_tryton.py", line 209, in wrapper
    result = func(*args, **kwargs)
  File "/home/raimon/projectes/nandev2/nancore/modules/demo/tests/test_module.py", line 151, in test_datasets
    self.execute_dataset('process_opportunities')
  File "/home/raimon/projectes/nandev2/nancore/modules/demo/tests/test_module.py", line 23, in execute_dataset
    DataSet.execute([data])
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/model/modelview.py", line 697, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/modules/demo/demo.py", line 147, in execute
    method()
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/modules/demo/demo.py", line 1087, in process_opportunities
    Opportunity.convert(opps)
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/model/modelview.py", line 697, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/model/workflow.py", line 37, in wrapper
    result = func(cls, filtered, *args, **kwargs)
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/modules/company/model.py", line 65, in wrapper
    result = func(cls, records, *args, **kwargs)
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/modules/sale_opportunity/opportunity.py", line 416, in convert
    Sale.save(sales)
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/model/descriptors.py", line 33, in newfunc
    return self.func(owner, *args, **kwargs)
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/model/modelstorage.py", line 1946, in save
    news = cls.create([save_values[r] for r in to_create])
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/modules/sale_discount/sale.py", line 55, in create
    sales = super(Sale, cls).create(vlist)
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/model/modelsql.py", line 233, in wrapper
    return func(cls, *args, **kwargs)
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/model/modelsql.py", line 872, in create
    cls._validate(sub_records)
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/model/modelstorage.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/model/modelstorage.py", line 1359, in _validate
    validate_domain(field)
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/model/modelstorage.py", line 1280, in validate_domain
    validate_relation_domain(
  File "/home/raimon/projectes/nandev2/nancore/trytond/trytond/model/modelstorage.py", line 1338, in validate_relation_domain
    raise DomainValidationError(
trytond.model.modelstorage.DomainValidationError: The value "order" for field "Shipment Cost Method" in "(19)" of "Sale" is not valid according to its domain. - 
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-11-18.19:00:46

Tested the domain inversion force the value to none.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-11-18.18:57:51

The domain inversion should set the value.

Author: [hidden] (resteve)
Date: 2022-11-18.18:19:04

In case create a new sale, "shipment_cost_method" is not None because default configuration is 'order' [1]

Since issue11574, add domain "shipment_cost_method" is None when has not carrier [2]

In case process sales that has not carrier (and default shipment_cost_method is None):

trytond.model.modelstorage.DomainValidationError: The value "order" for field "Shipment Cost Method" in "(3)" of "Sale" is not valid according to its domain. -

The user require edit sale and set "shipment_cost_method" to None before to process.

[1] https://github.com/tryton/sale_shipment_cost/blob/06de8670ec7ffc4efbd795a3178935427aadc4fb/sale.py#L70
[2] https://github.com/tryton/sale_shipment_cost/blob/06de8670ec7ffc4efbd795a3178935427aadc4fb/sale.py#L99

History
Date User Action Args
2022-11-18 19:24:30cedsetcomponent: + sale_opportunity
messages: + msg80108
priority: feature -> bug
title: Can't process sales that has not carrier and shipment_ -> Can not create sale from opportunity
type: behavior -> crash
2022-11-18 19:04:59restevesetmessages: + msg80106
status: invalid -> chatting
2022-11-18 19:00:46cedsetmessages: + msg80105
status: testing -> invalid
2022-11-18 18:57:52cedsetmessages: + msg80104
nosy: + ced
status: chatting -> testing
2022-11-18 18:19:04restevecreate

Showing 10 items. Show all history (warning: this could be VERY long)