[IMP]: Improve code

bzr revid: ksa@tinyerp.co.in-20110408125758-6soa3t29oels77ym
This commit is contained in:
ksa (Open ERP) 2011-04-08 18:27:58 +05:30
parent 2289e6db4f
commit 0fa464b1b7
18 changed files with 22 additions and 20 deletions

View File

@ -18,7 +18,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
import account_analytic_plans import account_analytic_plans
import wizard import wizard
import report import report

View File

@ -70,7 +70,7 @@ of distribution models.
'account_analytic_plans_report.xml', 'account_analytic_plans_report.xml',
'wizard/analytic_plan_create_model_view.xml', 'wizard/analytic_plan_create_model_view.xml',
'wizard/account_crossovered_analytic_view.xml', 'wizard/account_crossovered_analytic_view.xml',
'installer_view.xml' 'account_analytic_plans_installer_view.xml'
], ],
'demo_xml' : [], 'demo_xml' : [],
'test' : ['test/acount_analytic_plans_report.yml'], 'test' : ['test/acount_analytic_plans_report.yml'],

View File

@ -12,7 +12,7 @@
</record> </record>
<record id="account_analytic_plan_installer_todo" model="ir.actions.todo"> <record id="account_analytic_plan_installer_todo" model="ir.actions.todo">
<field name="action_id" ref="account_analytic_plan_form_action_installer"/> <field name="action_id" ref="account_analytic_plan_form_action_installer"/>
<field name="sequence">3</field> <field name="sequence">15</field>
<field name="restart">always</field> <field name="restart">always</field>
</record> </record>

View File

@ -76,7 +76,7 @@
<record id="crm_case_section_installer_todo" model="ir.actions.todo"> <record id="crm_case_section_installer_todo" model="ir.actions.todo">
<field name="action_id" ref="crm_case_section_view_form_installer"/> <field name="action_id" ref="crm_case_section_view_form_installer"/>
<field name="sequence">3</field> <field name="sequence">10</field>
<field name="restart">always</field> <field name="restart">always</field>
</record> </record>
@ -91,7 +91,7 @@
<record id="crm_case_stage_installer_todo" model="ir.actions.todo"> <record id="crm_case_stage_installer_todo" model="ir.actions.todo">
<field name="action_id" ref="crm_case_stage_form_installer"/> <field name="action_id" ref="crm_case_stage_form_installer"/>
<field name="sequence">3</field> <field name="sequence">10</field>
<field name="restart">always</field> <field name="restart">always</field>
</record> </record>

View File

@ -42,7 +42,7 @@ Fetch email from POP / IMAP servers.
"fetchmail_view.xml", "fetchmail_view.xml",
"fetchmail_data.xml", "fetchmail_data.xml",
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'installer_view.xml' 'fetchmail_installer_view.xml'
], ],
'demo_xml': [ 'demo_xml': [

View File

@ -48,7 +48,7 @@ in the form of pdf file. Implements a dashboard for My Current Evaluations
"hr_evaluation_view.xml", "hr_evaluation_view.xml",
"report/hr_evaluation_report_view.xml", "report/hr_evaluation_report_view.xml",
"board_hr_evaluation_view.xml", "board_hr_evaluation_view.xml",
'installer_view.xml' 'hr_evaluation_installer_view.xml'
], ],
"test": ["test/test_hr_evaluation.yml"], "test": ["test/test_hr_evaluation.yml"],
"active": False, "active": False,

View File

@ -55,7 +55,7 @@ re-invoice your customer's expenses if your work by project.
'report/hr_expense_report_view.xml', 'report/hr_expense_report_view.xml',
'board_hr_expense_view.xml', 'board_hr_expense_view.xml',
'board_hr_expense_manager_view.xml', 'board_hr_expense_manager_view.xml',
'installer_view.xml', 'hr_expense_installer_view.xml',
'hr_expense_data.xml' 'hr_expense_data.xml'
], ],
'demo_xml': [ 'demo_xml': [

View File

@ -230,9 +230,13 @@ class product_product(osv.osv):
} }
def on_change_hr_expense_ok(self, cr, uid, id, hr_expense_ok): def on_change_hr_expense_ok(self, cr, uid, id, hr_expense_ok):
if not hr_expense_ok: if not hr_expense_ok:
return {} return {}
res = {'value' : {'type':'service','procure_method':'make_to_stock','supply_method':'buy','purchase_ok':True,'sale_ok' :False,'categ_id':19 }} data_obj = self.pool.get('ir.model.data')
cat_id = data_obj._get_id(cr, uid, 'hr_expense', 'cat_expense')
categ_id = data_obj.browse(cr, uid, cat_id).res_id
res = {'value' : {'type':'service','procure_method':'make_to_stock','supply_method':'buy','purchase_ok':True,'sale_ok' :False,'categ_id':categ_id }}
return res return res
product_product() product_product()

View File

