details: https://code.tryton.org/tryton/commit/5c0e57064e38
branch: default
user: Cédric Krier <[email protected]>
date: Mon Dec 01 16:52:59 2025 +0100
description:
Set the language to party from the Shopify customer
Closes #14257
diffstat:
modules/web_shop_shopify/CHANGELOG | 1 +
modules/web_shop_shopify/party.py | 7 +++++++
modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst | 3 +++
3 files changed, 11 insertions(+), 0 deletions(-)
diffs (57 lines):
diff -r ec19bf52203e -r 5c0e57064e38 modules/web_shop_shopify/CHANGELOG
--- a/modules/web_shop_shopify/CHANGELOG Mon Sep 22 14:45:09 2025 +0200
+++ b/modules/web_shop_shopify/CHANGELOG Mon Dec 01 16:52:59 2025 +0100
@@ -1,3 +1,4 @@
+* Set the language to party
* Add admin URL to identifiers
* Set compare-at price using non-sale price
* Add support for product kit
diff -r ec19bf52203e -r 5c0e57064e38 modules/web_shop_shopify/party.py
--- a/modules/web_shop_shopify/party.py Mon Sep 22 14:45:09 2025 +0200
+++ b/modules/web_shop_shopify/party.py Mon Dec 01 16:52:59 2025 +0100
@@ -22,18 +22,25 @@
'displayName': None,
'email': None,
'phone': None,
+ 'locale': None,
}
@classmethod
def get_from_shopify(cls, shop, customer):
pool = Pool()
ContactMechanism = pool.get('party.contact_mechanism')
+ Lang = pool.get('ir.lang')
party = cls.search_shopify_identifier(
shop, gid2id(customer['id']))
if not party:
party = cls()
setattr_changed(party, 'name', remove_forbidden_chars(
customer['displayName']))
+ if customer['locale']:
+ lang = Lang.get(customer['locale'])
+ else:
+ lang = None
+ setattr_changed(party, 'lang', lang)
contact_mechanisms = list(getattr(party, 'contact_mechanisms', []))
for types, value in [
(['email'], customer['email']),
diff -r ec19bf52203e -r 5c0e57064e38
modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst
--- a/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst Mon Sep
22 14:45:09 2025 +0200
+++ b/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst Mon Dec
01 16:52:59 2025 +0100
@@ -476,6 +476,7 @@
... random.choice(string.ascii_letters) for _ in range(10))
... + '@example.com'),
... 'phone': customer_phone,
+ ... 'locale': 'en-CA',
... })
>>> order = tools.create_order({
@@ -579,6 +580,8 @@
'quotation'
>>> sale.party.name
'Customer'
+ >>> sale.party.lang.code
+ 'en'
>>> assertTrue(sale.party.email)
>>> assertEqual(sale.party.phone.replace(' ', ''),
customer_phone.replace('-', ''))
>>> address, = sale.party.addresses