Hi !!!!
I have a field named "project".
Now, i want to make a loop on project but without any repetition.
help please.
thanks a lot
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi !!!!
I have a field named "project".
Now, i want to make a loop on project but without any repetition.
help please.
thanks a lot
I have had an sql constraint and its okay. Everything works fine ;)
_sql_constraints = [
('project_id_unique', 'UNIQUE(project_id,client_id)',
'Each client must have a unique project'),
]
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Aug 23
|
12546 | ||
change password
Solved
|
|
1
Aug 23
|
11046 | |
|
1
Jul 23
|
7224 | ||
|
4
Apr 23
|
8676 | ||
|
2
Feb 23
|
17590 |
can you explain what you want?
You want to make a loop with no repetition ? ...
Hi Drees, Please explain well couldn't understand from question what you need.
@Drees,
From what I understand you need a foreach loop to loop and print out something once for each project in projects. For this you will need to use t-foreach statement to accomplish what you need.
Here's an example of a similar kind of t-foreach loop in use:
https://github.com/OdooCommunityWidgets/website_multi_image/blob/8.0/website_multi_image/views/website_product_image_carousel.xml
Look at lines #9-11 and you'll see t-foreach="product.images" t-as="i" in the tag. From my limited understanding of how this works you'll need to use the model (in this case t-foreach=" product.images") that you're trying to print from, and then providing a looping variable in this case t-as="i". This looping variable should then be used on the field you want to print out in that model, in this case you can see the statement inside the tag on line #10:
t-field="i.image" class="img-responsive" t-field-options="{"widget": "image", "class": "img-responsive"}"
Forget the t-field-options statement for a second and just focus on the t-field attribute. You can see the looping variable ibeing used to loop/print out the field image. Essentially what the above statement is saying is foreach image field in the model product.images for the product page we are using this loop on (ie. within the scope of the product_id) this look will print out the image field once per image.
This may be a terrible explanation of the concept, and I welcome any corrections on my explanation, however if you have any questions please post in the comments below.
My recommendation would be to check out the official documentation on this here:
https://www.odoo.com/documentation/8.0/reference/qweb.html#loops
It was something new :) Loop with no loop ;) Paradox.