Max (OpenERP) has proposed merging 
lp:~openerp-dev/openerp-int/mck_check_on_partner_validation into 
lp:~openerp-dev/openerp-int/mck_addons.

Requested reviews:
  tfr (Openerp) (tfr)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-int/mck_check_on_partner_validation/+merge/133095

[IMP] Changed “invites” to “invitees” and added error message when invoking 
“Email Partners for Validation” wizard with invitees/recipients with different 
events/publications
-- 
https://code.launchpad.net/~openerp-dev/openerp-int/mck_check_on_partner_validation/+merge/133095
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-int/mck_addons.
=== modified file 'mck_common/wizard/add_invitees.py'
--- mck_common/wizard/add_invitees.py	2012-10-02 13:04:33 +0000
+++ mck_common/wizard/add_invitees.py	2012-11-06 16:40:25 +0000
@@ -195,7 +195,7 @@
                             
                     already_invited.append(data)
                     #TODO it's a warning not an error
-                    #raise except_osv(('Warning'),("The invites you have selected do not belong to the same event. Please change your selection"))
+                    #raise except_osv(('Warning'),("The invitees you have selected do not belong to the same event. Please change your selection"))
                 else:
                     new_value = {
                             'role_id' : self.pool.get('base.invitee.confirmation.popup')._retrieve_role(invitee.executive_id,update.new_event_id.priority_id),

=== modified file 'mck_common/wizard/partner_validation.py'
--- mck_common/wizard/partner_validation.py	2012-10-22 14:30:14 +0000
+++ mck_common/wizard/partner_validation.py	2012-11-06 16:40:25 +0000
@@ -19,6 +19,31 @@
 class partner_validation_wizard(AbstractModel):
     _name = "mck.base.partner.validation.event"
 
+    def _check_different_event(self,cr,uid,context=None):
+        """
+            Check call by server action to avoid having invite/recipient from different event/publication
+        """
+        if not context or not context.get('active_ids'):
+            return False
+        
+        event_id = 0
+        for invitee in self.pool.get(self._invite).browse(cr, uid, context.get('active_ids'), context=context):
+            if event_id == 0:
+                event_id = invitee.event_id.id
+            else:
+                if invitee.event_id.id != event_id:
+                    raise except_osv(('Warning'),("The " + (self._event == 'mck.event' and 'invitees' or 'recipients') + " you have selected do not belong to the same "+ (self._event == 'mck.event' and 'event' or 'publication') +". Please change your selection"))
+
+        return {
+                'name' : 'action_sidebar_invitee',
+                'view_type': 'form',
+                'view_mode': 'form',
+                'res_model': self._name,
+                'type' : 'ir.actions.act_window',
+                'target' : 'new',
+                'context' : {'active_ids' : context.get('active_ids'), 'active_model' : self._invite, 'event_id' : event_id}
+        }
+
     def check_same_event (self,cr,uid,ids,context=None):
         pass
 

=== modified file 'mck_common/wizard/send_mail.py'
--- mck_common/wizard/send_mail.py	2012-11-06 13:42:58 +0000
+++ mck_common/wizard/send_mail.py	2012-11-06 16:40:25 +0000
@@ -74,7 +74,7 @@
                     event_id = invitee.event_id.id
                 else:
                     if invitee.event_id.id != event_id:
-                        raise except_osv(('Warning'),("The " + (self._event == 'mck.event' and 'invites' or 'recipients') + " you have selected do not belong to the same "+ (self._event == 'mck.event' and 'event' or 'publication') +". Please change your selection"),)
+                        raise except_osv(('Warning'),("The " + (self._event == 'mck.event' and 'invitees' or 'recipients') + " you have selected do not belong to the same "+ (self._event == 'mck.event' and 'event' or 'publication') +". Please change your selection"),)
             return event_id
         else:
             return False
@@ -316,7 +316,7 @@
                 event_id = invitee.event_id.id
             else:
                 if invitee.event_id.id != event_id:
-                    raise except_osv(('Warning'),("The " + (self._event == 'mck.event' and 'invites' or 'recipients') + " you have selected do not belong to the same "+ (self._event == 'mck.event' and 'event' or 'publication') +". Please change your selection"),)
+                    raise except_osv(('Warning'),("The " + (self._event == 'mck.event' and 'invitees' or 'recipients') + " you have selected do not belong to the same "+ (self._event == 'mck.event' and 'event' or 'publication') +". Please change your selection"),)
 
         return {
                 'name' : 'action_sidebar_invitee',

=== modified file 'mck_common/wizard/update_invitees.py'
--- mck_common/wizard/update_invitees.py	2012-11-06 13:42:58 +0000
+++ mck_common/wizard/update_invitees.py	2012-11-06 16:40:25 +0000
@@ -17,7 +17,6 @@
         'invitee_ids' : fields.integer("Dummy"),
     }
     
-    
     def _check_different_event(self,cr,uid,context=None):
         """
             Check call by server action to avoid having invite/recipient from different event/publication
@@ -32,7 +31,7 @@
                 event_id = invitee.event_id.id
             else:
                 if invitee.event_id.id != event_id:
-                    raise except_osv(('Warning'),("The invites you have selected do not belong to the same event. Please change your selection"))
+                    raise except_osv(('Warning'),("The " + (self._event == 'mck.event' and 'invitees' or 'recipients') + " you have selected do not belong to the same "+ (self._event == 'mck.event' and 'event' or 'publication') +". Please change your selection"))
         
         
         return {

=== modified file 'mck_event/wizard/partner_validation.py'
--- mck_event/wizard/partner_validation.py	2012-05-30 10:12:53 +0000
+++ mck_event/wizard/partner_validation.py	2012-11-06 16:40:25 +0000
@@ -21,6 +21,8 @@
     _invite = 'mck.invitee'
     _mail_wizard = 'mck.event.mail_compose_message'
 
+    _event = 'mck.event'
+
     _columns = {
         "data" : fields.many2many(_validation_data, 'mck_validation_event_data_rel', 'data_id', 'validation_id', string="Validations Email Data", readonly=True)
     }

=== modified file 'mck_event/wizard/view/email_validation.xml'
--- mck_event/wizard/view/email_validation.xml	2012-07-19 21:17:14 +0000
+++ mck_event/wizard/view/email_validation.xml	2012-11-06 16:40:25 +0000
@@ -30,11 +30,21 @@
                 </form>
                 </field>
             </record>
-            
-            <act_window id="action_batch_email_validation"
-            name="Email partners for validation" 
-            res_model="mck.event.partner.validation" src_model="mck.invitee"
-            view_mode="form" view_type="form" target="new" multi="True"
-      														key2="client_action_multi"/>
+
+            <record model="ir.actions.server" id="server_action_email_partners_for_validation">
+                <field name="name">Email partners for validation</field>
+                <field name="model_id" ref="mck_event.model_mck_event_partner_validation"/>
+                <field name="state">code</field>
+                <field name="code">action = self._check_different_event(cr,uid,context=context)</field>
+            </record>
+
+            <record id="ir_values_email_partners_for_validation" model="ir.values">
+                <field name="name">Email partners for validation</field>
+                <field name="key2">client_action_multi</field>
+                <field name="key">action</field>
+                <field name="model">mck.invitee</field>
+                <field name="value" eval="'ir.actions.server,' +str(ref('server_action_email_partners_for_validation'))" />
+            </record> 
+
     </data>
 </openerp>

=== modified file 'mck_event/wizard/view/send_email.xml'
--- mck_event/wizard/view/send_email.xml	2012-10-22 12:55:13 +0000
+++ mck_event/wizard/view/send_email.xml	2012-11-06 16:40:25 +0000
@@ -79,7 +79,7 @@
 		</record>
 
         <record model="ir.actions.server" id="server_action_send_email_invitee">
-            <field name="name">Email invitee</field>
+            <field name="name">Email invitees</field>
             <field name="model_id" ref="mck_event.model_mck_event_mail_compose_message"/>
             <field name="state">code</field>
             <field name="code">action = self._check_invitee_email(cr,uid,context=context)</field>

=== modified file 'mck_event/wizard/view/update.xml'
--- mck_event/wizard/view/update.xml	2012-11-06 12:14:20 +0000
+++ mck_event/wizard/view/update.xml	2012-11-06 16:40:25 +0000
@@ -36,7 +36,7 @@
             
 
             <record model="ir.actions.server" id="server_action_update_invites">
-                <field name="name">Update the status of invites</field>
+                <field name="name">Update the status of invitees</field>
                 <field name="model_id" ref="mck_event.model_update_invitees"/>
                 <field name="state">code</field>
                 <field name="code">action =  self._check_different_event(cr,uid,context=context)</field>
@@ -50,6 +50,5 @@
                 <field name="model">mck.invitee</field>
                 <field name="value" eval="'ir.actions.server,' +str(ref('server_action_update_invites'))" />
             </record> 
-
     </data>
 </openerp>

=== modified file 'mck_publication/wizard/export_recipient.py'
--- mck_publication/wizard/export_recipient.py	2012-11-06 13:42:58 +0000
+++ mck_publication/wizard/export_recipient.py	2012-11-06 16:40:25 +0000
@@ -23,7 +23,7 @@
                 event = recipient.event_id.id
             else:
                 if event != recipient.event_id.id:
-                    raise except_osv(('Warning'),("The recipient you have selected do not belong to the same publication. Please change your selection"))
+                    raise except_osv(('Warning'),("The recipients you have selected do not belong to the same publication. Please change your selection"))
             
         return {
                 'name' : 'action_sidebar_invitee',

=== modified file 'mck_publication/wizard/partner_validation.py'
--- mck_publication/wizard/partner_validation.py	2012-06-05 07:53:32 +0000
+++ mck_publication/wizard/partner_validation.py	2012-11-06 16:40:25 +0000
@@ -23,6 +23,8 @@
     _invite = 'mck.recipient'
     _mail_wizard = 'mck.publication.mail_compose_message'
 
+    _event = 'mck.publication'
+
     _columns = {
         "data" : fields.many2many(_validation_data, 'mck_validation_publication_data_rel', 'data_id', 'validation_id', string="Validations Email Data", readonly=True)
     }

=== modified file 'mck_publication/wizard/view/email_validation.xml'
--- mck_publication/wizard/view/email_validation.xml	2012-07-19 21:17:14 +0000
+++ mck_publication/wizard/view/email_validation.xml	2012-11-06 16:40:25 +0000
@@ -43,11 +43,21 @@
                 </field>
             </record>
             
-            <act_window id="action_batch_email_validation"
-            name="Email partners for validation" 
-            res_model="mck.publication.partner.validation" src_model="mck.recipient"
-            view_mode="form" view_type="form" target="new" multi="True"
-      														key2="client_action_multi"/>
+            <record model="ir.actions.server" id="server_action_email_partners_for_validation">
+                <field name="name">Email partners for validation</field>
+                <field name="model_id" ref="mck_publication.model_mck_publication_partner_validation"/>
+                <field name="state">code</field>
+                <field name="code">action = self._check_different_event(cr,uid,context=context)</field>
+            </record>
+
+            <record id="ir_values_email_partners_for_validation" model="ir.values">
+                <field name="name">Email partners for validation</field>
+                <field name="key2">client_action_multi</field>
+                <field name="key">action</field>
+                <field name="model">mck.recipient</field>
+                <field name="value" eval="'ir.actions.server,' +str(ref('server_action_email_partners_for_validation'))" />
+            </record> 
+            
     </data>
 </openerp>
 

=== modified file 'mck_publication/wizard/view/update.xml'
--- mck_publication/wizard/view/update.xml	2012-11-06 13:42:58 +0000
+++ mck_publication/wizard/view/update.xml	2012-11-06 16:40:25 +0000
@@ -39,7 +39,7 @@
             </record>
 
             <record model="ir.actions.server" id="server_action_update_recipients">
-                <field name="name">Update the status of invites</field>
+                <field name="name">Update the status of invitees</field>
                 <field name="model_id" ref="mck_publication.model_publication_update_invitees"/>
                 <field name="state">code</field>
                 <field name="code">action = self._check_different_event(cr,uid,context=context)</field>
@@ -47,7 +47,7 @@
             </record>
 
             <record id="ir_values_update_recipient" model="ir.values">
-                <field name="name">Update the status of invites</field>
+                <field name="name">Update the status of invitees</field>
                 <field name="key2">client_action_multi</field>
                 <field name="key">action</field>
                 <field name="model">mck.recipient</field>

_______________________________________________
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