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

Requested reviews:
  OpenERP R&D Team (openerp-dev)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-int/mck_warning_ir_value/+merge/130810
-- 
https://code.launchpad.net/~openerp-dev/openerp-int/mck_warning_ir_value/+merge/130810
Your team OpenERP R&D Team is requested to review the proposed merge of 
lp:~openerp-dev/openerp-int/mck_warning_ir_value into 
lp:~openerp-dev/openerp-int/mck_addons.
=== modified file 'mck_common/wizard/send_mail.py'
--- mck_common/wizard/send_mail.py	2012-10-20 13:47:02 +0000
+++ mck_common/wizard/send_mail.py	2012-10-22 12:59:21 +0000
@@ -60,24 +60,8 @@
 
     # _invite
     # _event
-    def _invitee_id(self,cr,uid,context=None):
-        if context:
-            return context.get('invitee_ids')
-        else:
-            return False
-
-    def _get_event(self,cr,uid,context=None):
-        if context and context.get('invitee_ids'):
-            event_id = 0
-            for invitee in self.pool.get(self._invite).browse(cr,uid,context.get('invitee_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 'invites' 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
+
+
 
     def send_mail(self, cr, uid, ids, context=None):
         context = context or {}
@@ -293,10 +277,7 @@
             return email_template.name_get(cr, uid, record_ids, context) + [(False,'')]
         return []
 
-    _defaults = {
-        'event_id': _get_event,
-        'invitee_ids': _invitee_id,
-    }
+
 
     _columns = {
         'event_id' : fields.integer("Dummy"),

=== modified file 'mck_common/wizard/update_invitees.py'
--- mck_common/wizard/update_invitees.py	2012-07-03 14:51:04 +0000
+++ mck_common/wizard/update_invitees.py	2012-10-22 12:59:21 +0000
@@ -6,25 +6,6 @@
 class update_invitees(AbstractModel):
     _name = 'base.update.invitees'
 
-    def _invitee_list(self,cr,uid,context=None):
-        res = []
-        if context:
-            res = context.get('active_ids')
-        return res
-
-    def _event_id(self,cr,uid,context=None):
-        if context:
-            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 invites 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
-
     def update_invitee(self,cr,uid,ids,context=None):
         invitee_ids = context.get('active_ids')
         for update in self.browse(cr,uid,ids,context=context):
@@ -36,8 +17,3 @@
         'invitee_ids' : fields.integer("Dummy"),
     }
 
-    _defaults = {
-        'event_id': _event_id,
-        'invitee_ids' : _invitee_list,
-    }
-

=== modified file 'mck_event/wizard/send_mail.py'
--- mck_event/wizard/send_mail.py	2012-10-15 21:07:19 +0000
+++ mck_event/wizard/send_mail.py	2012-10-22 12:59:21 +0000
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 from openerp.osv.orm import Model, TransientModel, AbstractModel
 from openerp.osv import fields
-
+from openerp.osv.osv import except_osv
 class email_send_event(TransientModel):
     _name = 'mck.event.mail_compose_message'
     _inherit = 'mck.base.mail_compose_message'
@@ -11,14 +11,39 @@
     _event = 'mck.event'
     _status = 'event.stage'
     _validation_model = 'mck.event.partner.validation'
-
+    _event_id = 0
+    _invitee_list = []
     _columns = {
         'event_id' : fields.many2one(_event,'Event'),
         'invitee_ids' : fields.many2many(_invite,string='Invites'),
         'status_id': fields.many2one(_status,'Status after emailing'),
         'attachment_ids': fields.many2many('ir.attachment', 'message_attachment_rel_event', 'message_id', 'attachment_id', 'Attachments'),
     }
-
+    def _check_invitee_email(self,cr,uid,context=None):
+        if context and context.get('active_ids'):
+            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 'invites' or 'recipients') + " you have selected do not belong to the same "+ (self._event == 'mck.event' and 'event' or 'publication') +". Please change your selection"),)
+            self._event_id = event_id
+            self._invitee_list = context.get('active_ids')
+            return {
+                'name' : 'action_sidebar_invitee',
+                'view_type': 'form',
+                'view_mode': 'form',
+                'res_model': 'mck.event.mail_compose_message',
+                'type' : 'ir.actions.act_window',
+                'target' : 'new',
+            }
+        else:
+            return False
+    _defaults = {
+        'event_id': lambda self,cr,uid,context:self._event_id,
+        'invitee_ids' : lambda self,cr,uid,context:self._invitee_list,
+    }
 class confirm_email(TransientModel):
     _name = 'mck.event.mail.confirm.ok'
     _inherit = 'mail.confirm.ok'

