1 parent
bcd594fe74
commit
998aa90a72
3 files changed
+11
No files matched your search
@@ -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
|
||||
|
||||
@@ -22,18 +22,25 @@ class Party(IdentifiersMixin, metaclass=PoolMeta):
|
||||
'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']),
|
||||
|
||||
@@ -476,6 +476,7 @@ Create an order on Shopify::
|
||||
... 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 @@ Run fetch order::
|
||||
'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
|
||||
|
||||
Reference in new issue
Block a user