Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

How to get maximal amount use function [Closed]

By
Susi
on 1/15/15, 10:32 PM 592 views

The Question has been closed for reason: not a real question

by
Susi
on 01/17/2015 02:32:41

i have field

nilai_promo:fields.function()

i want this field take value maximal in total_diskon field ..MAX(program_subsidi_line.total_diskon)

how to make this function? anyone help me please .I did not really understand this

0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 1/15/15, 11:15 PM

max([x.total_diskon for x in program_subsidi_line]).

max function takes an iterable (list, tuple, dictionary, sets, etc.) or a number of arguments.  The part inside ( ) is a list comprehension way to look through program_subsidi_line and returning each of the line's total_diskon value.  It is a shorthand for getting the total_list in the code below:

total_list = []

for x in program_subsidi_line:

    total_list.append(x.total_diskon)

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/15/15, 10:32 PM
Seen: 592 times
Last updated: 3/16/15, 8:10 AM