=== modified file 'mck_event/wizard/update_invitees.py'
--- mck_event/wizard/update_invitees.py	2012-09-25 12:43:22 +0000
+++ mck_event/wizard/update_invitees.py	2012-10-22 12:59:21 +0000
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 from openerp.osv.orm import Model, TransientModel, AbstractModel
 from openerp.osv import fields
-
+from openerp.osv.osv import except_osv
 class update_invitees(TransientModel):
     _name = 'update.invitees'
     _inherit = 'base.update.invitees'
@@ -16,4 +16,35 @@
         'invitee_ids' : fields.many2many(_invite,'invites',readonly=True),
         'status_id' : fields.many2one(_status,'Update the status of these invites to', required=True),
     }
-
+    _event_id = 0
+    _invitee_list = []
+    
+    def _check_different_event(self,cr,uid,context=None):
+        if context:
+            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 invites you have selected do not belong to the same event. Please change your selection"))
+            self._event_id = event_id
+            self._invitee_list = context.get('active_ids')
+            return {
+                'name' : 'action_sidebar_invitee',
+                'view_type': 'form',
+                'view_mode': 'form',
+                'res_model': 'update.invitees',
+                'type' : 'ir.actions.act_window',
+                'target' : 'new',
+            }
+
+        else:
+            return False
+
+
+
+    _defaults = {
+        'event_id': lambda self,cr,uid,context:self._event_id,
+        'invitee_ids' : lambda self,cr,uid,context:self._invitee_list,
+    }
\ No newline at end of file

=== modified file 'mck_event/wizard/view/add_invitees_view.xml'
--- mck_event/wizard/view/add_invitees_view.xml	2012-09-19 07:54:36 +0000
+++ mck_event/wizard/view/add_invitees_view.xml	2012-10-22 12:59:21 +0000
@@ -158,13 +158,16 @@
 			src_model="mck.event" view_mode="form" view_type="form" target="new"
 			key2="client_action_multi" />
 
-	
-
 		<act_window id="action_batch_previous_add_invitee" name="Add executive(s) from past event"
 			view_id="action_add_invitees_previous_view" res_model="add.invitee.previous.wizard"
 			src_model="mck.event" view_mode="form" view_type="form" target="new"
 			key2="client_action_multi" />
 
+
+            
+
+
+
 		<record model="ir.actions.act_window" id="action_add_invitees_previous">
 			<field name="name">Add executive(s) from past event
 			</field>
@@ -174,6 +177,25 @@
 			<field name="view_mode">form</field>
 			<field name="target">new</field>
 		</record>
+
+
+		<record model="ir.actions.server" id="server_action_add_previous_invitee">
+			<field name="name">server action previous invitee </field>
+			<field name="model_id" ref="mck_event.model_mck_invitee"/>
+			<field name="state">code</field>
+			<field name="code"> print 'hello world'</field>
+
+		</record>
+
+        <record id="ir_values_add_previous" model="ir.values">
+            <field name="name">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_add_previous_invitee'))" />
+        </record> 
+
+
 		
 		<!-- Migration -->
 		<delete model="ir.values" search="[('name', '=', 'action_batch_add_invitee'), ('model', '=', 'mck.invitee')]" />

=== modified file 'mck_event/wizard/view/send_email.xml'
--- mck_event/wizard/view/send_email.xml	2012-09-19 08:12:22 +0000
+++ mck_event/wizard/view/send_email.xml	2012-10-22 12:59:21 +0000
@@ -78,11 +78,21 @@
 			</field>
 		</record>
 
-		<act_window id="action_batch_send_email" name="Email invitees"
-			view_id="email_form_wizard_view" res_model="mck.event.mail_compose_message"
-			src_model="mck.invitee"
-			context="{'invitee_ids' : active_ids, 'mail.compose.message.mode' : 'mass_mail' }"
-			view_mode="form" view_type="form" target="new" key2="client_action_multi" />
+        <record model="ir.actions.server" id="server_action_send_email_invitee">
+            <field name="name">Email invitee</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>
+
+        </record>
+
+        <record id="ir_values_send_email" model="ir.values">
+            <field name="name">send_email</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_send_email_invitee'))" />
+        </record>
 
 	</data>
 </openerp>

=== modified file 'mck_event/wizard/view/update.xml'
--- mck_event/wizard/view/update.xml	2012-09-18 08:49:48 +0000
+++ mck_event/wizard/view/update.xml	2012-10-22 12:59:21 +0000
@@ -34,10 +34,22 @@
                 </field>
             </record>
             
-            <act_window id="action_batch_update_invitee"
-            name="Update the status of invites" view_id="upate_invitee_wizard"
-            res_model="update.invitees" src_model="mck.invitee"
-            view_mode="form" view_type="form" target="new" 
-            key2="client_action_multi"/>
+
+            <record model="ir.actions.server" id="server_action_add_previous_invitee">
+                <field name="name">Update the status of invites</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>
+
+            </record>
+
+            <record id="ir_values_add_previous" model="ir.values">
+                <field name="name">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_add_previous_invitee'))" />
+            </record> 
+
     </data>
 </openerp>

