[ADD]: config wizard for hr_timesheet_invoice

bzr revid: ksa@tinyerp.co.in-20110407060032-9mi1ci7f2pqgzs6o
This commit is contained in:
ksa (Open ERP) 2011-04-07 11:30:32 +05:30
parent 2004662aae
commit 9a5ac3b0fe
4 changed files with 99 additions and 3 deletions

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,12 +15,12 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# 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 hr_timesheet_invoice
import wizard
import report
import installer
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

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

View File

@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
class hr_timesheet_invoice_installer(osv.osv):
_name = "hr.timesheet.invoice.installer"
_description = "Employee Invoice Data"
_columns = {
'employee_id': fields.many2one('hr.employee', 'Employee', domain="['|',('product_id','=',False),('journal_id','=',False)]" ,required=True),
'type': fields.many2one('product.product', 'Product',domain="[('type','=','service')]"),
'timesheet_journal': fields.many2one('account.analytic.journal', 'Analytic Journal',domain="[('type','=','general')]"),
}
def _get_user(self, cr, uid, context=None):
emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, ['|',('user_id', '=', uid),('product_id','=',False),('journal_id','=',False)], context=context)
if not emp_id:
raise osv.except_osv(_("Warning"), _("No employee defined for this user"))
return emp_id and emp_id[0] or False
_defaults = {
'employee_id': _get_user
}
hr_timesheet_invoice_installer()
class hr_timesheet_invoice_wizard(osv.osv):
_name = "hr.timesheet.invoice.wizard"
_description = "Timesheet Invoice"
_columns = {
'emp_ids':fields.one2many('hr.timesheet.invoice.installer', 'timesheet_journal', 'Employee details'),
}
hr_timesheet_invoice_wizard()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_timesheet_invoice_wizard" model="ir.ui.view">
<field name="name">Employee Invoice Data</field>
<field name="model">hr.timesheet.invoice.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Employee Invoice Data">
<field colspan="4" name="emp_ids" nolabel="1" mode="tree,form">
<tree string="Employee Invoice Data" editable="top">
<field name="employee_id"/>
<field name="type"/>
<field name="timesheet_journal"/>
</tree>
</field>
</form>
</field>
</record>
<record id="action_hr_timesheet_invoice_wizard" model="ir.actions.act_window">
<field name="name">Employee Invoice Data</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.timesheet.invoice.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_hr_timesheet_invoice_wizard"/>
<field name="target">new</field>
</record>
<record id="hr_timesheet_invoice_todo" model="ir.actions.todo">
<field name="action_id" ref="action_hr_timesheet_invoice_wizard"/>
<field name="sequence">3</field>
<field name="restart">always</field>
</record>
</data>
</openerp>