1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
......
def _get_list_partner(self,cr, uid, ids, field_name, arg, context): #(self, cr, uid, context=None): #
result = {}
cr.execute("SELECT distinct id,'[' || ref || '] ' || name as name,bl_partner_passage \
FROM res_partner \
WHERE (customer = True and bl_partner_passage = True and char_length(ref) = 4 and \
CAST (substring(ref from 3 for 2) AS integer) = EXTRACT(MONTH FROM current_date) and \
substring(ref from 2 for 1) = (SELECT code_shop FROM res_company)) \
or (customer = True and bl_partner_passage = False and char_length(ref) = 4 and \
CAST (substring(ref from 3 for 2) AS integer) = EXTRACT(MONTH FROM current_date) and \
substring(ref from 2 for 1) = (SELECT code_shop FROM res_company) ) or bl_en_compte = True \
ORDER BY bl_partner_passage DESC ")
line_ids = cr.dictfetchall()
for line in line_ids:
res[line['id']]['id'] = line['id']
res[line['id']]['name'] = line['name']
return result
.....
_columns = {
'mars_partner_id': fields.function(_get_list_partner, type='many2one', obj='res.partner',store=True,method=True,string='Client'),
} |
Partager