forked from OCA/connector-magento
-
Notifications
You must be signed in to change notification settings - Fork 0
/
partner.py
40 lines (27 loc) · 1.02 KB
/
partner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
from openerp.osv import orm, fields
from openerp.addons.connector.unit.mapper import mapping
from openerp.addons.magentoerpconnect.partner import PartnerImportMapper
from .backend import magento_myversion
class magento_res_partner(orm.Model):
_inherit = 'magento.res.partner'
_columns = {
'created_in': fields.char('Created In', readonly=True),
}
class res_partner(orm.Model):
_inherit = 'res.partner'
_columns = {
'gender': fields.selection([('male', 'Male'),
('female', 'Female')],
string='Gender'),
}
MAGENTO_GENDER = {'123': 'male',
'124': 'female'}
@magento_myversion
class MyPartnerImportMapper(PartnerImportMapper):
_model_name = 'magento.res.partner'
direct = PartnerImportMapper.direct + [('created_in', 'created_in')]
@mapping
def gender(self, record):
gender = MAGENTO_GENDER.get(record.get('gender'))
return {'gender': gender}