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.

0

Odoo project modification

By
Dr Obx
on 8/5/15, 7:02 AM 682 views

Hello guys,

I would like to add in projects something like this:

once task is moved in to "Done" column automatically send message to the assigned user (followers)

so I tried <attrib="{'invisible':[('stage_id','=','Done')]}"/> to hide/unhide followers which unhided should automatically send message to them.

BUT stage_id = 'Done' doesn't work.

I know I can set stage change for each of them (followers) but it's not what I want.

Any suggestions ?

I already tried this:

<div attrs="{'invisible': [('stage_id','=','Arrived')]}" class="oe_chatter">

<field name="message_ids" attrs="{'invisible': [('stage_id','=','Sorting')]}"/>

<field name="message_follower_ids" groups="base.group_user" attrs="{'invisible': [('stage_id','=','Finished')]}"/>

</div>

1

Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


Ahmed M.Elmubarak
On 8/5/15, 8:42 AM

Hello,

I couldn't get what you want to achieve ...

for you trial "stage_is = Done doesn't work" :

<attrib={'invisible':[('stage_id', '=', 'Done')]}"/>

you can make a new field to get the name of the stage_id

then make an onchange mehtod on the stage_id to get the name and put it in the new field.

for your field you need to be invisible:

<field name="name" attrs="{'invisible':[('new_field', '=', 'Done')]}"/>

Update:

To make the followers and messaging widget  invisible , add invisible attribute to the div class="oe_chatter"

you can do it by using inheritance by xpath.

if you don't want to add a new field, you can't hide it unless you know the id of the stage.

e.g in the default Odoo data the ID of the Design stage is 3 so your tag will looks like:

<div class="oe_chatter" attrs="{'invisible': [('stage_id','=',3)]}"> 

if you're using xpath:

<attribute name="attrs">{'invisible': [('stage_id','=',3)]}</attribute>

Update:

I made a simple example to you in the GitHub , this will hide the oe_chatter if the stage is in 'Done' Or 'Testing'

you can add your specific stages in this line ...

I hope this can helps you to achieve what you're looking for ...


Kind Regards

Let me enlighten a bit what I'm talking about. In project I have four stages: 1. Purchases 2. Delivered 3. Sorting 4. Done so once I post a task into stage 1 i would like to make followers visible and let the project send message to the followers that new product is ordered and I'm waiting for it. Once I receive it I'll move it to the next stage but I do not want send anything so in this stage Followers needs to be hidden, same in stage 3. At the end if stage will = 'Done' followers will be back visible and message will be send informing followers "this product is ready to be sell" ... something like that. I don't want add any new fields, I would like to do it based on existing fields in Odoo.

Dr Obx
on 8/5/15, 9:41 AM

Updated my answer ...

Ahmed M.Elmubarak
on 8/5/15, 10:18 AM

Unfortunately it doesn't work neither if I use numbers or Stage names ....

Dr Obx
on 8/5/15, 11:01 AM

Can you post what you did ?

Ahmed M.Elmubarak
on 8/6/15, 2:56 AM

I already tried this: ..div.. .. attrs="{'invisible': [('stage_id','=','Arrived')]}" class="oe_chatter" /.. ..field name="message_ids" attrs="{'invisible': [('stage_id','=','Sorting')]}"/.. ..field name="message_follower_ids" groups="base.group_user" attrs="{'invisible': [('stage_id','=','Finished')]}"/.. ../div..

Dr Obx
on 8/6/15, 4:05 AM

so I expected followers to be hidden until stage_id is not equal 'Done'

Dr Obx
on 8/6/15, 4:24 AM

It'll not work like that, the stage_id doesn't store string value, it is a many2one field so it just handle integer number (ID from the related table). If you'd like to test the invisible is working try attrs="{'invisible': True}", and the chatter will be invisible. To make it work for now[Since you don't want to add a new field and I don't know why], you have to know the ID of the e.g 'Done' stage. In the posgresql make a query "SELECT id FROM project_task_type WHERE name = 'Done';" then you can use this id in your invisible domain as the example in my answer. Just try it and post your update, and if I found spare time I'll try to make a complete example to you since it is not a complicated issue ...

Ahmed M.Elmubarak
on 8/6/15, 7:22 AM

It's interesting. For testing purposes I just added .. field name="stage_id" readonly="1"/.. into the form and it display value stored by this field and it is not a digit but string. Exactly the same value as in the top bar. I tried use stage_id with a numbers "attrs={'invisible':[('stage_id','=',number here)]}" as well but it gives me an error all the time.

Dr Obx
on 8/6/15, 9:19 AM

Updated my answer ..

Ahmed M.Elmubarak
on 8/8/15, 6:18 AM
0
Dr Obx
On 8/6/15, 9:45 AM

Here is the code:

On screen you can see "Stage" which is stage_id value

attrs = invisible if stage_id  is "Finished" so "Send message" should be invisible.


 

Updated my answer.

Ahmed M.Elmubarak
on 8/8/15, 6:17 AM

Must say ..... superb. Works damn well :). Also i was thinking that it would be good if I can for example add one more field into the project stage type like send message yes/no so once i set send message to yes when project is on this stage it will send message (show chatter) or not then chatter will not be visible. Hope you know what i mean.

Dr Obx
on 8/10/15, 6:02 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

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

Question tools

1 follower(s)

Stats

Asked: 8/5/15, 7:02 AM
Seen: 682 times
Last updated: 8/8/15, 6:16 AM