← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-751269-pso into lp:openobject-addons

 

Priyesh (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-751269-pso into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #751269 in OpenERP Addons: "[hr_timesheet_invoice] :  Error when trying to reinvoice"
  https://bugs.launchpad.net/openobject-addons/+bug/751269

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-751269-pso/+merge/57288

Fixed bug: 751269 (https://bugs.launchpad.net/openobject-addons/+bug/751269)
Fixed problem of recreating invoice if invoice already exists.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-751269-pso/+merge/57288
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-751269-pso.
=== modified file 'hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py'
--- hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py	2011-03-15 14:59:31 +0000
+++ hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py	2011-04-12 09:25:58 +0000
@@ -47,6 +47,21 @@
          'name': lambda *args: 1
     }
 
+    def view_init(self, cr, uid, fields, context=None):
+        """
+        This function checks for precondition before wizard executes
+        @param self: The object pointer
+        @param cr: the current row, from the database cursor,
+        @param uid: the current user’s ID for security checks,
+        @param fields: List of fields for default value
+        @param context: A standard dictionary for contextual values
+        """
+        analytic_obj = self.pool.get('account.analytic.line')
+        data = context and context.get('active_ids', [])
+        for analytic in analytic_obj.browse(cr, uid, data, context=context):
+            if analytic.invoice_id:
+                     raise osv.except_osv(_('Warning !'), _("Invoice is already linked to some of the analytic line(s)!"))
+
     def do_create(self, cr, uid, ids, context=None):
         mod_obj = self.pool.get('ir.model.data')
         analytic_account_obj = self.pool.get('account.analytic.account')


Follow ups