← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/fixed_list_out_range_error into lp:~openobject-training/openobject-addons/training

 

gpa(Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/fixed_list_out_range_error into lp:~openobject-training/openobject-addons/training.

Requested reviews:
  Bhumika (OpenERP) (sbh-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/fixed_list_out_range_error/+merge/59043

Fixed the list index out of range and rename the Training Management to Training
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/fixed_list_out_range_error/+merge/59043
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/fixed_list_out_range_error.
=== renamed file 'profile_training/__terp__.py' => 'profile_training/__openerp__.py'
--- profile_training/__terp__.py	2011-02-25 12:33:02 +0000
+++ profile_training/__openerp__.py	2011-04-26 11:27:59 +0000
@@ -31,8 +31,6 @@
 the choice to install the examn management and the room management""",
     'depends' : [
         'training',
-        'base_contact_crm',
-        'crm_configuration',
         'crm',
         'mrp',
     ],

=== modified file 'training/training.py'
--- training/training.py	2011-04-25 06:52:43 +0000
+++ training/training.py	2011-04-26 11:27:59 +0000
@@ -2942,7 +2942,7 @@
         'create_date' : fields.datetime('Creation Date', select=True, readonly=True),
         'state' : fields.selection([('draft', 'Draft'), ('confirmed','Request Sent'), ('cancelled','Cancelled'), ('done', 'Done') ], 'State', readonly=True, required=True, select=1,help='The state of the Subscription'),
         'partner_id' : fields.many2one('res.partner', 'Partner', select=1, required=True,help='The Subscription name', **WRITABLE_ONLY_IN_DRAFT),
-        'partner_rh_email' : fields.char('Subscription Contact', size=64),
+        'partner_rh_email' : fields.char('Subscription Contact', size=64, **WRITABLE_ONLY_IN_DRAFT),
         'address_id' : fields.many2one('res.partner.address', 'Invoice Address', select=1, required=True,help='The Subscription invoice address', **WRITABLE_ONLY_IN_DRAFT),
         'subscription_line_ids' : fields.one2many('training.subscription.line', 'subscription_id',
                                                   'Subscription Lines', select=1, **WRITABLE_ONLY_IN_DRAFT),
@@ -3207,7 +3207,7 @@
         'job_id' : fields.many2one('res.partner.job', 'Participant', select=1, required=True,
                                    domain="[('name', '=', parent.partner_id),('state', '=', 'current')]",
                                    help='Select the Participant', **WRITABLE_ONLY_IN_DRAFT),
-        'job_email' : fields.char('Participant Email', size=64, help='Participant Email Address'), #**WRITABLE_ONLY_IN_DRAFT),
+        'job_email' : fields.char('Participant Email', size=64, help='Participant Email Address', **WRITABLE_ONLY_IN_DRAFT),
         'contact_id' : fields.related('job_id', 'contact_id', type='many2one', relation='res.partner.contact', string='Contact', select=1, readonly=True,
                                         store = {
                                             'training.subscription.line': (_store_get_own, ['job_id'], 9),

=== modified file 'training/training_content_review_view.xml'
--- training/training_content_review_view.xml	2011-04-04 05:11:29 +0000
+++ training/training_content_review_view.xml	2011-04-26 11:27:59 +0000
@@ -298,7 +298,7 @@
                 </notebook>
                 <group col="7" colspan="4">
                     <field name="state"/>
-                    <button name="signal_draft" string="Draft" states="done,cancelled" icon="terp-document-new"/>
+                    <button name="signal_draft" string="Draft" states="done,cancelled" icon="gtk-indent"/>
                     <button name="signal_cancel" string="Cancel" states="draft,validated,inprogress" icon="gtk-cancel"/>
                     <button name="signal_validate" string="Validate" states="draft" icon="terp-camera_test"/>
                     <button name="signal_inprogress" string="In Progress" states="validated" icon="gtk-apply" />

=== modified file 'training/training_email_view.xml'
--- training/training_email_view.xml	2011-03-18 12:08:52 +0000
+++ training/training_email_view.xml	2011-04-26 11:27:59 +0000
@@ -44,9 +44,9 @@
                     </notebook>
                     <group col="5" colspan="4">
                         <field name="state" />
-                        <button name="draft_cb" string="_Draft" type="object" icon="terp-document-new" states="deprecated" />
+                        <button name="draft_cb" string="_Draft" type="object" icon="gtk-indent" states="deprecated" />
                         <button name="validate_cb" string="_Validate" type="object" icon="terp-camera_test" states="draft" />
-                        <button name="deprecate_cb" string="Deprecate" type="object" icon="gtk-cancel" states="validated,draft" />
+                        <button name="deprecate_cb" string="Deprecate" type="object" icon="gtk-close" states="validated,draft" />
                     </group>
                 </form>
             </field>

=== modified file 'training/training_view.xml'
--- training/training_view.xml	2011-04-25 06:33:33 +0000
+++ training/training_view.xml	2011-04-26 11:27:59 +0000
@@ -319,7 +319,7 @@
                             confirm="Do you want to deprecate this course ?" />
                         <button string="Validate" icon="terp-camera_test" type="workflow" name="signal_validate" attrs="{'invisible' : [('state_course', '!=', 'pending'),('state_course', '!=', 'draft')]}"
                             confirm="Do you want to validate this course ?" />
-                        <button string="Reset to Draft" icon="terp-document-new" type="object" name="reset_to_draft" attrs="{'invisible' : [('state_course', '!=', 'deprecated')]}" />
+                        <button string="Reset to Draft" icon="gtk-convert" type="object" name="reset_to_draft" attrs="{'invisible' : [('state_course', '!=', 'deprecated')]}" />
                     </group>
 
                 </form>
@@ -1346,7 +1346,7 @@
                                     </group>
                                     <group states="confirmed,done" groups="training.group_training">
                                         <button name="action_create_invoice" string="Create Invoice" type="object"
-                                            attrs="{'invisible': [('invoice_line_id', '!=', False)]}" icon='gtk-new'/>
+                                            attrs="{'invisible': [('invoice_line_id', '!=', False)],'readonly': [('state', 'in', ['done','cancelled'])]}" icon='gtk-new'/>
                                     </group>
                                 </group>
                             </group>
@@ -1728,7 +1728,7 @@
                             confirm="Do you want to deprecate this offer ?" icon="terp-dialog-close"/>
                         <button name="draft_cb" string="Draft" type="object" states="validated,deprecated"
                             confirm="Are you sure to reset to Draft (Check the sessions for this offer) ?"
-                            groups="training.group_offer_manager" icon="terp-document-new"/>
+                            groups="training.group_offer_manager" icon="gtk-indent"/>
                     </group>
                 </form>
             </field>
@@ -1822,7 +1822,7 @@
     </data>
 
     <data>
-        <menuitem id="training_mi" name="Training Management" sequence="2" />
+        <menuitem id="training_mi" name="Training" sequence="2" />
 
         <menuitem parent="training_mi" id="training_email_menu" name="Emails" sequence='65'/>
 
@@ -2007,7 +2007,7 @@
                         <field name="price" />
                         <field name="purchase_order_id" groups="training.group_training" />
                         <button type="object" name="action_create_purchase_order" string="Create Purchase Order"
-                            attrs="{'invisible' : [('purchase_order_id', '!=', False)]}" icon="gtk-new"
+                            attrs="{'invisible' : [('purchase_order_id', '!=', False)],'readonly' : [('state', '=', 'cancelled')]}" icon="gtk-new"
                             groups="training.group_training"/>
                         <field name="amount_to_pay" groups="training.group_training" />
                         <field name="purchase_paid" groups="training.group_training" select="2"/>

=== modified file 'training_evaluation/training_evaluation_view.xml'
--- training_evaluation/training_evaluation_view.xml	2011-04-01 10:41:15 +0000
+++ training_evaluation/training_evaluation_view.xml	2011-04-26 11:27:59 +0000
@@ -356,9 +356,9 @@
                         <field name="state" />
                         <button name="tr_e_signal_validate" string="Validate" icon="terp-camera_test" type="workflow"
                             states="draft" />
-                        <button name="tr_e_signal_deprecate" string="Deprecate" icon="gtk-cancel" type="workflow"
+                        <button name="tr_e_signal_deprecate" string="Deprecate" icon="gtk-close" type="workflow"
                             states="draft,validated"/>
-                        <button name="action_signal_draft" string="Reset to Draft" icon="terp-document-new" type="object" states="deprecated" />
+                        <button name="action_signal_draft" string="Reset to Draft" icon="gtk-convert" type="object" states="deprecated" />
                     </group>
                 </form>
             </field>

=== modified file 'training_exam/training_exam.py'
--- training_exam/training_exam.py	2011-04-21 08:32:48 +0000
+++ training_exam/training_exam.py	2011-04-26 11:27:59 +0000
@@ -34,6 +34,8 @@
 
 FMT = '%Y-%m-%d %H:%M:%S'
 
+WRITABLE_ONLY_IN_DRAFT = dict(readonly=True, states={'draft': [('readonly', False)]})
+
 class training_course_type(osv.osv):
     _inherit = 'training.course_type'
 
@@ -926,7 +928,7 @@
 class training_subscription_line(osv.osv):
     _inherit = 'training.subscription.line'
     _columns = {
-        'exam_session_id' : fields.many2one('training.session', 'Exam Session', domain=[('kind', '=', 'exam')]),
+        'exam_session_id' : fields.many2one('training.session', 'Exam Session', domain=[('kind', '=', 'exam')], **WRITABLE_ONLY_IN_DRAFT),
         'course_id' : fields.many2one('training.course', 'Exam',
                                       domain=[('state_course', 'in', ['validated', 'pending'])], ondelete='restrict'),
         'parent_id' : fields.many2one('training.subscription.line', 'Parent', ondelete='set null'),
@@ -1099,6 +1101,11 @@
         # Get journal
         journal_pool = self.pool.get('account.journal')
         journal_sales_srch = journal_pool.search(cr, uid, [('type','=','sale'),('refund_journal','=',False)])
+
+        if not journal_sales_srch:
+            raise osv.except_osv(_('Warning'),
+                                 _('You must be define a journal with type  sale'))
+
         journal_sales = journal_pool.browse(cr, uid, journal_sales_srch, context=context)[0]
 
         proxy_seance = self.pool.get('training.seance')

=== modified file 'training_exam/training_exam_view.xml'
--- training_exam/training_exam_view.xml	2011-04-14 09:07:28 +0000
+++ training_exam/training_exam_view.xml	2011-04-26 11:27:59 +0000
@@ -306,7 +306,7 @@
                     </notebook>
                     <group colspan="4" col="8">
                         <field name="state" />
-                        <button name="signal_teq_deprecate" icon="gtk-cancel" string="Deprecate" type="workflow" states="inprogress,validated" confirm="Do you want to deprecate this questionnaire ?" />
+                        <button name="signal_teq_deprecate" icon="gtk-close" string="Deprecate" type="workflow" states="inprogress,validated" confirm="Do you want to deprecate this questionnaire ?" />
                         <button name="signal_teq_validate" icon="terp-camera_test" string="Validate" type="workflow" states="inprogress,draft" confirm="Do you want to validate this questionnaire ?" />
                         <button name="%(training_exam.exam_questionnaire_new_version_action)d" icon="terp-document-new" string="Create a New Version" type="action" states="validated,deprecated"/>
                     </group>

=== modified file 'training_exam_processing/training_exam_processing.py'
--- training_exam_processing/training_exam_processing.py	2011-04-11 08:57:50 +0000
+++ training_exam_processing/training_exam_processing.py	2011-04-26 11:27:59 +0000
@@ -236,6 +236,11 @@
         return self.write(cr, uid, ids, {'state' : 'done'}, context=context)
 
     def test_wkf_validate(self, cr, uid, ids, context=None):
+        for request in self.browse(cr, uid, ids, context=context):
+            if not len(request.correction_ids) > 0:
+                raise osv.except_osv(_('Error'),
+                                     _('In this request there is not any correction specify'))
+
         return all(bool(request.po_id) != False and len(request.correction_ids) > 0 for request in self.browse(cr, uid, ids, context=context))
 
     def action_wkf_validate(self, cr, uid, ids, context=None):
@@ -293,6 +298,10 @@
         return True
 
     def action_create_invoice(self, cr, uid, ids, context=None):
+        for inv in self.browse(cr, uid, ids, context=context):
+            if len(inv.invoice_ids) > 0:
+                raise osv.except_osv(_('Error'),
+                                     _('Invoice already created'))
         return self.pool.get('purchase.order').action_invoice_create(cr, uid,
                                                                      [obj.po_id.id for obj in self.browse(cr, uid, ids, context=context) if obj.po_id]
                                                                      )

=== modified file 'training_intra/training_intra_view.xml'
--- training_intra/training_intra_view.xml	2011-04-01 10:41:15 +0000
+++ training_intra/training_intra_view.xml	2011-04-26 11:27:59 +0000
@@ -207,7 +207,7 @@
                         <attribute name="states">deprecated,refused,done</attribute>
                     </button>
                     <button name="draft_cb" position="before">
-                        <button name="signal_draft" icon="terp-document-new" string="Draft" states="validated" type="workflow" confirm="Are you sure to reset to Draft (Check the sessions for this offer) ?"/>
+                        <button name="signal_draft" icon="gtk-indent" string="Draft" states="validated" type="workflow" confirm="Are you sure to reset to Draft (Check the sessions for this offer) ?"/>
                         <group col="2" colspan="2" attrs="{'invisible': [('kind','!=','intra')]}">
                             <button name="signal_refused" string="Refused" icon='gtk-refresh' states="draft" type="workflow" confirm="Are you sure you want to mark this offer as refused ?"/>
                             <button name="signal_done" string="Done" states="validated" icon='gtk-jump-to' type="workflow" confirm="Are you sure you want to mark this offer as done ?"/>


Follow ups