def get_names(self): adict = { u'Công Việc': u'TVCV', u'Sự Cố': u'Loại', u'Sự Vụ': u'Loại', u'Comment': u'Loại' } if self.loai_record: adict = [ ('id', { 'pr': u'%s id' % self.loai_record }), ('tvcv_id', { 'pr': adict[self.loai_record], 'func': lambda val: val.name }), ('noi_dung', { 'pr': u'Nội Dung', 'skip_if_False': False }), ] if self._context.get('default_loai_record') == u'Công Việc': adict.append(('user_id', { 'func': lambda r: r.name, 'pr': u'Người Làm', 'skip_if_False': False })) name = name_compute(self, adict=adict) else: name = False return name
def name_(self): for r in self: name = name_compute(r,adict=[ ('id',{'pr':u'vt noc, id'}), ('pn',{'pr':u'P/N','skip_if_False':True}), ('sn',{'pr':u'S/N','skip_if_False':True}), ] ) r.name = name
def get_names(r): name = name_compute(r,adict=[ ('id',{'pr':u'vt ltk, id'}), ('stt',{'pr':u'STT'}), ('pn',{'pr':u'P/N'}), ('sn',{'pr':u'S/N'}), ] ) return name
def name_(self): for r in self: name = name_compute(r,adict=[ ('id',{'pr':u'vt ltk, id'}), ('pn',{'pr':u'P/N'}), ('sn',{'pr':u'S/N'}), ] ) r.name = name
def get_names(self): name = name_compute(self, adict=[('id', { 'pr': u'Ca Trực id' }), ('date', { 'pr': u'Ngày', 'func': Convert_date_orm_to_str }), ('ca', { 'pr': u'Buổi' }), ('member_ids', { 'pr': u'Người Trực', 'func': convert_memebers_to_str })]) return name
def name_get(self, from_name_search=False): def get_names(cat): res = [] if cat.name != False: while cat: res.append(cat.name) cat = cat.parent_id return res res = [] for r in self: name = ' / '.join(reversed(get_names(r))) if r.loai_record == u'Công Việc': # if from_name_search ==False: # adict=[ # # ('id',{'pr':u'TVCV id'}), # ('code',{}),#'pr':u'Mã' # ('name',{'func': lambda x:name}), # # ('diem',{'pr':u'Điểm'}), # # ('don_vi',{'pr':u'Đơn Vị','func':lambda r: r.name}), # #('do_phuc_tap',{'pr':u'Độ Phức Tạp'}) # ] # else: adict = [ ('code', {}), ('name', { 'func': lambda x: name }), ('diem', { 'pr': u'Điểm', 'func': lambda val, r: u'%s/%s/%s' % (r.do_phuc_tap, r.thoi_gian_hoan_thanh, val), 'karg': { 'r': r } }), # ('don_vi',{'pr':u'Đơn Vị','func':lambda r: r.name}), ] name = name_compute(r, adict) res.append((r.id, name)) return res
def name_get(self, from_name_search=False): def get_names(cat): ''' Return the list [cat.name, cat.parent_id.name, ...] ''' res = [] if cat.name != False: while cat: res.append(cat.name) cat = cat.parent_id return res res = [] for r in self: name_field = ' / '.join(get_names(r)) if from_name_search == False: adict = [ # ('id',{'pr':u'TVCV id'}), ('code', {}), #'pr':u'Mã' ('name', { 'func': lambda x: name_field }), # ('diem',{'pr':u'Điểm'}), # ('don_vi',{'pr':u'Đơn Vị','func':lambda r: r.name}), #('do_phuc_tap',{'pr':u'Độ Phức Tạp'}) ] else: adict = [ # ('id',{'pr':u'TVCV id'}), ('code', {}), #'pr':u'Mã' ('name', { 'func': lambda x: name_field }), ('diem', { 'pr': u'Điểm' }), ('don_vi', { 'pr': u'Đơn Vị', 'func': lambda r: r.name }), #('do_phuc_tap',{'pr':u'Độ Phức Tạp'}) ] name = name_compute(r, adict) res.append((r.id, name)) return res
def get_names_for_report(self): name = name_compute(self, join_char=u', ', junc_char=u'', adict=[ ('so_to_trinh', { 'pr': u'số' }), ('ngay_to_trinh', { 'pr': u'ngày', 'func': Convert_date_orm_to_str, 'karg': { 'format_date': '%d/%m/%Y' } }), ('ve_viec', { 'pr': u'V/v' }), ]) return name
def get_names(self): complete_name = name_compute(self, join_char=u' - ', junc_char=u':', adict=[ ('so_to_trinh', { 'pr': u'Số' }), ('ngay_to_trinh', { 'pr': u'Ngày', 'func': Convert_date_orm_to_str, 'karg': { 'format_date': '%d/%m/%Y' } }), ('ve_viec', { 'pr': u'V/v' }), ]) return complete_name
def name_get(self): res = [] for r in self: adict = [ ('product_id', { 'pr': None, 'func': lambda r: r.name + (' [PN:%s]' % r.pn if r.pn else '') }), # ('product_id',{'pr':None}), ('lot_id', { 'pr': None, 'func': lambda r: r.name, 'skip_if_False': False }), ('quantity', { 'pr': None, 'func': lambda val: '%s' % val, 'skip_if_False': False }), ] name = name_compute(r, adict, join_char=u' | ') res.append((r.id, name)) return res