Remove shipment cost method on sale without carrier
Since 34a5debdca00 a domain enforce an empty shipment cost method when no carrier is selected. So former order must be updated to still be valid. Closes #12753 (grafted from af20d4f7c1de13bf06fabb1010251884b96b80f7) --HG-- branch : 7.0
This commit is contained in:
1 parent
1ac187615e
commit
5affc34597
2 files changed
+12
-1
No files matched your search
@@ -2,6 +2,8 @@
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from decimal import Decimal
|
||||
|
||||
from sql import Null
|
||||
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import ModelView, Workflow, fields
|
||||
from trytond.modules.product import price_digits, round_price
|
||||
@@ -90,11 +92,20 @@ class Sale(metaclass=PoolMeta):
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module):
|
||||
cursor = Transaction().connection.cursor()
|
||||
table = cls.__table__()
|
||||
|
||||
super().__register__(module)
|
||||
table_h = cls.__table_handler__(module)
|
||||
# Migration from 5.8: remove required on shipment_cost_method
|
||||
table_h.not_null_action('shipment_cost_method', 'remove')
|
||||
|
||||
# Migration from 6.6: shipment_cost_method domain
|
||||
cursor.execute(*table.update(
|
||||
[table.shipment_cost_method],
|
||||
[Null],
|
||||
where=(table.carrier == Null) & (table.state != 'draft')))
|
||||
|
||||
@classmethod
|
||||
def default_shipment_cost_method(cls, **pattern):
|
||||
Config = Pool().get('sale.configuration')
|
||||
|
||||
@@ -41,7 +41,7 @@ else:
|
||||
download_url = 'http://downloads.tryton.org/%s.%s/' % (
|
||||
major_version, minor_version)
|
||||
|
||||
requires = []
|
||||
requires = ['python-sql']
|
||||
for dep in info.get('depends', []):
|
||||
if not re.match(r'(ir|res)(\W|$)', dep):
|
||||
requires.append(get_require_version('trytond_%s' % dep))
|
||||
|
||||
Reference in new issue
Block a user