Review: Needs Fixing

Hello,

Just a quick review after the CRM review. In mrp_operations.py, you have 
several functions like :
def cancel_notification(self, cr, uid, ids):
334     +        prod_obj = self.pool.get('mrp.production')
335     +        for workorder in self.browse(cr, uid, ids):
336     +            for prod in prod_obj.browse(cr, uid, 
[workorder.production_id]):
337     +                message = _("Work Order is <b>cancelled</b> for 
<em>%s</em> production order.") % (prod.id.name)
338     +        self.message_append_note(cr, uid, ids, '', message)
339     +        return True

Why is the self.message_append_note not aligned with its message, leading to a 
message send outside of the for loops ?

Also, pay attention to :
 def create_notification(self, cr, uid, ids, context=None):
73      +        for obj in self.browse(cr, uid, ids, context=context):
74      +            if obj.user_id.id :
75      +                self.message_subscribe(cr, uid, ids, [obj.user_id.id], 
context=context)
76      +                self.message_append_note(cr, uid, ids, _('System 
notification'),
77      +                        _("Manufacturing Order is <b>Created</b>."), 
type='notification', context=context)
78      +            else :
79      +                self.message_append_note(cr, uid, ids, _('System 
notification'),
80      +                        _("Manufacturing Order is <b>Created</b>."), 
type='notification', context=context)
81      +        return True
This can be simplified by getting the message_append_note outside of the 
if-else structure.

Best regards,

Thibault.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-social-mrp-bth/+merge/96755
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-social-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