Put the fiscal reports as an extra state in account.invoice.
authorP. Christeas <p_christ@hol.gr>
Thu, 28 Oct 2010 12:24:07 +0000 (15:24 +0300)
committerP. Christeas <p_christ@hol.gr>
Thu, 28 Oct 2010 12:24:07 +0000 (15:24 +0300)
bzr revid: p_christ@hol.gr-20101028122407-4tgvkr2eubbdn52p

addons/account_greek_fiscal/__init__.py
addons/account_greek_fiscal/__terp__.py
addons/account_greek_fiscal/account_fiscalgr_view.xml
addons/account_greek_fiscal/account_invoice_print.py

index 0975d02..b140bac 100644 (file)
@@ -22,6 +22,7 @@
 
 import fiscal_prints
 import account_invoice_print
+import wizard
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
index b699b56..2330fb7 100644 (file)
@@ -34,7 +34,7 @@
     ],
     "demo_xml" : [
     ],
-    "update_xml" : [ "account_fiscalgr_view.xml",
+    "update_xml" : [ "account_fiscalgr_view.xml", "account_invoice_report.xml"
     ],
     "active": False,
     "installable": True
index 23679d4..c2894ff 100644 (file)
        <menuitem name="Fiscal prints" id="menu_account_fiscalgr" parent="account.menu_finance_reporting"/>
        <menuitem name="All Prints" id="menu_account_fiscalgr_print_tree_form" action="view_account_fiscalgr_print_tree_form" parent="menu_account_fiscalgr"/>
 
+       
+       <record model="ir.ui.view" id="view_invoice_fiscalgr_inherit_1">
+               <field name="name">account.invoice.fiscalgr.view.inherit_1</field>
+               <field name="model">account.invoice</field>
+               <field name="inherit_id" ref="account.invoice_form"/>
+               <field name="type">form</field>
+               <field name="arch" type="xml">
+                       <xpath expr="/form/notebook/page/group/group/button[@name='invoice_cancel']" position="before">
+                               <button name="action_fiscalgr_print" states="open" string="Print" type="object"/>
+                       </xpath>
+               </field>
+       </record>
+
        </data>
 </openerp>
index bf2754e..e41ca0b 100644 (file)
@@ -27,6 +27,15 @@ class account_invoice(osv.osv):
     _columns = {
         # states={'open':[('readonly',False)]}
         'fiscalgr_print': fields.many2one('account.fiscalgr.print','Fiscal print', readonly=True, ),
+       'state': fields.selection([
+            ('draft','Draft'),
+            ('proforma','Pro-forma'),
+            ('proforma2','Pro-forma'),
+            ('open','Open'),
+            ('paid','Done'),
+            ('cancel','Canceled'),
+           ('printed','Printed'),
+        ],'State', select=True, readonly=True),
         }
     def copy(self, cr, uid, id, default=None, context=None):
         if default is None:
@@ -42,6 +51,9 @@ class account_invoice(osv.osv):
             if i['fiscalgr_print']:
                raise osv.except_osv(_('Invalid action !'), _('Cannot cancel invoice(s) which are already printed !'))
         return super(account_invoice,self).action_cancel(cr,uid,ids,args)
+       
+    def action_fiscalgr_print(self, cr, uid, ids, *args):
+           raise osv.except_osv(_('Invalid action !'), _('Cannot print such an invoice !'))
 
 account_invoice()
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: