summaryrefslogtreecommitdiff
path: root/indoteknik_api/models/res_users.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-04-28 09:03:04 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-04-28 09:03:04 +0700
commit57d55f545da0fc501a9828bb3ca2988f126b241a (patch)
tree75b98126546eea20b90ca777b2887b4813946871 /indoteknik_api/models/res_users.py
parent3592c254ca5baf4a0a769f500f9e28a9cbc272a7 (diff)
parent6fa5de951abc02884eb37cdc6786c0f3d141ccc5 (diff)
Merge branch 'staging' into release
Diffstat (limited to 'indoteknik_api/models/res_users.py')
-rw-r--r--indoteknik_api/models/res_users.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/indoteknik_api/models/res_users.py b/indoteknik_api/models/res_users.py
index 84edb2b1..80de083d 100644
--- a/indoteknik_api/models/res_users.py
+++ b/indoteknik_api/models/res_users.py
@@ -5,6 +5,18 @@ class ResUsers(models.Model):
_inherit = 'res.users'
def api_single_response(self, res_user, with_detail=''):
+ config = self.env['ir.config_parameter']
+ product_pricelist_tier1 = int(config.get_param('product.pricelist.tier1'))
+ product_pricelist_tier2 = int(config.get_param('product.pricelist.tier2'))
+ product_pricelist_tier3 = int(config.get_param('product.pricelist.tier3'))
+
+ user_pricelist = res_user.property_product_pricelist
+ user_pricelist_id = user_pricelist.id if user_pricelist else False
+ pricelist_tier = False
+ if user_pricelist_id == product_pricelist_tier1: pricelist_tier = 'tier1'
+ if user_pricelist_id == product_pricelist_tier2: pricelist_tier = 'tier2'
+ if user_pricelist_id == product_pricelist_tier3: pricelist_tier = 'tier3'
+
data = {
'id': res_user.id,
'parent_id': res_user.parent_id.id or False,
@@ -14,8 +26,11 @@ class ResUsers(models.Model):
'phone': res_user.phone or '',
'mobile': res_user.mobile or '',
'external': res_user.share,
- 'company': res_user.company_type == 'company'
+ 'company': res_user.company_type == 'company',
+ 'pricelist': pricelist_tier
}
+
+
if res_user.parent_id:
data.update({ 'company': res_user.parent_id.company_type == 'company' })