[MERGE]: merging from development branch 3
bzr revid: mga@tinyerp.com-20100420203725-7wug7xw343qip15e
This commit is contained in:
@@ -68,6 +68,8 @@ module named account_voucherss
|
||||
'wizard/account_validate_move_view.xml',
|
||||
'wizard/account_statement_from_invoice_view.xml',
|
||||
'wizard/account_pay_invoice_view.xml',
|
||||
'wizard/account_unreconcile_view.xml',
|
||||
'wizard/account_invoice_state_view.xml',
|
||||
'project/wizard/project_account_analytic_line_view.xml',
|
||||
'account_view.xml',
|
||||
'account_end_fy.xml',
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<!-- manual reconcile -->
|
||||
<wizard id="wizard_reconcile" model="account.move.line" name="account.move.line.reconcile" string="Reconcile Entries"/>
|
||||
|
||||
<wizard id="wizard_reconcile_unreconcile" model="account.move.reconcile" name="account.reconcile.unreconcile" string="Unreconcile Entries"/>
|
||||
<!-- <wizard id="wizard_reconcile_unreconcile" model="account.move.reconcile" name="account.reconcile.unreconcile" string="Unreconcile Entries"/>-->
|
||||
|
||||
|
||||
<!-- <wizard id="wizard_reconcile_select" menu="False" model="account.move.line" name="account.move.line.reconcile.select" string="Reconcile entries"/>
|
||||
@@ -57,7 +57,7 @@
|
||||
-->
|
||||
|
||||
<!-- unreconcile -->
|
||||
<wizard id="wizard_unreconcile" model="account.move.line" name="account.move.line.unreconcile" string="Unreconcile Entries"/>
|
||||
<!-- <wizard id="wizard_unreconcile" model="account.move.line" name="account.move.line.unreconcile" string="Unreconcile Entries"/>-->
|
||||
|
||||
<!-- unreconcile
|
||||
|
||||
@@ -85,9 +85,9 @@
|
||||
<wizard id="wizard_balance_report" keyword="client_print_multi" model="account.account" name="account.account.balance.report" string="Account Balance"/>
|
||||
<wizard id="wizard_general_ledger_report" keyword="client_print_multi" model="account.account" name="account.general.ledger.report" string="General Ledger"/>
|
||||
|
||||
<wizard id="wizard_invoice_state_confirm" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.confirm" string="Confirm draft invoices" groups="base.group_user"/>
|
||||
<wizard id="wizard_invoice_state_cancel" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.cancel" string="Cancel selected invoices" groups="base.group_user"/>
|
||||
|
||||
<!-- <wizard id="wizard_invoice_state_confirm" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.confirm" string="Confirm draft invoices" groups="base.group_user"/>-->
|
||||
<!-- <wizard id="wizard_invoice_state_cancel" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.cancel" string="Cancel selected invoices" groups="base.group_user"/>-->
|
||||
<!---->
|
||||
|
||||
<!-- account.move validate -->
|
||||
<!-- <wizard id="wizard_validate_account_moves" menu="False" model="account.move" name="account.move.validate" string="Validate Ledger Postings"/>
|
||||
|
||||
@@ -23,7 +23,7 @@ import wizard_automatic_reconcile
|
||||
import account_move_line_reconcile_select
|
||||
import account_move_line_unreconcile_select
|
||||
import wizard_reconcile
|
||||
import wizard_unreconcile
|
||||
import account_unreconcile
|
||||
import account_invoice_refund
|
||||
import account_pay_invoice
|
||||
import account_move_journal
|
||||
@@ -42,7 +42,7 @@ import account_vat
|
||||
import account_open_closed_fiscalyear
|
||||
|
||||
import wizard_compare_account_balance_report
|
||||
import wizard_invoice_state
|
||||
import account_invoice_state
|
||||
import wizard_account_duplicate
|
||||
import account_chart
|
||||
import wizard_move_line_select
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
# -*- 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 _
|
||||
import netsvc
|
||||
|
||||
class account_invoice_confirm(osv.osv_memory):
|
||||
"""
|
||||
This wizard will confirm the all the selected draft invoices
|
||||
"""
|
||||
|
||||
_name = "account.invoice.confirm"
|
||||
_description = "Confirm the selected invoices"
|
||||
|
||||
def invoice_confirm(self, cr, uid, ids, context=None):
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
if context is None:
|
||||
context = {}
|
||||
for id in context['active_ids']:
|
||||
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr)
|
||||
return {}
|
||||
|
||||
account_invoice_confirm()
|
||||
|
||||
class account_invoice_cancel(osv.osv_memory):
|
||||
"""
|
||||
This wizard will cancel the all the selected invoices.
|
||||
If in the journal, the option allow cancelling entry is not selected then it will give warning message.
|
||||
"""
|
||||
|
||||
_name = "account.invoice.cancel"
|
||||
_description = "Cancel the selected invoices"
|
||||
|
||||
def invoice_cancel(self, cr, uid, ids, context=None):
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
if context is None:
|
||||
context = {}
|
||||
for id in context['active_ids']:
|
||||
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr)
|
||||
return {}
|
||||
|
||||
account_invoice_cancel()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,73 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_invoice_confirm_view" model="ir.ui.view">
|
||||
<field name="name">account.invoice.confirm.form</field>
|
||||
<field name="model">account.invoice.confirm</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Confirm draft invoices">
|
||||
<separator string="Confirm draft invoices" colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Confirm Invoices" name="invoice_confirm" type="object" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_invoice_confirm" model="ir.actions.act_window">
|
||||
<field name="name">Confirm draft invoices</field>
|
||||
<field name="res_model">account.invoice.confirm</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_invoice_confirm_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="action_account_invoice_confirm_values">
|
||||
<field name="model_id" ref="account.model_account_invoice" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Confirm draft invoices</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_confirm'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.invoice</field>
|
||||
</record>
|
||||
|
||||
<record id="account_invoice_cancel_view" model="ir.ui.view">
|
||||
<field name="name">account.invoice.cancel.form</field>
|
||||
<field name="model">account.invoice.cancel</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Cancel selected invoices">
|
||||
<separator string="Cancel selected invoices" colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Cancel selected invoices" name="invoice_cancel" type="object" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_invoice_cancel" model="ir.actions.act_window">
|
||||
<field name="name">Cancel selected invoices</field>
|
||||
<field name="res_model">account.invoice.cancel</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_invoice_cancel_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="action_account_invoice_cancel_values">
|
||||
<field name="model_id" ref="account.model_account_invoice" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Cancel selected invoices</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_cancel'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.invoice</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,55 @@
|
||||
# -*- 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
|
||||
|
||||
class account_unreconcile(osv.osv_memory):
|
||||
_name = "account.unreconcile"
|
||||
_description = "Account Unreconcile"
|
||||
|
||||
def trans_unrec(self, cr, uid, ids, context=None):
|
||||
obj_move_line = self.pool.get('account.move.line')
|
||||
obj_move_reconcile = self.pool.get('account.move.reconcile')
|
||||
if context is None:
|
||||
context = {}
|
||||
recs = obj_move_line.read(cr, uid, context['active_ids'], ['reconcile_id',])
|
||||
recs = filter(lambda x: x['reconcile_id'], recs)
|
||||
rec_ids = [rec['reconcile_id'][0] for rec in recs]
|
||||
if len(rec_ids):
|
||||
obj_move_reconcile.unlink(cr, uid, rec_ids)
|
||||
return {}
|
||||
|
||||
account_unreconcile()
|
||||
|
||||
class account_unreconcile_reconcile(osv.osv_memory):
|
||||
_name = "account.unreconcile.reconcile"
|
||||
_description = "Account Unreconcile Reconcile"
|
||||
|
||||
def trans_unrec_reconcile(self, cr, uid, ids, context=None):
|
||||
obj_move_reconcile = self.pool.get('account.move.reconcile')
|
||||
if context is None:
|
||||
context = {}
|
||||
if len(rec_ids):
|
||||
obj_move_reconcile.unlink(cr, uid, context['active_ids'])
|
||||
return {}
|
||||
|
||||
account_unreconcile_reconcile()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_unreconcile_view" model="ir.ui.view">
|
||||
<field name="name">Unreconcile Entries</field>
|
||||
<field name="model">account.unreconcile</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Unreconciliation">
|
||||
<separator string="Unreconciliation transactions" colspan="4"/>
|
||||
<image name="gtk-dialog-info"/>
|
||||
<label string="If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable" colspan="2"/>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Unreconcile" name="trans_unrec" type="object" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_unreconcile" model="ir.actions.act_window">
|
||||
<field name="name">Unreconcile Entries</field>
|
||||
<field name="res_model">account.unreconcile</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_unreconcile_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_unreconcile_values">
|
||||
<field name="model_id" ref="account.model_account_move_line" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Unreconcile Entries</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_unreconcile'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.move.line</field>
|
||||
</record>
|
||||
|
||||
<record id="account_unreconcile_reconcile_view" model="ir.ui.view">
|
||||
<field name="name">Unreconcile Entries</field>
|
||||
<field name="model">account.unreconcile.reconcile</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Unreconciliation">
|
||||
<separator string="Unreconciliation transactions" colspan="4"/>
|
||||
<image name="gtk-dialog-info"/>
|
||||
<label string="If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable" colspan="2"/>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Unreconcile" name="trans_unrec_reconcile" type="object" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_unreconcile_reconcile" model="ir.actions.act_window">
|
||||
<field name="name">Unreconcile Entries</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.unreconcile.reconcile</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_unreconcile_reconcile_view"/>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_unreconcile_reconcile_values">
|
||||
<field name="model_id" ref="account.model_account_move_reconcile" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Unreconcile Entries</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_unreconcile_reconcile'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.move.reconcile</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="event_registration_values">
|
||||
<record model="ir.values" id="validate_account_move_line_values">
|
||||
<field name="model_id" ref="account.model_account_move_line" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Validate Ledger Postings</field>
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
|
||||
def _invoice_confirm(self, cr, uid, data, context):
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
for id in data['ids']:
|
||||
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr)
|
||||
return {}
|
||||
|
||||
class wizard_invoice_confirm(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_invoice_confirm],
|
||||
'result': {'type':'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_invoice_confirm('account.invoice.state.confirm')
|
||||
|
||||
|
||||
def _invoice_cancel(self, cr, uid, data, context):
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
for id in data['ids']:
|
||||
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr)
|
||||
return {}
|
||||
|
||||
class wizard_invoice_cancel(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_invoice_cancel],
|
||||
'result': {'type':'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_invoice_cancel('account.invoice.state.cancel')
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
|
||||
_info_form = '''<?xml version="1.0"?>
|
||||
<form string="Unreconciliation">
|
||||
<separator string="Unreconciliation transactions" colspan="4"/>
|
||||
<image name="gtk-dialog-info" colspan="2"/>
|
||||
<label string="If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable" colspan="2"/>
|
||||
</form>'''
|
||||
|
||||
def _trans_unrec(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
recs = pool.get('account.move.line').read(cr, uid, data['ids'], ['reconcile_id',])
|
||||
recs = filter(lambda x: x['reconcile_id'], recs)
|
||||
rec_ids = [rec['reconcile_id'][0] for rec in recs]
|
||||
if len(rec_ids):
|
||||
pooler.get_pool(cr.dbname).get('account.move.reconcile').unlink(cr, uid, rec_ids)
|
||||
return {}
|
||||
|
||||
class wiz_unreconcile(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch': _info_form, 'fields': {}, 'state':[('end', 'Cancel', 'gtk-cancel'), ('unrec', 'Unreconcile', 'gtk-ok')]}
|
||||
},
|
||||
'unrec': {
|
||||
'actions': [_trans_unrec],
|
||||
'result': {'type': 'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wiz_unreconcile('account.move.line.unreconcile')
|
||||
|
||||
|
||||
def _trans_unrec_reconcile(self, cr, uid, data, context):
|
||||
rec_ids = data['ids']
|
||||
if len(rec_ids):
|
||||
pooler.get_pool(cr.dbname).get('account.move.reconcile').unlink(cr, uid, rec_ids)
|
||||
return {}
|
||||
|
||||
class wiz_unreconcile_reconcile(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch': _info_form, 'fields': {}, 'state':[('end', 'Cancel', 'gtk-cancel'), ('unrec', 'Unreconcile', 'gtk-ok')]}
|
||||
},
|
||||
'unrec': {
|
||||
'actions': [_trans_unrec_reconcile],
|
||||
'result': {'type': 'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wiz_unreconcile_reconcile('account.reconcile.unreconcile')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -44,7 +44,9 @@ to set up a management by affair.
|
||||
'hr_timesheet_view.xml',
|
||||
'hr_timesheet_report.xml',
|
||||
'hr_timesheet_wizard.xml',
|
||||
'process/hr_timesheet_process.xml'
|
||||
'process/hr_timesheet_process.xml',
|
||||
'wizard/hr_timesheet_print_employee_view.xml',
|
||||
'wizard/hr_timesheet_print_users_view.xml'
|
||||
],
|
||||
'demo_xml': ['hr_timesheet_demo.xml'],
|
||||
'installable': True,
|
||||
|
||||
@@ -13,32 +13,32 @@
|
||||
sequence="1" />
|
||||
<report auto="False" id="report_user_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee timesheet" xsl="hr_timesheet/report/user_timesheet.xsl"/>
|
||||
|
||||
<wizard id="wizard_hr_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee Timesheet"/>
|
||||
|
||||
<!--<wizard id="wizard_hr_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee Timesheet"/>
|
||||
-->
|
||||
<!--<menuitem id="next_id_48" name="Timesheet" parent="hr.menu_hr_reporting"/>-->
|
||||
<!-- <menuitem action="wizard_hr_timesheet" id="menu_wizard_hr_timesheet" parent="next_id_48" type="wizard"
|
||||
groups="hr.group_hr_manager"/>-->
|
||||
<menuitem action="wizard_hr_timesheet" id="menu_wizard_hr_timesheet" parent="menu_hr_reporting_timesheet" type="wizard"
|
||||
<!--<menuitem action="wizard_hr_timesheet" id="menu_wizard_hr_timesheet" parent="menu_hr_reporting_timesheet" type="wizard"
|
||||
|
||||
groups="hr.group_hr_manager"
|
||||
/>
|
||||
<wizard id="wizard_hr_timesheet_my" menu="False" model="hr.employee" name="hr.analytical.timesheet.my" string="Print My Timesheet"/>
|
||||
/>-->
|
||||
<!-- <wizard id="wizard_hr_timesheet_my" menu="False" model="hr.employee" name="hr.analytical.timesheet.my" string="Print My Timesheet"/>
|
||||
<menuitem
|
||||
action="wizard_hr_timesheet_my"
|
||||
id="menu_wizard_hr_timesheet_my"
|
||||
parent="menu_hr_reporting_timesheet"
|
||||
type="wizard"
|
||||
groups="hr.group_hr_user"
|
||||
/>
|
||||
/>-->
|
||||
|
||||
<report auto="False" id="report_users_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees Timesheet" xsl="hr_timesheet/report/users_timesheet.xsl"/>
|
||||
|
||||
<wizard id="wizard_hr_timesheet_users" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees Timesheet"/>
|
||||
<menuitem
|
||||
<!--<menuitem
|
||||
action="wizard_hr_timesheet_users"
|
||||
id="menu_wizard_hr_timesheet_users"
|
||||
groups="hr.group_hr_manager"
|
||||
parent="menu_hr_reporting_timesheet" type="wizard"/>
|
||||
|
||||
-->
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!--<wizard id="si_so" model="hr.employee" name="hr_timesheet.si_so" string="Sign in / Sign out by project"/>-->
|
||||
<!-- <menuitem action="si_so" id="menu_si_so" parent="hr_attendance.menu_hr_attendance" type="wizard"/>-->
|
||||
<wizard id="si_so" name="hr_timesheet.si_so" string="Sign in / Sign out by project"/>
|
||||
<menuitem action="si_so" id="menu_si_so" parent="hr_attendance.menu_hr_time_tracking" type="wizard"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,7 +15,7 @@
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
@@ -42,24 +42,24 @@ def emp_create_xml(cr, id, som, eom):
|
||||
"and line.user_id=%s and line.date >= %s and line.date < %s "
|
||||
"order by line.date",
|
||||
(id, som.strftime('%Y-%m-%d'), eom.strftime('%Y-%m-%d')))
|
||||
|
||||
|
||||
# Sum by day
|
||||
month = {}
|
||||
for presence in cr.dictfetchall():
|
||||
day = int(presence['date'][-2:])
|
||||
month[day] = month.get(day, 0.0) + presence['amount']
|
||||
|
||||
|
||||
xml = '''
|
||||
<time-element date="%s">
|
||||
<amount>%.2f</amount>
|
||||
</time-element>
|
||||
'''
|
||||
time_xml = ([xml % (day, amount) for day, amount in month.iteritems()])
|
||||
|
||||
|
||||
# Computing the employee
|
||||
cr.execute("select name from res_users where id=%s", (id,))
|
||||
emp = cr.fetchone()[0]
|
||||
|
||||
|
||||
# Computing the xml
|
||||
xml = '''
|
||||
<employee id="%d" name="%s">
|
||||
@@ -73,13 +73,13 @@ class report_custom(report_rml):
|
||||
def get_month_name(self, cr, uid, month):
|
||||
_months = {1:_("January"), 2:_("February"), 3:_("March"), 4:_("April"), 5:_("May"), 6:_("June"), 7:_("July"), 8:_("August"), 9:_("September"), 10:_("October"), 11:_("November"), 12:_("December")}
|
||||
return _months[month]
|
||||
|
||||
|
||||
def get_weekday_name(self, cr, uid, weekday):
|
||||
_weekdays = {1:_('Mon'), 2:_('Tue'), 3:_('Wed'), 4:_('Thu'), 5:_('Fri'), 6:_('Sat'), 7:_('Sun')}
|
||||
return _weekdays[weekday]
|
||||
|
||||
def create_xml(self, cr, uid, ids, data, context):
|
||||
|
||||
|
||||
# Computing the dates (start of month: som, and end of month: eom)
|
||||
som = datetime.date(data['form']['year'], data['form']['month'], 1)
|
||||
eom = som + datetime.timedelta(lengthmonth(som.year, som.month))
|
||||
@@ -87,9 +87,9 @@ class report_custom(report_rml):
|
||||
date_xml += ['<day number="%d" name="%s" weekday="%d" />' % (x, self.get_weekday_name(cr, uid, som.replace(day=x).weekday()+1), som.replace(day=x).weekday()+1) for x in range(1, lengthmonth(som.year, som.month)+1)]
|
||||
date_xml.append('</days>')
|
||||
date_xml.append('<cols>2.5cm%s,2cm</cols>\n' % (',0.7cm' * lengthmonth(som.year, som.month)))
|
||||
|
||||
|
||||
emp_xml=''
|
||||
for id in data['form']['user_ids'][0][2]:
|
||||
for id in data['form']['user_ids']:
|
||||
emp_xml += emp_create_xml(cr, id, som, eom)
|
||||
|
||||
# Computing the xml
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,13 +15,13 @@
|
||||
# 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 sign_in_out
|
||||
import wizard_print_timesheet
|
||||
import wizard_print_timesheet_users
|
||||
import hr_timesheet_print_employee
|
||||
import hr_timesheet_print_users
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
##############################################################################
|
||||
import datetime
|
||||
|
||||
from osv import osv, fields
|
||||
|
||||
class analytical_timesheet_employee(osv.osv_memory):
|
||||
_name = 'hr.analytical.timesheet.employee'
|
||||
_description = 'Print Employee Timesheet & Print My Timesheet'
|
||||
_columns = {
|
||||
'month': fields.selection([(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)],
|
||||
'Month', required=True),
|
||||
'year': fields.integer('Year', required=True),
|
||||
'user_id': fields.many2one('res.users', 'User', required=True)
|
||||
}
|
||||
|
||||
def _get_user(self, cr, uid, context=None):
|
||||
return uid
|
||||
|
||||
_defaults = {
|
||||
'month': datetime.date.today().month,
|
||||
'year': datetime.date.today().year,
|
||||
'user_id': _get_user
|
||||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
datas = {
|
||||
'ids': [],
|
||||
'model': 'hr.employee',
|
||||
'form': data
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'hr.analytical.timesheet',
|
||||
'datas': datas,
|
||||
}
|
||||
analytical_timesheet_employee()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Print Employee Timesheet -->
|
||||
<record id="view_hr_timesheet_employee" model="ir.ui.view">
|
||||
<field name="name">hr.analytical.timesheet.employee.form</field>
|
||||
<field name="model">hr.analytical.timesheet.employee</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Employee Timesheet">
|
||||
<group colspan="4" >
|
||||
<field name="month" />
|
||||
<field name="year" />
|
||||
<field name="user_id" colspan="3" />
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-print" string="Print" name="print_report" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_employee" model="ir.actions.act_window">
|
||||
<field name="name">Employee Timesheet</field>
|
||||
<field name="res_model">hr.analytical.timesheet.employee</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_employee"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_hr_timesheet_employee"
|
||||
id="menu_hr_timesheet_employee"
|
||||
parent="menu_hr_reporting_timesheet"
|
||||
groups="hr.group_hr_manager" />
|
||||
|
||||
|
||||
<!-- Print My Timesheet -->
|
||||
<record id="view_hr_timesheet_my" model="ir.ui.view">
|
||||
<field name="name">hr.analytical.timesheet.my.form</field>
|
||||
<field name="model">hr.analytical.timesheet.employee</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Print My Timesheet">
|
||||
<group colspan="4" >
|
||||
<field name="month" />
|
||||
<field name="year" />
|
||||
<field name="user_id" colspan="3" readonly="1" />
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-print" string="Print" name="print_report" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_my" model="ir.actions.act_window">
|
||||
<field name="name">Print My Timesheet</field>
|
||||
<field name="res_model">hr.analytical.timesheet.employee</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_my"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_hr_timesheet_my"
|
||||
id="menu_hr_timesheet_my"
|
||||
parent="menu_hr_reporting_timesheet"
|
||||
groups="hr.group_hr_user" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,56 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
from osv import osv, fields
|
||||
|
||||
class analytical_timesheet_employees(osv.osv_memory):
|
||||
_name = 'hr.analytical.timesheet.users'
|
||||
_description = 'Print Employees Timesheet'
|
||||
_columns = {
|
||||
'month': fields.selection([(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)],
|
||||
'Month', required=True),
|
||||
'year': fields.integer('Year', required=True),
|
||||
'user_ids': fields.many2many('res.users', 'timesheet_users_rel', 'timesheet_id', 'user_id', 'Users', required=True)
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'month': datetime.date.today().month,
|
||||
'year': datetime.date.today().year,
|
||||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
datas = {
|
||||
'ids': [],
|
||||
'model': 'hr.employee',
|
||||
'form': data
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'hr.analytical.timesheet_users',
|
||||
'datas': datas,
|
||||
}
|
||||
|
||||
analytical_timesheet_employees()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Print Employees Timesheets -->
|
||||
<record id="view_hr_timesheet_users" model="ir.ui.view">
|
||||
<field name="name">hr.analytical.timesheet.users.form</field>
|
||||
<field name="model">hr.analytical.timesheet.users</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Employees Timesheet">
|
||||
<group colspan="4" >
|
||||
<field name="month" />
|
||||
<field name="year" />
|
||||
<field name="user_ids" colspan="3" />
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-print" string="Print" name="print_report" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_users" model="ir.actions.act_window">
|
||||
<field name="name">Employees Timesheet</field>
|
||||
<field name="res_model">hr.analytical.timesheet.users</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_users"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_hr_timesheet_users"
|
||||
id="menu_hr_timesheet_users"
|
||||
parent="menu_hr_reporting_timesheet"
|
||||
groups="hr.group_hr_manager" />
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,7 +15,7 @@
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
@@ -25,7 +25,7 @@ import time
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
si_form ='''<?xml version="1.0"?>
|
||||
si_form ='''<?xml version="1.0"?>
|
||||
<form string="Sign in / Sign out">
|
||||
<separator string="Sign in" colspan="4"/>
|
||||
<field name="name" readonly="True" />
|
||||
@@ -98,6 +98,7 @@ def _sign_in_result(self, cr, uid, data, context):
|
||||
|
||||
def _write(self, cr, uid, data, emp_id, context):
|
||||
timesheet_obj = pooler.get_pool(cr.dbname).get('hr.analytic.timesheet')
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
hour = (time.mktime(time.strptime(data['form']['date'] or time.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')) -
|
||||
time.mktime(time.strptime(data['form']['date_start'], '%Y-%m-%d %H:%M:%S'))) / 3600.0
|
||||
minimum = data['form']['analytic_amount']
|
||||
@@ -110,6 +111,8 @@ def _write(self, cr, uid, data, emp_id, context):
|
||||
res['name'] = data['form']['info']
|
||||
res['account_id'] = data['form']['account_id']
|
||||
res['unit_amount'] = hour
|
||||
emp_journal = emp_obj.browse(cr, uid, emp_id, context).journal_id
|
||||
res['journal_id'] = emp_journal and emp_journal.id or False
|
||||
res.update(up)
|
||||
up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
|
||||
res.update(up)
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
|
||||
dates_form = '''<?xml version="1.0"?>
|
||||
<form string="Choose your month">
|
||||
<field name="month" />
|
||||
<field name="year" />
|
||||
<field name="user_id" colspan="3" />
|
||||
</form>'''
|
||||
|
||||
|
||||
dates_form_ro = '''<?xml version="1.0"?>
|
||||
<form string="Choose your month">
|
||||
<field name="month" />
|
||||
<field name="year" />
|
||||
<field name="user_id" colspan="3" readonly="1"/>
|
||||
</form>'''
|
||||
|
||||
dates_fields = {
|
||||
'month': dict(string=u'Month', type='selection', required=True, selection=[(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)]),
|
||||
'year': dict(string=u'Year', type=u'integer', required=True),
|
||||
'user_id' : dict(string=u'User', type='many2one', relation='res.users', required=True),
|
||||
}
|
||||
|
||||
def _get_value(self, cr, uid, data, context):
|
||||
today = datetime.date.today()
|
||||
return dict(month=today.month, year=today.year, user_id=uid)
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_value],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[ ('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'hr.analytical.timesheet', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('hr.analytical.timesheet')
|
||||
|
||||
class wizard_report_my(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_value],
|
||||
'result': {'type':'form', 'arch':dates_form_ro, 'fields':dates_fields, 'state':[ ('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'hr.analytical.timesheet', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report_my('hr.analytical.timesheet.my')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import datetime
|
||||
|
||||
form='''<?xml version="1.0"?>
|
||||
<form string="Choose Users">
|
||||
<field name="month"/>
|
||||
<field name="year"/>
|
||||
<field name="user_ids" colspan="3"/>
|
||||
</form>'''
|
||||
|
||||
fields = {
|
||||
'month': dict(string=u'Month', type='selection', required=True, selection=[(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)]),
|
||||
'year': dict(string=u'Year', type='integer', required=True),
|
||||
'user_ids': dict(string=u'Users', type='many2many', relation='res.users', required=True),
|
||||
}
|
||||
|
||||
def _get_value(self, cr, uid, data, context):
|
||||
today=datetime.date.today()
|
||||
return dict(month=today.month, year=today.year)
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
states={
|
||||
'init':{
|
||||
'actions':[_get_value],
|
||||
'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
|
||||
},
|
||||
'report':{
|
||||
'actions':[],
|
||||
'result':{'type':'print', 'report':'hr.analytical.timesheet_users', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('hr.analytical.timesheet_users')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
Reference in New Issue
Block a user