I'd like to be able to order invoice lines by product reference in Invoice report (account.account_invoices). Is it possible to use repeatIn function so that the list contain invoice line ordered by product reference?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
I don't know how to call the python build-in function "sorted" inside a rml file.
a) But you can define a own sort method in the account_print_invoice.py file.
add before the line report_sxw.report_sxw(
def sortByDefault_code(theList):
theList.sort(key=lambda x: x.default_code, reverse=False)
return theList
self.localcontext.update({
'sortByDefault_code':sortByDefault_code,
})
-- add the same spaces before def and self as already found before def in the account_print_invoice.py file
-- the shiftings in every line are important in python
b) change o.invoice_line to sortByDefault_code(o.invoice_line) in account_print_invoice.rml
<para style="terp_default_1">[[ repeatIn(sortByDefault_code(o.invoice_line),'l') ]]</para>
c) restart the openerp server
Hi, Could you help me change the order on a Purchase order print so the order is in Scheduled Date (date_planned)? Many thanks.
Hi everybody,
I just tried the previous solution but it doesn't work. What I wanna do is sort my invoice lines by name.
Someone could help me ?
I tried with the following code :
def sortByDefault_code(account_invoice):
account_invoice.sort(key=lambda x: x.name, reverse=False)
return account_invoice
self.localcontext.update({
'sortByDefault_code':sortByDefault_code,
})
Thanks in advance.
JMB
Did you also modify the RML file as herbert6453 mentioned?
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
8
thg 5 18
|
8446 | ||
|
3
thg 7 24
|
8537 | ||
|
1
thg 3 18
|
4376 | ||
|
0
thg 4 17
|
3224 | ||
|
1
thg 4 17
|
4601 |