Amit Parmar (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-config-clean-setup_project_time_unit_wizard-aar
into lp:~openerp-dev/openobject-addons/trunk-config-clean.
Requested reviews:
Amit (Open ERP) (apa-tiny)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-config-clean-setup_project_time_unit_wizard-aar/+merge/79247
Hello Sir,
I have created Project Time Unit Setup Wizard which :
Set the right value for company's: Project Time Unit
Set the right UoM and Purchase UoM on the "Employee Product"
Thanks,
Amit Parmar
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-config-clean-setup_project_time_unit_wizard-aar/+merge/79247
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-config-clean.
=== modified file 'project/__openerp__.py'
--- project/__openerp__.py 2011-09-07 22:48:29 +0000
+++ project/__openerp__.py 2011-10-13 10:23:46 +0000
@@ -47,6 +47,7 @@
"security/project_security.xml",
"wizard/project_task_delegate_view.xml",
"wizard/project_task_reevaluate_view.xml",
+ "wizard/setup_project_time_unit_view.xml",
"security/ir.model.access.csv",
"project_data.xml",
"project_view.xml",
=== modified file 'project/project_installer.xml'
--- project/project_installer.xml 2011-10-11 14:03:35 +0000
+++ project/project_installer.xml 2011-10-13 10:23:46 +0000
@@ -24,16 +24,16 @@
<record id="action_configure_default_time_unit" model="ir.actions.act_window">
<field name="name">Setup your Project's Time Unit</field>
<field name="type">ir.actions.act_window</field>
- <field name="res_model">res.company</field>
- <field name="view_id" ref="base.view_company_form" />
+ <field name="res_model">project.timeunit</field>
+ <field name="view_id" ref="view_project_time_unit_setup" />
<field name="view_type">form</field>
<field name="view_mode">form</field>
- <field name="context">{'res_id' : user.company_id.id}</field>
+ <field name="target">new</field>
</record>
<record id="config_wizard_action_configure_default_time_unit" model="ir.actions.todo">
<field name="action_id" ref="action_configure_default_time_unit" />
<field name="category_id" ref="category_project_config" />
- <field name="type">once</field>
+ <field name="type">automatic</field>
</record>
<record id="action_review_task_stage" model="ir.actions.act_window">
=== modified file 'project/wizard/__init__.py'
--- project/wizard/__init__.py 2011-09-09 13:10:45 +0000
+++ project/wizard/__init__.py 2011-10-13 10:23:46 +0000
@@ -22,6 +22,6 @@
import mail_compose_message
import project_task_delegate
import project_task_reevaluate
-
+import setup_project_time_unit
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'project/wizard/setup_project_time_unit.py'
--- project/wizard/setup_project_time_unit.py 1970-01-01 00:00:00 +0000
+++ project/wizard/setup_project_time_unit.py 2011-10-13 10:23:46 +0000
@@ -0,0 +1,23 @@
+from osv import fields, osv
+
+class project_timeunit(osv.osv_memory):
+ """ Setting Default Time Unit For Company, and UOM and Purchase UOM for Employee Product """
+
+ _name = 'project.timeunit'
+ _description = 'Project Time Unit Setup'
+
+ _columns = {
+ 'time_unit': fields.many2one('product.uom', 'Project Time Unit'),
+ }
+
+ def setup_timeunit(self, cr, uid, ids, context=None):
+ product = self.pool.get('product.product')
+ company = self.pool.get('res.company')
+ company_id = company._company_default_get(cr, uid, 'project_timeunit')
+ product_id = product.name_search(cr, uid, 'Employee', context=context)
+ for wizard in self.browse(cr, uid, ids, context=context):
+ if product_id:
+ product.write(cr, uid, product_id[0][0], {'uom_po_id': wizard.time_unit.id, 'uom_id': wizard.time_unit.id})
+ if company_id:
+ company.write(cr, uid, company_id, {'project_time_mode_id': wizard.time_unit.id})
+ return {'type': 'ir.actions.act_window_close'}
\ No newline at end of file
=== added file 'project/wizard/setup_project_time_unit_view.xml'
--- project/wizard/setup_project_time_unit_view.xml 1970-01-01 00:00:00 +0000
+++ project/wizard/setup_project_time_unit_view.xml 2011-10-13 10:23:46 +0000
@@ -0,0 +1,25 @@
+<openerp>
+ <data>
+
+ <record id="view_project_time_unit_setup" model="ir.ui.view">
+ <field name="name">Setup Project Time Unit</field>
+ <field name="model">project.timeunit</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Setup_Project_Time_Unit">
+ <group col="2" colspan="2">
+ <separator colspan="2" string="Select Time Unit For Company and Purchase UOM"/>
+ <group col="1" colspan="1">
+ <field name="time_unit" widget="selection" domain="[('category_id','=',3)]" width="20"/>
+ </group>
+ <separator string="" colspan="2"/>
+ <group col="2" colspan="2">
+ <button icon="gtk-cancel" special="cancel" string="_Cancel"/>
+ <button icon="gtk-ok" name="setup_timeunit" string="Ok" type="object" default_focus="1"/>
+ </group>
+ </group>
+ </form>
+ </field>
+ </record>
+ </data>
+</openerp>
_______________________________________________
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