diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index 0afe7f878e0..1ff58367b47 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -70,6 +70,8 @@ module named account_voucherss
'wizard/account_pay_invoice_view.xml',
'wizard/account_unreconcile_view.xml',
'wizard/account_invoice_state_view.xml',
+ 'wizard/account_use_model_view.xml',
+ 'wizard/account_partner_balance_report_view.xml',
'project/wizard/project_account_analytic_line_view.xml',
'account_view.xml',
'account_end_fy.xml',
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index c0bd50eb7bc..a386901a083 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1176,7 +1176,7 @@
-
+
diff --git a/addons/account/account_wizard.xml b/addons/account/account_wizard.xml
index 148491fb2a1..e5825f6b2da 100644
--- a/addons/account/account_wizard.xml
+++ b/addons/account/account_wizard.xml
@@ -76,8 +76,8 @@
-
-
+
@@ -96,10 +96,10 @@
-->
-
-
+
+
-
+
diff --git a/addons/account/i18n/sv.po b/addons/account/i18n/sv.po
index c1c5599e2d3..5959bd7abbe 100644
--- a/addons/account/i18n/sv.po
+++ b/addons/account/i18n/sv.po
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
-"PO-Revision-Date: 2010-03-24 14:33+0000\n"
-"Last-Translator: Anders Eriksson (Mobila System) \n"
+"PO-Revision-Date: 2010-04-21 15:12+0000\n"
+"Last-Translator: djn (XCLUDE) \n"
"Language-Team: <> <>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-17 04:08+0000\n"
+"X-Launchpad-Export-Date: 2010-04-22 03:43+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
@@ -26,12 +26,6 @@ msgstr "Internt namn"
msgid "Account Tax Code"
msgstr "Konto, skattekod"
-#. module: account
-#: model:ir.actions.act_window,name:account.action_invoice_tree9
-#: model:ir.ui.menu,name:account.menu_action_invoice_tree9
-msgid "Unpaid Supplier Invoices"
-msgstr "Obetalda leverantörsfakturor"
-
#. module: account
#: model:ir.ui.menu,name:account.menu_finance_entries
msgid "Entries Encoding"
@@ -1593,7 +1587,7 @@ msgstr "Moms"
#. module: account
#: rml:account.analytic.account.journal:0
msgid "Account n°"
-msgstr ""
+msgstr "Konto Nr"
#. module: account
#: view:account.tax:0
diff --git a/addons/account/report/partner_balance.py b/addons/account/report/partner_balance.py
index a5b746a0bde..f296475cb3f 100755
--- a/addons/account/report/partner_balance.py
+++ b/addons/account/report/partner_balance.py
@@ -67,10 +67,10 @@ class partner_balance(report_sxw.rml_parse):
## Get All Period Date
#
# If we have no period we will take all perdio in the FiscalYear.
- if not data['form']['periods'][0][2] :
+ if not data['form']['periods']:
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
else:
- periods_id = data['form']['periods'][0][2]
+ periods_id = data['form']['periods']
date_array = []
for period_id in periods_id:
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
@@ -85,35 +85,38 @@ class partner_balance(report_sxw.rml_parse):
self.date_lst.sort()
def transform_both_into_date_array(self,data):
- if not data['form']['periods'][0][2] :
+ final_date_array = []
+ date_start_date = data['form']['date1']
+ date_stop_date = data['form']['date2']
+ if not data['form']['periods']:
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
else:
- periods_id = data['form']['periods'][0][2]
+ periods_id = data['form']['periods']
date_array = []
- for period_id in periods_id:
- period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
- date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
+ if periods_id:
+ for period_id in periods_id:
+ period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
+ date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
+ period_start_date = date_array[0]
+ period_stop_date = date_array[-1]
- period_start_date = date_array[0]
- date_start_date = data['form']['date1']
- period_stop_date = date_array[-1]
- date_stop_date = data['form']['date2']
+ if period_start_date).
+#
+# 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 .
+#
+##############################################################################
+
+import time
+
+from tools.translate import _
+from osv import fields, osv
+
+class account_partner_balance(osv.osv_memory):
+ """
+ This wizard will provide the partner balance report by periods, between any two dates.
+ """
+ _name = 'account.partner.balance'
+ _description = 'Account Partner Balance'
+ _columns = {
+ 'company_id': fields.many2one('res.company', 'Company', required=True),
+ 'state': fields.selection([('bydate','By Date'),
+ ('byperiod','By Period'),
+ ('all','By Date and Period'),
+ ('none','No Filter')
+ ],'Date/Period Filter'),
+ 'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
+ 'periods': fields.many2many('account.period', 'period_report_rel', 'report_id', 'period_id', 'Periods', help='All periods if empty'),
+ 'result_selection': fields.selection([('customer','Receivable Accounts'),
+ ('supplier','Payable Accounts'),
+ ('all','Receivable and Payable Accounts')],
+ 'Partner', required=True),
+ 'soldeinit': fields.boolean('Include initial balances'),
+ 'date1': fields.date('Start date', required=True),
+ 'date2': fields.date('End date', required=True),
+ }
+
+ def _get_company(self, cr, uid, ids, context=None):
+ user_obj = self.pool.get('res.users')
+ company_obj = self.pool.get('res.company')
+ user = user_obj.browse(cr, uid, uid, context=context)
+ if user.company_id:
+ return user.company_id.id
+ else:
+ return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
+
+ _defaults={
+ 'state' : 'none',
+ 'date1' : lambda *a: time.strftime('%Y-01-01'),
+ 'date2' : lambda *a: time.strftime('%Y-%m-%d'),
+ 'result_selection' : lambda *a: 'all',
+ 'soldeinit' : True,
+ 'company_id' : _get_company,
+ 'fiscalyear' : False,
+ }
+
+ def check_state(self, cr, uid, ids, context=None):
+ data = {
+ 'ids':[],
+ 'model': 'res.partner',
+ 'form': self.read(cr, uid, ids, [])[0],
+ }
+
+ if data['form']['state'] == 'bydate' :
+ return self._check_date(cr, uid, data, context)
+ if data['form']['state'] == 'byperiod':
+ if not data['form']['periods']:
+ raise osv.except_osv(_('Warning'),_('Please Enter Periods ! '))
+
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.partner.balance',
+ 'datas': data,
+ }
+
+ def _check_date(self, cr, uid, data, context):
+ sql = """
+ SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
+ cr.execute(sql,(data['form']['date1'],))
+ res = cr.dictfetchall()
+ if res:
+ if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']):
+ raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']), str(res[0]['date_stop'])))
+ else:
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.partner.balance',
+ 'datas': data,
+ }
+ else:
+ raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
+
+account_partner_balance()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/account_partner_balance_report_view.xml b/addons/account/wizard/account_partner_balance_report_view.xml
new file mode 100644
index 00000000000..02c2ec03a25
--- /dev/null
+++ b/addons/account/wizard/account_partner_balance_report_view.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+ Select period
+ account.partner.balance
+ form
+
+
+
+
+
+
+ Select Period
+ account.partner.balance
+ ir.actions.act_window
+ form
+ tree,form
+
+ {'record_id':active_id}
+ new
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/account/wizard/account_use_model.py b/addons/account/wizard/account_use_model.py
new file mode 100644
index 00000000000..28a892a398b
--- /dev/null
+++ b/addons/account/wizard/account_use_model.py
@@ -0,0 +1,116 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# 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 .
+#
+##############################################################################
+import time
+import datetime
+
+from osv import fields, osv
+from tools.translate import _
+
+class account_use_model(osv.osv_memory):
+
+ _name = 'account.use.model'
+ _description = 'Use model'
+ _columns = {
+ 'model': fields.many2many('account.model', 'account_use_model_relation','account_id','model_id','Account Model'),
+ }
+
+ def create_entries(self, cr, uid, ids, context=None):
+ account_model_obj = self.pool.get('account.model')
+ account_period_obj = self.pool.get('account.period')
+ account_move_obj = self.pool.get('account.move')
+ account_move_line_obj = self.pool.get('account.move.line')
+ mod_obj = self.pool.get('ir.model.data')
+ if context is None:
+ context = {}
+
+ data = self.read(cr, uid, ids,context=context)[0]
+ record_id = context and context.get('model_line', False) or False
+ if record_id:
+ data_model = account_model_obj.browse(cr,uid,data['model'])
+ else:
+ data_model = account_model_obj.browse(cr,uid,context['active_ids'])
+ move_ids = []
+ for model in data_model:
+ period_id = account_period_obj.find(cr, uid, context=context)
+ if not period_id:
+ raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
+ period_id = period_id[0]
+ move_id = account_move_obj.create(cr, uid, {
+ 'ref': model.ref,
+ 'period_id': period_id,
+ 'journal_id': model.journal_id.id,
+ })
+ move_ids.append(move_id)
+ for line in model.lines_id:
+ val = {
+ 'move_id': move_id,
+ 'journal_id': model.journal_id.id,
+ 'period_id': period_id
+ }
+ val.update({
+ 'name': line.name,
+ 'quantity': line.quantity,
+ 'debit': line.debit,
+ 'credit': line.credit,
+ 'account_id': line.account_id.id,
+ 'move_id': move_id,
+ 'ref': line.ref,
+ 'partner_id': line.partner_id.id,
+ 'date': time.strftime('%Y-%m-%d'),
+ 'date_maturity': time.strftime('%Y-%m-%d')
+ })
+ c = context.copy()
+ c.update({'journal_id': model.journal_id.id,'period_id': period_id})
+ id_line = account_move_line_obj.create(cr, uid, val, context=c)
+ context.update({'move_ids':move_ids})
+ model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_use_model_open_entry')], context=context)
+ resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
+ return {
+ 'name': _('Use Model'),
+ 'context': context,
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'account.use.model',
+ 'views': [(resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ }
+
+ def open_moves(self, cr, uid, ids, context=None):
+ mod_obj = self.pool.get('ir.model.data')
+ if context is None:
+ context = {}
+ model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_move_form')], context=context)
+ resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
+ return {
+ 'domain': "[('id','in', ["+','.join(map(str,context['move_ids']))+"])]",
+ 'name': 'Entries',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.move',
+ 'views': [(False,'tree'),(resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ }
+
+account_use_model()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/account_use_model_view.xml b/addons/account/wizard/account_use_model_view.xml
new file mode 100644
index 00000000000..877a83dbb00
--- /dev/null
+++ b/addons/account/wizard/account_use_model_view.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+ account.use.model.form
+ account.use.model
+ form
+
+
+
+
+
+
+ Create Entries From Models
+ account.use.model
+ form
+ tree,form
+
+ new
+ {'model_line':'model_line'}
+
+
+
+
+
+ Create Entries From Models
+ client_action_multi
+
+ action
+ account.move.line
+
+
+
+
+
+ account.use.model.open.entry.form
+ account.use.model
+ form
+
+
+
+
+
+
+ account.use.model.create.entry.form
+ account.use.model
+ form
+
+
+
+
+
+
+ Create Entries From Models
+ account.use.model
+ form
+ tree,form
+
+ new
+
+
+
+
diff --git a/addons/account/wizard/wizard_partner_balance_report.py b/addons/account/wizard/wizard_partner_balance_report.py
deleted file mode 100644
index f7b049a4f0f..00000000000
--- a/addons/account/wizard/wizard_partner_balance_report.py
+++ /dev/null
@@ -1,127 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import time
-import wizard
-import pooler
-from tools.translate import _
-
-period_form = '''
-'''
-
-period_fields = {
- 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
- 'state':{
- 'string':"Date/Period Filter",
- 'type':'selection',
- 'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],
- 'default': lambda *a:'none'
- },
- 'fiscalyear': {
- 'string':'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
- 'default': lambda *a:False,
- 'help': 'Keep empty for all open fiscal year'
- },
- 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
- 'result_selection':{
- 'string':"Partner",
- 'type':'selection',
- 'selection':[('customer','Receivable Accounts'),('supplier','Payable Accounts'),('all','Receivable and Payable Accounts')],
- 'required':True
- },
- 'soldeinit':{'string':"Include initial balances",'type':'boolean'},
- 'date1': {'string':' Start date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-01-01')},
- 'date2': {'string':'End date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-%m-%d')},
-}
-
-class wizard_report(wizard.interface):
-
- def _get_defaults(self,cr,uid,data,context):
- user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
- if user.company_id:
- company_id = user.company_id.id
- else:
- company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
-
- fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
- periods_obj=pooler.get_pool(cr.dbname).get('account.period')
- data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
- data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
- data['form']['company_id'] = company_id
- data['form']['soldeinit'] = True
- data['form']['fiscalyear'] = False
- data['form']['result_selection'] = 'all'
- return data['form']
-
- def _check_state(self, cr, uid, data, context):
-
- if data['form']['state'] == 'bydate' :
- self._check_date(cr, uid, data, context)
- return data['form']
-
- def _check_date(self, cr, uid, data, context):
- sql = """
- SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
- cr.execute(sql,(data['form']['date1'],))
- res = cr.dictfetchall()
- if res:
- if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']):
- raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']), str(res[0]['date_stop'])))
- else:
- return 'report'
-
- else:
- raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year'))
-
- states = {
- 'init': {
- 'actions': [_get_defaults],
- 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
- },
-
- 'report': {
- 'actions': [_check_state],
- 'result': {'type':'print', 'report':'account.partner.balance', 'state':'end'}
- }
- }
-wizard_report('account.partner.balance.report')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/wizard_use_model.py b/addons/account/wizard/wizard_use_model.py
deleted file mode 100644
index ef3a4ba1310..00000000000
--- a/addons/account/wizard/wizard_use_model.py
+++ /dev/null
@@ -1,131 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import wizard
-import time
-import datetime
-import pooler
-from tools.translate import _
-
-model_form = """
-"""
-
-model_fields = {
- 'model': {'string': 'Account Model', 'type': 'many2many', 'relation': 'account.model', 'required': True},
- }
-
-form = """
-
-"""
-fields = {
- }
-def _create_entries(self, cr, uid, data, context):
- pool_obj = pooler.get_pool(cr.dbname)
- if data['model']=='ir.ui.menu' or data['model']=='account.move.line':
- model_ids = data['form']['model'][0][2]
- data_model = pool_obj.get('account.model').browse(cr,uid,model_ids)
- else:
- data_model = pool_obj.get('account.model').browse(cr,uid,data['ids'])
- move_ids = []
- for model in data_model:
-
- period_id = pool_obj.get('account.period').find(cr,uid, context=context)
- if not period_id:
- raise wizard.except_wizard(_('No period found !'), _('Unable to find a valid period !'))
- period_id = period_id[0]
- move_id = pool_obj.get('account.move').create(cr, uid, {
- 'ref': model.ref,
- 'period_id': period_id,
- 'journal_id': model.journal_id.id,
- })
- move_ids.append(move_id)
- for line in model.lines_id:
- val = {
- 'move_id': move_id,
- 'journal_id': model.journal_id.id,
- 'period_id': period_id
- }
- val.update({
- 'name': line.name,
- 'quantity': line.quantity,
- 'debit': line.debit,
- 'credit': line.credit,
- 'account_id': line.account_id.id,
- 'move_id': move_id,
- 'ref': line.ref,
- 'partner_id': line.partner_id.id,
- 'date': time.strftime('%Y-%m-%d'),
- 'date_maturity': time.strftime('%Y-%m-%d')
- })
- c = context.copy()
- c.update({'journal_id': model.journal_id.id,'period_id': period_id})
- id_line = pool_obj.get('account.move.line').create(cr, uid, val, context=c)
- data['form']['move_ids']=move_ids
- return data['form']
-
-class use_model(wizard.interface):
-
- def _open_moves(self, cr, uid, data, context):
- pool_obj = pooler.get_pool(cr.dbname)
- model_data_ids = pool_obj.get('ir.model.data').search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_move_form')])
- resource_id = pool_obj.get('ir.model.data').read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
- return {
- 'domain': "[('id','in', ["+','.join(map(str,data['form']['move_ids']))+"])]",
- 'name': 'Entries',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.move',
- 'views': [(False,'tree'),(resource_id,'form')],
- 'type': 'ir.actions.act_window'
- }
-
- def _check(self, cr, uid, data, context):
- if data['model']=='ir.ui.menu' or data['model']=='account.move.line':
- return 'init_form'
- return 'create'
-
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'choice','next_state':_check}
- },
- 'init_form': {
- 'actions': [],
- 'result': {'type':'form', 'arch':model_form, 'fields':model_fields, 'state':[('end','Cancel', 'gtk-cancel'),('create','Create', 'gtk-ok')]},
- },
- 'create': {
- 'actions': [_create_entries],
- 'result': {'type': 'form','arch':form, 'fields':fields, 'state':[('end','Ok'),('open_move','Open')]},
- },
- 'open_move': {
- 'actions': [],
- 'result': {'type':'action', 'action':_open_moves, 'state':'end'}
- }
- }
-
-use_model("account_use_models")# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/hr/i18n/sv.po b/addons/hr/i18n/sv.po
index e3acd524000..661e079515f 100644
--- a/addons/hr/i18n/sv.po
+++ b/addons/hr/i18n/sv.po
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
-"PO-Revision-Date: 2010-03-09 21:10+0000\n"
-"Last-Translator: Anders Eriksson (Mobila System) \n"
+"PO-Revision-Date: 2010-04-21 15:10+0000\n"
+"Last-Translator: djn (XCLUDE) \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-17 04:16+0000\n"
+"X-Launchpad-Export-Date: 2010-04-22 03:43+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: hr
@@ -189,7 +189,7 @@ msgstr "Medlemmar"
#. module: hr
#: field:hr.employee,ssnid:0
msgid "SSN No"
-msgstr ""
+msgstr "Personnummer"
#. module: hr
#: model:process.transition,note:hr.process_transition_contactofemployee0
@@ -315,7 +315,7 @@ msgstr "Aktiv"
#. module: hr
#: constraint:hr.employee:0
msgid "Error ! You cannot create recursive Hierarchy of Employees."
-msgstr ""
+msgstr "Fel! Du kan inte skapa omvänd rangordning av anställda."
#. module: hr
#: model:process.process,name:hr.process_process_employeecontractprocess0
diff --git a/addons/hr_timesheet/__openerp__.py b/addons/hr_timesheet/__openerp__.py
index a917ed2df4c..4bd6d3525fc 100644
--- a/addons/hr_timesheet/__openerp__.py
+++ b/addons/hr_timesheet/__openerp__.py
@@ -46,7 +46,8 @@ to set up a management by affair.
'hr_timesheet_wizard.xml',
'process/hr_timesheet_process.xml',
'wizard/hr_timesheet_print_employee_view.xml',
- 'wizard/hr_timesheet_print_users_view.xml'
+ 'wizard/hr_timesheet_print_users_view.xml',
+ 'wizard/hr_timesheet_sign_in_out_view.xml',
],
'demo_xml': ['hr_timesheet_demo.xml'],
'installable': True,
diff --git a/addons/hr_timesheet/hr_timesheet_wizard.xml b/addons/hr_timesheet/hr_timesheet_wizard.xml
index f0a2d7175b3..fa36c03ae10 100644
--- a/addons/hr_timesheet/hr_timesheet_wizard.xml
+++ b/addons/hr_timesheet/hr_timesheet_wizard.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/addons/hr_timesheet/wizard/__init__.py b/addons/hr_timesheet/wizard/__init__.py
index 8619dcbcfea..5f2bc1443e3 100644
--- a/addons/hr_timesheet/wizard/__init__.py
+++ b/addons/hr_timesheet/wizard/__init__.py
@@ -19,7 +19,7 @@
#
##############################################################################
-import sign_in_out
+import hr_timesheet_sign_in_out
import hr_timesheet_print_employee
import hr_timesheet_print_users
diff --git a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py
new file mode 100644
index 00000000000..fa57cfdd1a5
--- /dev/null
+++ b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py
@@ -0,0 +1,169 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# 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 .
+#
+##############################################################################
+import time
+
+from osv import osv, fields
+from tools.translate import _
+
+class hr_so_project(osv.osv_memory):
+ _name = 'hr.sign.out.project'
+ _description = 'Sign Out By Project'
+ _columns = {
+ 'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, domain=[('type','=','normal')]),
+ 'info': fields.char('Work Description', size=256, required=True),
+ 'date_start': fields.datetime('Starting Date', readonly=True),
+ 'date': fields.datetime('Closing Date'),
+ 'analytic_amount': fields.float('Minimum Analytic Amount'),
+ 'name': fields.char('Employees name', size=32, required=True, readonly=True),
+ 'state': fields.char('Current state', size=32, required=True, readonly=True),
+ 'server_date': fields.datetime('Current Date', required=True, readonly=True),
+ 'emp_id': fields.char('Employee ID', size=256, required=False),
+ }
+
+ def _get_empid(self, cr, uid, context=None):
+ emp_obj = self.pool.get('hr.employee')
+ emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
+ if emp_id:
+ employee = emp_obj.read(cr, uid, emp_id)[0]
+ return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
+ raise osv.except_osv(_('UserError'), _('No employee defined for your user !'))
+
+ def _get_empid2(self, cr, uid, context):
+ res = self._get_empid(cr, uid, context)
+ cr.execute('select name,action from hr_attendance where employee_id=%s order by name desc limit 1', (res['emp_id'],))
+ res['server_date'] = time.strftime('%Y-%m-%d %H:%M:%S')
+ res['date_start'] = cr.fetchone()[0]
+ return res
+
+ def default_get(self, cr, uid, fields_list, context=None):
+ res = super(hr_so_project, self).default_get(cr, uid, fields_list, context=context)
+ res.update(self._get_empid2(cr, uid, context=context))
+ return res
+
+ def _write(self, cr, uid, data, emp_id, context=None):
+ timesheet_obj = self.pool.get('hr.analytic.timesheet')
+ emp_obj = self.pool.get('hr.employee')
+ hour = (time.mktime(time.strptime(data['date'] or time.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')) -
+ time.mktime(time.strptime(data['date_start'], '%Y-%m-%d %H:%M:%S'))) / 3600.0
+ minimum = data['analytic_amount']
+ if minimum:
+ hour = round(round((hour + minimum / 2) / minimum) * minimum, 2)
+ res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
+ if not res['product_uom_id']:
+ raise osv.except_osv(_('UserError'), _('No cost unit defined for this employee !'))
+ up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour, res['product_uom_id'])['value']
+ res['name'] = data['info']
+ res['account_id'] = data['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)
+ return timesheet_obj.create(cr, uid, res, context=context)
+
+ def sign_out_result_end(self, cr, uid, ids, context=None):
+ emp_obj = self.pool.get('hr.employee')
+ data = self.read(cr, uid, ids, [])[0]
+ emp_id = data['emp_id']
+ emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out',dt=data['date'])
+ self._write(cr, uid, data, emp_id, context=context)
+ return {}
+
+ def sign_out_result(self, cr, uid, ids, context=None):
+ emp_obj = self.pool.get('hr.employee')
+ data = self.read(cr, uid, ids, [])[0]
+ emp_id = data['emp_id']
+ emp_obj.attendance_action_change(cr, uid, [emp_id], type='action', dt=data['date'])
+ self._write(cr, uid, data, emp_id, context=context)
+ return {}
+
+hr_so_project()
+
+class hr_si_project(osv.osv_memory):
+ _name = 'hr.sign.in.project'
+ _description = 'Sign In By Project'
+ _columns = {
+ 'name': fields.char('Employees name', size=32, required=True, readonly=True),
+ 'state': fields.char('Current state', size=32, required=True, readonly=True),
+ 'date': fields.datetime('Starting Date'),
+ 'server_date': fields.datetime('Current Date', required=True, readonly=True),
+ 'emp_id': fields.char('Employee ID', size=512, required=False),
+ }
+
+ def check_state(self, cr, uid, ids, context=None):
+ obj_model = self.pool.get('ir.model.data')
+ emp_id = self._get_empid(cr, uid, context)['emp_id']
+ # get the latest action (sign_in or out) for this employee
+ cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,))
+ res = (cr.fetchone() or ('sign_out',))[0]
+ #TODO: invert sign_in et sign_out
+ if res == 'sign_out':
+ model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_in')])
+ resource_id = obj_model.read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
+ return {
+ 'name': 'Sign in / Sign out',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'hr.sign.in.project',
+ 'views': [(False,'tree'), (resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new'
+ }
+ else:
+ model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_out')])
+ resource_id = obj_model.read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
+ return {
+ 'name': 'Sign in / Sign out',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'hr.sign.out.project',
+ 'views': [(False,'tree'), (resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new'
+ }
+
+ def _get_empid(self, cr, uid, context=None):
+ emp_obj = self.pool.get('hr.employee')
+ emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
+ if emp_id:
+ employee = emp_obj.read(cr, uid, emp_id)[0]
+ return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
+ raise osv.except_osv(_('UserError'), _('No employee defined for your user !'))
+
+ def sign_in_result(self, cr, uid, ids, context):
+ emp_obj = self.pool.get('hr.employee')
+ data = self.read(cr, uid, ids, [], context)[0]
+ emp_id = data['emp_id']
+ try:
+ success = emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data['date'] or False)
+ except except_osv, e:
+ raise osv.except_osv(e.name, e.value)
+ return {}
+
+ def default_get(self, cr, uid, fields_list, context=None):
+ res = super(hr_si_project, self).default_get(cr, uid, fields_list, context=context)
+ res.update(self._get_empid(cr, uid, context=context))
+ return res
+
+hr_si_project()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out_view.xml b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out_view.xml
new file mode 100644
index 00000000000..487208bfbf6
--- /dev/null
+++ b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out_view.xml
@@ -0,0 +1,95 @@
+
+
+
+
+ hr.sign.in.project.message.form
+ hr.sign.in.project
+ form
+
+
+
+
+
+
+ hr.sign.in.project.form
+ hr.sign.in.project
+ form
+
+
+
+
+
+
+ Sign in / Sign out by project
+ hr.sign.in.project
+ form
+ tree,form
+
+ new
+
+
+
+
+
+ hr.sign.out.project.form
+ hr.sign.out.project
+ form
+
+
+
+
+
+
+ Sign in / Sign out by project
+ hr.sign.out.project
+ form
+ tree,form
+
+ new
+
+
+
+
diff --git a/addons/hr_timesheet/wizard/sign_in_out.py b/addons/hr_timesheet/wizard/sign_in_out.py
deleted file mode 100644
index ff532afc260..00000000000
--- a/addons/hr_timesheet/wizard/sign_in_out.py
+++ /dev/null
@@ -1,174 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-
-import wizard
-import time
-import pooler
-from tools.translate import _
-
-si_form ='''
-'''
-
-si_fields = {
- 'name': {'string': "Employee's name", 'type':'char', 'required':True, 'readonly':True},
- 'state': {'string': "Current state", 'type' : 'char', 'required' : True, 'readonly': True},
- 'date': {'string':"Starting Date", 'type':'datetime'},
- 'server_date': {'string':"Current Date", 'type':'datetime', 'readonly':True},
-}
-
-so_form = '''
-'''
-
-so_fields = {
- 'name': {'string':"Employee's name", 'type':'char', 'required':True, 'readonly':True},
- 'state': {'string':"Current state", 'type':'char', 'required':True, 'readonly':True},
- 'account_id': {'string':"Analytic Account", 'type':'many2one', 'relation':'account.analytic.account', 'required':True, 'domain':"[('type','=','normal')]"},
- 'info': {'string':"Work Description", 'type':'char', 'size':256, 'required':True},
- 'date': {'string':"Closing Date", 'type':'datetime'},
- 'date_start': {'string':"Starting Date", 'type':'datetime', 'readonly':True},
- 'server_date': {'string':"Current Server Date", 'type':'datetime', 'readonly':True},
- 'analytic_amount': {'string':"Minimum Analytic Amount", 'type':'float'},
-}
-
-def _get_empid(self, cr, uid, data, context):
- emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
- emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
- if emp_id:
- employee = emp_obj.read(cr, uid, emp_id)[0]
- return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'date':False, 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
- raise wizard.except_wizard(_('UserError'), _('No employee defined for your user !'))
-
-def _get_empid2(self, cr, uid, data, context):
- res = _get_empid(self,cr, uid, data, context)
- cr.execute('select name,action from hr_attendance where employee_id=%s order by name desc limit 1', (res['emp_id'],))
- res['server_date'] = time.strftime('%Y-%m-%d %H:%M:%S')
- res['date_start'] = cr.fetchone()[0]
- res['info'] = ''
- res['account_id'] = False
- return res
-
-def _sign_in_result(self, cr, uid, data, context):
- emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
- emp_id = data['form']['emp_id']
- from osv.osv import except_osv
- try:
- success = emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data['form']['date'] or False)
- except except_osv, e:
- raise wizard.except_wizard(e.name, e.value)
- return {}
-
-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']
- if minimum:
- hour = round(round((hour + minimum / 2) / minimum) * minimum, 2)
- res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
- if not res['product_uom_id']:
- raise wizard.except_wizard(_('UserError'), _('No cost unit defined for this employee !'))
- up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour, res['product_uom_id'])['value']
- 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)
- return timesheet_obj.create(cr, uid, res, context)
-
-def _sign_out_result_end(self, cr, uid, data, context):
- emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
- emp_id = data['form']['emp_id']
- emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out',dt=data['form']['date'])
- _write(self, cr, uid, data, emp_id, context)
- return {}
-
-def _sign_out_result(self, cr, uid, data, context):
- emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
- emp_id = data['form']['emp_id']
- emp_obj.attendance_action_change(cr, uid, [emp_id], type='action',dt=data['form']['date'])
- _write(self, cr, uid, data, emp_id, context)
- return {}
-
-def _state_check(self, cr, uid, data, context):
- emp_id = _get_empid(self, cr, uid, data, context)['emp_id']
- # get the latest action (sign_in or out) for this employee
- cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,))
- res = (cr.fetchone() or ('sign_out',))[0]
-#TODO: invert sign_in et sign_out
- return res
-
-class wiz_si_so(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [_get_empid],
- 'result' : {'type' : 'choice', 'next_state': _state_check}
- },
- 'sign_out' : { # this means sign_in...
- 'actions' : [_get_empid],
- 'result' : {'type':'form', 'arch':si_form, 'fields' : si_fields, 'state':[('end', 'Cancel'),('si_result', 'Start Working') ] }
- },
- 'si_result' : {
- 'actions' : [_sign_in_result],
- 'result' : {'type':'state', 'state':'end'}
- },
- 'sign_in' : { # this means sign_out...
- 'actions' : [_get_empid2],
- 'result' : {'type':'form', 'arch':so_form, 'fields':so_fields, 'state':[('end', 'Cancel'),('so_result', 'Change Work'),('so_result_end', 'Stop Working') ] }
- },
- 'so_result' : {
- 'actions' : [_sign_out_result],
- 'result' : {'type':'state', 'state':'end'}
- },
- 'so_result_end' : {
- 'actions' : [_sign_out_result_end],
- 'result' : {'type':'state', 'state':'end'}
- },
- }
-wiz_si_so('hr_timesheet.si_so')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/hr_timesheet_invoice/__openerp__.py b/addons/hr_timesheet_invoice/__openerp__.py
index f335c7dbd77..3f4aecb9d3f 100644
--- a/addons/hr_timesheet_invoice/__openerp__.py
+++ b/addons/hr_timesheet_invoice/__openerp__.py
@@ -39,6 +39,7 @@ reports, eso.""",
'hr_timesheet_invoice_report.xml',
'report/report_analytic_view.xml',
'report/hr_timesheet_invoice_report_view.xml',
+ 'wizard/hr_timesheet_invoice_analytic_cost_ledger_view.xml',
],
'demo_xml': ['hr_timesheet_invoice_demo.xml'],
'installable': True,
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
index 5db8bfeb921..bed54ff7d0d 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
@@ -13,7 +13,7 @@
sequence="2" />
-
+
).
#
@@ -15,14 +15,14 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
import hr_timesheet_invoice_create
import account_analytic_profit
import hr_timesheet_final_invoice_create
-import wizard_account_analytic_cost_ledger_report
+import hr_timesheet_analytic_cost_ledger_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_cost_ledger_report.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_cost_ledger_report.py
new file mode 100644
index 00000000000..418aac5edd3
--- /dev/null
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_cost_ledger_report.py
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# 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 .
+#
+##############################################################################
+import time
+
+from osv import osv, fields
+
+class hr_timesheet_analytic_cost_ledger(osv.osv_memory):
+ _name = 'hr.timesheet.analytic.cost.ledger'
+ _description = 'hr.timesheet.analytic.cost.ledger'
+ _columns = {
+ 'date1': fields.date('Start of period', required=True),
+ 'date2': fields.date('End of period', required=True)
+ }
+ _defaults = {
+ 'date1': lambda *a: time.strftime('%Y-01-01'),
+ 'date2': lambda *a: time.strftime('%Y-%m-%d')
+ }
+ def print_report(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
+ datas = {
+ 'ids': 'active_ids' in context and context['active_ids'] or [],
+ 'model': 'account.analytic.account',
+ 'form': self.read(cr, uid, ids)[0]
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'hr.timesheet.invoice.account.analytic.account.cost_ledger',
+ 'datas': datas,
+ }
+
+hr_timesheet_analytic_cost_ledger()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_analytic_cost_ledger_view.xml b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_analytic_cost_ledger_view.xml
new file mode 100644
index 00000000000..c8f9806a309
--- /dev/null
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_analytic_cost_ledger_view.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+ Cost Ledger
+ hr.timesheet.analytic.cost.ledger
+ form
+
+
+
+
+
+
+ Cost Ledger
+ ir.actions.act_window
+ hr.timesheet.analytic.cost.ledger
+ form
+ form
+ new
+
+
+
+
+
+ Cost Ledger
+ client_print_multi
+
+ action
+ account.analytic.account
+
+
+
+
\ No newline at end of file
diff --git a/addons/hr_timesheet_invoice/wizard/wizard_account_analytic_cost_ledger_report.py b/addons/hr_timesheet_invoice/wizard/wizard_account_analytic_cost_ledger_report.py
deleted file mode 100644
index 632f7f84268..00000000000
--- a/addons/hr_timesheet_invoice/wizard/wizard_account_analytic_cost_ledger_report.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import time
-import wizard
-
-dates_form = '''
-'''
-
-dates_fields = {
- 'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
- 'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
-}
-
-class wizard_report(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
- },
- 'report': {
- 'actions': [],
- 'result': {'type':'print', 'report':'hr.timesheet.invoice.account.analytic.account.cost_ledger', 'state':'end'}
- }
- }
-wizard_report('hr.timesheet.invoice.account.analytic.account.cost_ledger.report')
-
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index 3f35913ae75..74e1b5045bf 100755
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -84,7 +84,7 @@ class project_issue(osv.osv):
resource_id = False
if issue.user_id:
resource_ids = res_obj.search(cr, uid, [('user_id','=',issue.user_id.id)])
- resource_id = len(resource_ids) or resource_ids[0]
+ resource_id = len(resource_ids) and resource_ids[0] or False
duration = float(ans.days)
if issue.section_id.resource_calendar_id:
diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index 75f1a4d5e8d..40926ec2aa3 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -17,12 +17,12 @@
-
-
+ name="Incoming Products" parent="menu_procurement_management_inventory" sequence="10"/>