Sanjay Gohel (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-contract-apa-task-sgo into 
lp:~openerp-dev/openobject-addons/trunk-contract-apa.

Requested reviews:
  Amit Patel (OpenERP) (apa-tiny)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-contract-apa-task-sgo/+merge/102794

hello sir, 
   I have done on create of analytic it creates project if boolean task is true.


Thank you
SGO
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-contract-apa-task-sgo/+merge/102794
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-contract-apa.
=== modified file 'project_timesheet/project_timesheet.py'
--- project_timesheet/project_timesheet.py	2012-01-31 13:36:57 +0000
+++ project_timesheet/project_timesheet.py	2012-04-20 06:30:25 +0000
@@ -39,7 +39,7 @@
                 factor_id = data_obj.browse(cr, uid, data_id).res_id
                 res['value'].update({'to_invoice': factor_id})
         return res
-
+    
 project_project()
 
 class project_work(osv.osv):
@@ -247,4 +247,25 @@
            raise osv.except_osv(_('Invalid Analytic Account !'), _('You cannot select a Analytic Account which is in Close or Cancelled state'))
        return res  
 account_analytic_line()
+
+class account_analytic_account(osv.osv):
+    _inherit = "account.analytic.account"
+    
+    _columns = {
+         'task': fields.boolean('Task'),
+         }
+    
+    def create(self, cr, uid, vals, context=None):
+        if context is None:
+             context = {}
+        res = {}
+        obj_id = super(account_analytic_account, self).create(cr, uid, vals, context=context)
+        if vals.get('task', False) == True:
+            project_pool = self.pool.get('project.project')
+            res['name'] = vals.get('name')
+            res['analytic_account_id'] = obj_id
+            project_pool.create(cr, uid, res, context=context)
+        return obj_id
+
+account_analytic_account()
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'project_timesheet/project_timesheet_view.xml'
--- project_timesheet/project_timesheet_view.xml	2012-04-03 08:27:56 +0000
+++ project_timesheet/project_timesheet_view.xml	2012-04-20 06:30:25 +0000
@@ -76,6 +76,18 @@
                 </field>
             </field>
         </record>
+        
+        <record id="view_account_analytic_inherited" model="ir.ui.view">
+            <field name="name">account.analytic.account.timesheet</field>
+            <field name="model">account.analytic.account</field>
+            <field name="type">form</field>
+            <field name="inherit_id" ref="account.view_account_analytic_account_form"/>
+            <field name="arch" type="xml">
+                <group name="contract"  position="inside">
+                    <field name="task"/>
+                </group>
+            </field>
+        </record>
 
         <!-- Menus -->
         <record id="action_project_timesheet_bill_task" model="ir.actions.act_window">

_______________________________________________
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