The proposal to merge lp:~openerp-dev/openobject-server/trunk-need_action-tde 
into lp:openobject-server has been updated.

Description changed to:

Need action mechanism
=====================

ir.needaction mixin class
++++++++++++++++++++++++++

This revision adds a mixin class for objects using the need action feature.

Need action feature can be used by objects willing to be able to signal that an 
action is required on a particular record. If in the business logic an action 
must be performed by somebody, for instance validation by a manager, this 
mechanism allows to set a list of users asked to perform an action.

This class wraps a class (ir.needaction_users) that behaves like a many2many 
field. However, no field is added to the model inheriting from base.needaction. 
The mixin class manages the low-level considerations of updating relationships. 
Every change made on the record calls a method that updates the relationships.

Objects using the need_action feature should override the 
``get_needaction_user_ids`` method. This methods returns a dictionary whose 
keys are record ids, and values a list of user ids, like in a many2many 
relationship. Therefore by defining only one method, you can specify if an 
action is required by defining the users that have to do it, in every possible 
situation.

This class also offers several global services,:
 - ``needaction_get_record_ids``: for a given model_name and uid, get all 
record ids that ask this user to perform an action. This mechanism is used for 
instance to display the number of pending actions in menus, such as Leads (12)
 - ``needaction_get_action_count``: as ``needaction_get_record_ids`` but 
returns only the number of action, not the ids (performs a search with 
count=True)
 - ``needaction_get_user_record_references``: for a given uid, get all the 
records that ask this user to perform an action. Records are given as 
references, a list of tuples (model_name, record_id)

Menu modification
+++++++++++++++++

This revision adds three functional fields to ``ir.ui.menu`` model :
 - ``uses_needaction``: boolean field. If the menu entry action is an 
act_window action, and if this action is related to a model that uses the 
need_action mechanism, this field is set to true. Otherwise, it is false.
 - ``needaction_uid_ctr``: integer field. If the target model uses the need 
action mechanism, this field gives the number of actions the current user has 
to perform.
 - ``needaction_record_ids``: many2many field. If the target model uses the 
need action mechanism, this field holds the ids of the record requesting the 
user to perform an action.

Those fields are functional, because they must be recalculated for each user, 
and each time menus are displayed. ``needaction_uid_ctr`` takes into account 
the domain of the action, in order to display accurate numbers.

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-need_action-tde/+merge/97207
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-need_action-tde/+merge/97207
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/trunk-need_action-tde.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to