Amit Parik (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-999756-amp into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #999756 in OpenERP Addons: "Invoice stuck as pro-forma forever"
  https://bugs.launchpad.net/openobject-addons/+bug/999756

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-999756-amp/+merge/105936

Hello,

As per my opinion we should be check the invoice line on proforma 
button(state). If there is no invoice line we should not allow to proforma it.

For proper use case see my comment on bug#999756.

Thank you!
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-999756-amp/+merge/105936
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-999756-amp.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py	2012-05-08 08:45:49 +0000
+++ account/account_invoice.py	2012-05-16 07:18:24 +0000
@@ -778,6 +778,14 @@
             for key, val in line2.items():
                 line.append((0,0,val))
         return line
+    
+    def proforma_check_invoice_line(self, cr, uid, ids, context=None):
+        for inv in self.browse(cr, uid, ids, context=context):
+            if not inv.invoice_line:
+                raise osv.except_osv(_('No Invoice Lines !'), _('Please create some invoice lines.'))
+            else:
+                return True
+        return True
 
     def action_move_create(self, cr, uid, ids, context=None):
         """Creates invoice related analytics and financial move lines"""

=== modified file 'account/account_invoice_workflow.xml'
--- account/account_invoice_workflow.xml	2012-03-19 10:38:23 +0000
+++ account/account_invoice_workflow.xml	2012-05-16 07:18:24 +0000
@@ -17,7 +17,8 @@
         <record id="act_proforma2" model="workflow.activity">
             <field name="wkf_id" ref="wkf"/>
             <field name="name">proforma2</field>
-            <field name="action">write({'state':'proforma2'})</field>
+            <field name="action">write({'state':'proforma2'})
+proforma_check_invoice_line()</field>
             <field name="kind">function</field>
         </record>
 

_______________________________________________
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