@ -47,7 +47,7 @@ system to store and search in your CV base.
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'report/hr_recruitment_report_view.xml', 'report/hr_recruitment_report_view.xml',
'board_hr_recruitment_statistical_view.xml', 'board_hr_recruitment_statistical_view.xml',
'installer_view.xml' 'hr_recruitment_installer_view.xml'
], ],
'init_xml': [ 'init_xml': [
'hr_recruitment_data.xml' 'hr_recruitment_data.xml'

View File

@ -47,7 +47,7 @@ reports, etc.""",
'wizard/hr_timesheet_invoice_create_view.xml', 'wizard/hr_timesheet_invoice_create_view.xml',
'wizard/hr_timesheet_invoice_create_final_view.xml', 'wizard/hr_timesheet_invoice_create_final_view.xml',
'board_hr_timesheet_invoice.xml', 'board_hr_timesheet_invoice.xml',
'installer_view.xml' 'hr_timesheet_invoice_installer_view.xml'
], ],
'demo': [ 'demo': [
'hr_timesheet_invoice_demo.xml', 'hr_timesheet_invoice_demo.xml',

View File

@ -22,7 +22,7 @@
<separator string="" colspan="4" /> <separator string="" colspan="4" />
<label string="" colspan="2" /> <label string="" colspan="2" />
<button special="cancel" string="Cancel" icon="gtk-cancel" /> <button special="cancel" string="Cancel" icon="gtk-cancel" />
<button name="employee_data" string="OK" type="object" icon="gtk-ok"/> <button name="set_employee_data" string="OK" type="object" icon="gtk-ok"/>
</form> </form>
</field> </field>
</record> </record>
@ -40,7 +40,7 @@
<record id="hr_timesheet_invoice_todo" model="ir.actions.todo"> <record id="hr_timesheet_invoice_todo" model="ir.actions.todo">
<field name="action_id" ref="action_hr_timesheet_invoice_wizard"/> <field name="action_id" ref="action_hr_timesheet_invoice_wizard"/>
<field name="sequence">3</field> <field name="sequence">3</field>
<field name="restart">always</field> <field name="restart">never</field>
</record> </record>
</data> </data>

View File

@ -56,24 +56,23 @@ class hr_timesheet_invoice_wizard(osv.osv_memory):
context = {} context = {}
res = super(hr_timesheet_invoice_wizard, self).default_get(cr, uid, fields, context=context) res = super(hr_timesheet_invoice_wizard, self).default_get(cr, uid, fields, context=context)
emp_obj = self.pool.get('hr.employee') emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, ['|',('user_id', '=', uid),('product_id','=',False),('journal_id','=','')], context=context) emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
result = [] result = []
data = {} data = {}
for emp in emp_obj.browse(cr, uid, emp_id, context=context): for emp in emp_obj.browse(cr, uid, emp_id, context=context):
data = {'employee_id':emp.id,'product_id':emp.product_id.id,'journal_id':emp.journal_id.id} data = {'employee_id':emp.id, 'product_id':emp.product_id.id, 'journal_id':emp.journal_id.id}
result.append(data) result.append(data)
if 'emp_ids' in fields: if 'emp_ids' in fields:
res.update({'emp_ids': result}) res.update({'emp_ids': result})
return res return res
def employee_data(self, cr, uid, ids, context=None): def set_employee_data(self, cr, uid, ids, context=None):
if context is None: if context is None:
context = {} context = {}
hr_obj = self.pool.get('hr.employee') hr_obj = self.pool.get('hr.employee')
for emp in self.browse(cr, uid, ids, context=context): for emp in self.browse(cr, uid, ids, context=context):
for emp_data in emp.emp_ids: for emp_data in emp.emp_ids:
emp_id = hr_obj.search(cr, uid, [('id', '=', emp_data.employee_id.id)], context=context) hr_obj.write(cr, uid, emp_data.employee_id.id, {'name': emp_data.employee_id.name, 'product_id':emp_data.product_id.id or False, 'journal_id':emp_data.journal_id.id or ''})
hr_obj.write(cr, uid, emp_id, {'name': emp_data.employee_id.name,'product_id':emp_data.product_id.id or False, 'journal_id':emp_data.journal_id.id or ''})
return {'type': 'ir.actions.act_window_close'} return {'type': 'ir.actions.act_window_close'}
hr_timesheet_invoice_wizard() hr_timesheet_invoice_wizard()

View File

@ -49,7 +49,7 @@
'lunch_view.xml', 'lunch_view.xml',
'lunch_report.xml', 'lunch_report.xml',
'report/report_lunch_order_view.xml', 'report/report_lunch_order_view.xml',
'installer_view.xml' 'lunch_installer_view.xml'
], ],
"demo_xml": ['lunch_demo.xml'], "demo_xml": ['lunch_demo.xml'],
"test": ['test/test_lunch.yml', 'test/lunch_report.yml'], "test": ['test/test_lunch.yml', 'test/lunch_report.yml'],

View File

@ -12,7 +12,7 @@
<record id="view_lunch_product_form_todo" model="ir.actions.todo"> <record id="view_lunch_product_form_todo" model="ir.actions.todo">
<field name="action_id" ref="view_lunch_product_form_installer"/> <field name="action_id" ref="view_lunch_product_form_installer"/>
<field name="sequence">3</field> <field name="sequence">50</field>
<field name="restart">always</field> <field name="restart">always</field>
</record> </record>
</data> </data>