=== modified file 'mck_publication/wizard/export_recipient.py'
--- mck_publication/wizard/export_recipient.py	2012-10-09 20:16:25 +0000
+++ mck_publication/wizard/export_recipient.py	2012-10-22 12:59:21 +0000
@@ -6,7 +6,10 @@
 
 class executive(osv.osv_memory):
     _name = 'mck.publicatoin.recipient.export'
-    
+
+
+    _event_id = 0
+    _invitee_list = []    
     def _recipient_list(self,cr,uid,context=None):
         res = []
         if context:
@@ -14,10 +17,12 @@
         return res
     
     def _get_publication(self,cr,uid,context=None):
+
         res = False
         if context:
             active_ids = context.get('active_ids')
             event = 0
+
             for recipient in self.pool.get('mck.recipient').browse(cr,uid,active_ids,context=context):
                 if event == 0:
                     event = recipient.event_id.id
@@ -25,9 +30,18 @@
                     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"))
                 event = recipient.event_id.id
-            return event
-
-        return res
+            self._event_id = event
+            self._invitee_list = context.get('active_ids')
+            return {
+                'name' : 'action_sidebar_invitee',
+                'view_type': 'form',
+                'view_mode': 'form',
+                'res_model': 'mck.publicatoin.recipient.export',
+                'type' : 'ir.actions.act_window',
+                'target' : 'new',
+            }
+        else:
+            return False
         
     _columns = {
         'publication_id' : fields.many2one('mck.publication','Publication'),
@@ -37,12 +51,11 @@
         'xls_file' : fields.binary("File",readonly=True),
         'datas_fname' : fields.char("File Name",64),
     }
-    
     _defaults = {
         'state' : 'draft',
         'datas_fname' : 'recipients_addresses.xls',
-        'recipient_ids' : _recipient_list,
-        'publication_id' : _get_publication,
+        'recipient_ids' : lambda self,cr,uid,context:self._invitee_list,
+        'publication_id' : lambda self,cr,uid,context:self._event_id,
     }
     
     def open_stpe2(self,cr,uid,ids,context=None):

=== modified file 'mck_publication/wizard/send_mail.py'
--- mck_publication/wizard/send_mail.py	2012-10-15 21:07:19 +0000
+++ mck_publication/wizard/send_mail.py	2012-10-22 12:59:21 +0000
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 from openerp.osv.orm import Model, TransientModel, AbstractModel
 from openerp.osv import fields
-
+from openerp.osv.osv import except_osv
 class email_send_event(TransientModel):
     _name = 'mck.publication.mail_compose_message'
     _inherit = 'mck.base.mail_compose_message'
@@ -11,7 +11,8 @@
     _invite = 'mck.recipient'
     _status = 'publication.stage'
     _validation_model = 'mck.publication.partner.validation.data'
-
+    _event_id = 0
+    _invitee_list = []
     _columns = {
         'event_id' : fields.many2one(_event,'Publication'),
         'invitee_ids' : fields.many2many(_invite,string='Recipients'),
@@ -19,6 +20,31 @@
         'attachment_ids': fields.many2many('ir.attachment', 'message_attachment_rel_pub', 'message_id', 'attachment_id', 'Attachments'),
     
     }
+    def _check_recipient_email(self,cr,uid,context=None):
+        if context and context.get('active_ids'):
+            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 'invites' or 'recipients') + " you have selected do not belong to the same "+ (self._event == 'mck.event' and 'event' or 'publication') +". Please change your selection"),)
+            self._event_id = event_id
+            self._invitee_list = context.get('active_ids')
+            return {
+                'name' : 'action_sidebar_invitee',
+                'view_type': 'form',
+                'view_mode': 'form',
+                'res_model': 'mck.publication.mail_compose_message',
+                'type' : 'ir.actions.act_window',
+                'target' : 'new',
+            }
+        else:
+            return False
+    _defaults = {
+        'event_id': lambda self,cr,uid,context:self._event_id,
+        'invitee_ids' : lambda self,cr,uid,context:self._invitee_list,
+    }
 
 class confirm_email(TransientModel):
     _inherit = 'mail.confirm.ok'

=== modified file 'mck_publication/wizard/update_invitees.py'
--- mck_publication/wizard/update_invitees.py	2012-09-25 12:43:22 +0000
+++ mck_publication/wizard/update_invitees.py	2012-10-22 12:59:21 +0000
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 from openerp.osv.orm import Model, TransientModel, AbstractModel
 from openerp.osv import fields
