تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
4279 أدوات العرض

I would like to sort sale details report in ascending order, could someone help?

I have identified 3 files and sorted function but not sure what to do with them. 

 /addons/point_of_sale/views/report_detailsofsales.xml

/addons/point_of_sale/wizard/pos_details.py 

/addons/point_of_sale/report/pos_details.py 

records.sorted(key=lambda r: r.name)

الصورة الرمزية
إهمال
أفضل إجابة

You must inherit class pos_details() in your module and add order='date_start asc' clause, like this:

class pos_details(osv.osv_memory):
      _inherit = 'pos.details'
      

def print_report(self, cr, uid, ids, context=None):
if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}

res = self.read(cr, uid, ids, ['date_start', 'date_end', 'user_ids'], order='date_start asc', context=context)
# or # res = self.read(cr, uid, ids, ['date_start', 'date_end', 'user_ids'], order='date_end asc', context=context)

res = res and res[0] or {}
datas['form'] = res
if res.get('id',False):
datas['ids']=[res['id']]
return self.pool['report'].get_action(cr, uid, [], 'point_of_sale.report_detailsofsales', data=datas, context=context)


الصورة الرمزية
إهمال
الكاتب

pos details as far as I know only kept the start date, end date, user ID etc for printing pos orders and details , I wonder how the above class can sort the order base on order date?

Sorry, my mistake. Answer updated.

الكاتب

zbik, currently I can make changes directly in addons/views/report_detailsofsales.xml and it will get change after I do an upgrade, but when I try to make changes in addons/report/pos_details.py , follow the same process to upgrade the changes is not reflected at all. could you help?

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أغسطس 25
908
1
يوليو 25
1148
3
يوليو 25
4018
3
مايو 25
2051
1
يوليو 25
1327