-
+from openerp.osv.osv import except_osv
 class update_invitees(TransientModel):
     _name = 'publication.update.invitees'
     _inherit = 'base.update.invitees'
@@ -16,4 +16,33 @@
         'invitee_ids' : fields.many2many(_invite, 'publication_update_mck_recipient', 'recipient_id', 'update_id', string='recipients',readonly=True),
         'status_id' : fields.many2one(_status,'Update the status of these recipients to', required=True),
     }
-
+    _event_id = 0
+    _invitee_list = []
+
+    def _check_different_publication(self,cr,uid,context=None):
+        if context:
+            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 invites you have selected do not belong to the same publication. Please change your selection"))
+            self._event_id = event_id
+            self._invitee_list = context.get('active_ids')
+            return {
+                'name' : 'action_sidebar_invitee',
+                'view_type': 'form',
+                'view_mode': 'form',
+                'res_model': 'update.invitees',
+                'type' : 'ir.actions.act_window',
+                'target' : 'new',
+            }
+
+        else:
+            return False
+
+    _defaults = {
+        'event_id': lambda self,cr,uid,context:self._event_id,
+        'invitee_ids' : lambda self,cr,uid,context:self._invitee_list,
+    }
\ No newline at end of file

=== modified file 'mck_publication/wizard/view/export_recipient.xml'
--- mck_publication/wizard/view/export_recipient.xml	2012-09-18 08:49:48 +0000
+++ mck_publication/wizard/view/export_recipient.xml	2012-10-22 12:59:21 +0000
@@ -45,9 +45,29 @@
                 </form>
                 </field>
             </record>
+
+            <!--
             <act_window id="action_export_recipient"
             name="Export addresses" 
             res_model="mck.publicatoin.recipient.export" src_model="mck.recipient"
             view_mode="form" view_type="form" target="new" key2="client_action_multi"/>
+            -->
+            <record model="ir.actions.server" id="server_action_export">
+                <field name="name">Export addresses</field>
+                <field name="model_id" ref="mck_publication.model_mck_publicatoin_recipient_export"/>
+                <field name="state">code</field>
+                <field name="code">action = self._get_publication(cr,uid,context=context)</field>
+
+            </record>
+
+            <record id="ir_values_add_previous" model="ir.values">
+                <field name="name">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_export'))" />
+            </record> 
+
+
     </data>
 </openerp>

=== modified file 'mck_publication/wizard/view/send_email.xml'
--- mck_publication/wizard/view/send_email.xml	2012-09-19 08:12:22 +0000
+++ mck_publication/wizard/view/send_email.xml	2012-10-22 12:59:21 +0000
@@ -73,11 +73,22 @@
 			</field>
 		</record>
 		
-		<act_window id="action_batch_send_email" name="Email recipients"
-			view_id="publication_email_form_wizard_view" res_model="mck.publication.mail_compose_message" src_model="mck.recipient"
-            context="{'invitee_ids' : active_ids, 'mail.compose.message.mode' : 'mass_mail' }"
-			view_mode="form" view_type="form" target="new" 
-            key2="client_action_multi"/>
+
+        <record model="ir.actions.server" id="server_action_send_email_recipient">
+            <field name="name">Email recipients</field>
+            <field name="model_id" ref="mck_publication.model_mck_publication_mail_compose_message"/>
+            <field name="state">code</field>
+            <field name="code">action = self._check_recipient_email(cr,uid,context=context)</field>
+
+        </record>
+
+        <record id="ir_values_send_email_publication" model="ir.values">
+            <field name="name">send_email</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_send_email_recipient'))" />
+        </record>
 
 	</data>
 </openerp>

=== modified file 'mck_publication/wizard/view/update.xml'
--- mck_publication/wizard/view/update.xml	2012-09-18 08:49:48 +0000
+++ mck_publication/wizard/view/update.xml	2012-10-22 12:59:21 +0000
@@ -37,11 +37,21 @@
                     </group>
                 </field>
             </record>
-            
-            <act_window id="action_batch_update_invitee"
-            name="Update the status of recipients" view_id="update_recipient_wizard"
-            res_model="publication.update.invitees" src_model="mck.recipient"
-            view_mode="form" view_type="form" target="new" 
-            key2="client_action_multi"/>
+
+            <record model="ir.actions.server" id="server_action_add_previous_invitee">
+                <field name="name">Update the status of invites</field>
+                <field name="model_id" ref="mck_publication.model_publication_update_invitees"/>
+                <field name="state">code</field>
+                <field name="code">action = self._check_different_publication(cr,uid,context=context)</field>
+
+            </record>
+
+            <record id="ir_values_add_previous" model="ir.values">
+                <field name="name">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_add_previous_invitee'))" />
+            </record> 
     </data>
 </openerp>

_______________________________________________
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