diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 0dc7599f70a..0f0de3f4d21 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -199,7 +199,7 @@ class hr_expense_expense(osv.osv): 'ref': x.get('ref', False), 'quantity': x.get('quantity',1.00), 'product_id': x.get('product_id', False), - 'product_uom_id': x.get('uos_id', False), + 'product_uom_id': x.get('uom_id', False), 'analytic_account_id': x.get('account_analytic_id', False), } @@ -342,7 +342,7 @@ class hr_expense_expense(osv.osv): 'price':line.total_amount, 'account_id':acc.id, 'product_id':line.product_id.id, - 'uos_id':line.uom_id.id, + 'uom_id':line.uom_id.id, 'account_analytic_id':line.analytic_account.id, } @@ -399,7 +399,7 @@ class hr_expense_line(osv.osv): 'total_amount': fields.function(_amount, string='Total', digits=0), 'unit_amount': fields.float('Unit Price', digits_compute=dp.get_precision('Product Price')), 'unit_quantity': fields.float('Quantities', digits_compute= dp.get_precision('Product Unit of Measure')), - 'product_id': fields.many2one('product.product', 'Product', domain=[('hr_expense_ok','=',True)]), + 'product_id': fields.many2one('product.product', 'Product', domain=[('hr_expense_ok','=',True)], required=True), 'uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True), 'description': fields.text('Description'), 'analytic_account': fields.many2one('account.analytic.account','Analytic account'), diff --git a/addons/hr_expense/hr_expense_demo.xml b/addons/hr_expense/hr_expense_demo.xml index 4c3d013294c..85ca7547efd 100644 --- a/addons/hr_expense/hr_expense_demo.xml +++ b/addons/hr_expense/hr_expense_demo.xml @@ -26,7 +26,7 @@ 700.0 700.0 service - Air Ticket + Air Flight AT @@ -50,7 +50,8 @@ Travel Expenses - + + @@ -66,7 +67,7 @@ Travel by Air - + @@ -86,14 +87,14 @@ - Bruxelles - Paris - - - - - - - + Bruxelles - Paris + + + + + + + diff --git a/addons/hr_expense/hr_expense_view.xml b/addons/hr_expense/hr_expense_view.xml index 811cd669dfe..2d382b37f13 100644 --- a/addons/hr_expense/hr_expense_view.xml +++ b/addons/hr_expense/hr_expense_view.xml @@ -13,7 +13,7 @@ - + @@ -94,7 +94,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -130,7 +130,7 @@ - + diff --git a/addons/hr_expense/security/ir.model.access.csv b/addons/hr_expense/security/ir.model.access.csv index c3f7b604da9..bfc865a5243 100644 --- a/addons/hr_expense/security/ir.model.access.csv +++ b/addons/hr_expense/security/ir.model.access.csv @@ -12,7 +12,6 @@ access_account_journal_user,account.journal.user,account.model_account_journal,b access_account_journal_employee,account.journal.employee,account.model_account_journal,base.group_user,1,0,0,0 access_account_invoice_user,account.invoice.user,account.model_account_invoice,base.group_hr_user,1,1,1,1 access_account_invoice_line_user,account.invoice.line.user,account.model_account_invoice_line,base.group_hr_user,1,1,1,1 -access_account_analytic_journal_user,account.ianalytic.journal.user,analytic.model_account_analytic_journal,base.group_hr_user,1,1,1,1 access_account_invoice_tax_user,account.invoice.tax.user,account.model_account_invoice_tax,base.group_hr_user,1,1,1,1 access_account_move_user,account.move.user,account.model_account_move,base.group_hr_user,1,1,1,1 access_account_move_line_user,account.move.line.user,account.model_account_move_line,base.group_hr_user,1,1,1,1 diff --git a/addons/hr_expense/test/expense_demo.yml b/addons/hr_expense/test/expense_demo.yml index 06ea4265a1f..cae5817d9a2 100644 --- a/addons/hr_expense/test/expense_demo.yml +++ b/addons/hr_expense/test/expense_demo.yml @@ -2,10 +2,7 @@ !record {model: hr.expense.expense, id: sep_expenses}: employee_id: hr.employee_mit name : 'John Smith' -- - !record {model: product.product, id: car_travel}: - hr_expense_ok: 'True' - !record {model: hr.expense.line, id: expense_line}: - product_id: car_travel + product_id: hr_expense.car_travel name: 'Car Travel Expenses' diff --git a/addons/hr_expense/views/report_expense.xml b/addons/hr_expense/views/report_expense.xml index 5bb2e1dd8e2..53f120f8b09 100644 --- a/addons/hr_expense/views/report_expense.xml +++ b/addons/hr_expense/views/report_expense.xml @@ -44,7 +44,7 @@
- + diff --git a/addons/hr_timesheet/__openerp__.py b/addons/hr_timesheet/__openerp__.py index 13bb7df9426..0eb4c7dcf7a 100644 --- a/addons/hr_timesheet/__openerp__.py +++ b/addons/hr_timesheet/__openerp__.py @@ -27,11 +27,9 @@ up a management by affair. 'hr_timesheet_view.xml', 'report/hr_timesheet_report_view.xml', 'hr_timesheet_installer.xml', - 'hr_timesheet_data.xml', 'hr_dashboard.xml', ], 'demo': [ - 'hr_timesheet_demo.xml', 'hr_timesheet_demo.yml', ], 'test': [ diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index 2877dabd8f4..b83d3c4bb74 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -1,149 +1,15 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from openerp import models, api, fields, exceptions - -from openerp.tools.translate import _ - - -class HrEmployee(models.Model): - _inherit = "hr.employee" - - @api.model - def _get_default_analytic_journal(self): - # We need the "or ..." because we need an empty recordset of the right type, 'False' is not enough. - return self.env.ref('hr_timesheet.analytic_journal', raise_if_not_found=False) or self.env['account.analytic.journal'] - - product_id = fields.Many2one('product.product', 'Product', help="If you want to reinvoice working time of employees, link this employee to a service to determinate the cost price of the job.") - journal_id = fields.Many2one('account.analytic.journal', 'Analytic Journal', default=_get_default_analytic_journal) - uom_id = fields.Many2one('product.uom', related='product_id.uom_id', string='Unit of Measure', store=True, readonly=True) +from openerp import models, fields +class Company(models.Model): + _inherit = 'res.company' class account_analytic_line(models.Model): _inherit = 'account.analytic.line' - - is_timesheet = fields.Boolean() - - @api.model - def _get_employee_product(self, user_id=None): - emp = self.env['hr.employee'].search([('user_id', '=', user_id or self.env.uid)], limit=1) - if emp and emp.product_id.id: - return emp.product_id.id - else: - return None - - @api.model - def _get_employee_unit(self, user_id=None): - emp = self.env['hr.employee'].search([('user_id', '=', user_id or self.env.uid)], limit=1) - if emp and emp.product_id.uom_id.id: - return emp.product_id.uom_id.id - else: - return None - - @api.model - def _get_general_account(self, user_id=None): - emp = self.env['hr.employee'].search([('user_id', '=', user_id or self.env.uid)], limit=1) - if emp and emp.product_id.categ_id.property_account_expense_categ_id.id: - return emp.product_id.categ_id.property_account_expense_categ_id.id - else: - return None - - @api.model - def _get_analytic_journal(self, user_id=None): - emp = self.env['hr.employee'].search([('user_id', '=', user_id or self.env.uid)], limit=1) - if emp and emp.journal_id.id: - return emp.journal_id.id - else: - journal = self.env['account.analytic.journal'].search([('type', '=', 'general')], limit=1) - - if journal: - return journal.id - else: - return None - - @api.onchange('user_id') - def V8_on_change_user_id(self): - new_values = self.on_change_user_id(self.user_id.id, self.is_timesheet) - if new_values.get("value"): - for key, value in new_values["value"].iteritems(): - setattr(self, key, value) - - def on_change_user_id(self, cr, uid, ids, user_id, is_timesheet=False, context=None): - if not is_timesheet or not user_id: - return {} - res = {"value": { - 'journal_id': self._get_analytic_journal(cr, uid, user_id, context=context), - 'product_id': self._get_employee_product(cr, uid, user_id, context=context), - 'uom_id': self._get_employee_unit(cr, uid, user_id, context=context), - 'general_account_id': self._get_general_account(cr, uid, user_id, context=context) - } - } - return res - - def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, company_id, unit=False, journal_id=False, context=None): - res = {'value': {}} - if unit_amount: - # find company - company_id = self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=context) - r = super(account_analytic_line, self).on_change_unit_amount(cr, uid, id, prod_id, unit_amount, company_id, unit, journal_id, context=context) - if r: - res.update(r) - # update unit of measurement - if prod_id: - uom = self.pool.get('product.product').browse(cr, uid, prod_id, context=context) - if uom.uom_id: - res['value'].update({'product_uom_id': uom.uom_id.id}) - else: - res['value'].update({'product_uom_id': False}) - return res - - @api.onchange('date') - def on_change_date(self): - if self.is_timesheet and self._origin.date and (self._origin.date != self.date): - raise exceptions.Warning(_('Changing the date will let this entry appear in the timesheet of the new date.')) - - @api.model - def create(self, values): - if values.get('is_timesheet'): - if not values.get('product_id'): - values['product_id'] = self._get_employee_product() - if not values.get('product_uom_id'): - values['product_uom_id'] = self._get_employee_unit() - if not values.get('general_account_id'): - values['general_account_id'] = self._get_general_account() - if not values.get('journal_id'): - values['journal_id'] = self._get_analytic_journal() - return super(account_analytic_line, self).create(values) - + is_timesheet = fields.Boolean(string="Is a Timesheet") class account_analytic_account(models.Model): _inherit = 'account.analytic.account' - use_timesheets = fields.Boolean('Timesheets', help="Check this field if this project manages timesheets", deprecated=True) - invoice_on_timesheets = fields.Boolean('Timesheets', help="Check this field if this project manages timesheets") - - @api.onchange('invoice_on_timesheets') - def onchange_invoice_on_timesheets(self): - result = {'value': {}} - if not self.invoice_on_timesheets: - return {'value': {'to_invoice': False}} - try: - to_invoice = self.env['ir.model.data'].xmlid_to_res_id('hr_timesheet_invoice.timesheet_invoice_factor1') - result['value']['to_invoice'] = to_invoice - except ValueError: - pass - return result - - @api.onchange('template_id') - def V8_on_change_template(self): - new_values = self.on_change_template(selftemplate_id.id, self.date_start) - if new_values.get("value"): - for key, value in new_values["value"].iteritems(): - setattr(self, key, value) - - def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None): - res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context) - if template_id and 'value' in res: - template = self.browse(cr, uid, template_id, context=context) - res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets - return res diff --git a/addons/hr_timesheet/hr_timesheet_data.xml b/addons/hr_timesheet/hr_timesheet_data.xml deleted file mode 100644 index 35d6bfb0185..00000000000 --- a/addons/hr_timesheet/hr_timesheet_data.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - TS - Timesheet Journal - general - - - - - diff --git a/addons/hr_timesheet/hr_timesheet_demo.xml b/addons/hr_timesheet/hr_timesheet_demo.xml deleted file mode 100644 index faec6e306ca..00000000000 --- a/addons/hr_timesheet/hr_timesheet_demo.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - True - - - True - - - True - - - True - - - diff --git a/addons/hr_timesheet/hr_timesheet_demo.yml b/addons/hr_timesheet/hr_timesheet_demo.yml index 530df19cf9e..53545ab778e 100644 --- a/addons/hr_timesheet/hr_timesheet_demo.yml +++ b/addons/hr_timesheet/hr_timesheet_demo.yml @@ -3,70 +3,58 @@ - !python {model: ir.model.data} : | import time - expense_account_id = self.pool.get('account.account').search(cr, uid, [('user_type_id', '=', ref('account.data_account_type_expenses'))]) - if expense_account_id: - vals = { - 'name': 'Requirements analysis and specification', - 'user_id': ref('base.user_root'), - 'date': time.strftime('%Y-%m-%d'), - 'unit_amount': 2.00, - 'product_id': ref('product.product_product_1'), - 'product_uom_id': ref('product.product_uom_hour'), - 'account_id': ref('analytic.analytic_administratif'), - 'amount': -60.00, - 'general_account_id': expense_account_id[0], - 'journal_id': ref('analytic_journal') - } - self._update(cr, uid, 'account.analytic.line', 'hr_timesheet', vals, 'working_hours_requirements') - vals = { - 'name': 'Design and specification', - 'user_id': ref('base.user_root'), - 'date': time.strftime('%Y-%m-%d'), - 'unit_amount': 1.00, - 'product_id': ref('product.product_product_1'), - 'product_uom_id': ref('product.product_uom_hour'), - 'account_id': ref('analytic.analytic_administratif'), - 'amount': -30.00, - 'general_account_id': expense_account_id[0], - 'journal_id': ref('analytic_journal') - } - self._update(cr, uid, 'account.analytic.line', 'hr_timesheet', vals, 'working_hours_design') - vals = { - 'name': 'Coding and module testing', - 'user_id': ref('base.user_root'), - 'date': time.strftime('%Y-%m-%d'), - 'unit_amount': 3.00, - 'product_id': ref('product.product_product_1'), - 'product_uom_id': ref('product.product_uom_hour'), - 'account_id': ref('analytic.analytic_administratif'), - 'amount': -90.00, - 'general_account_id': expense_account_id[0], - 'journal_id': ref('analytic_journal') - } - self._update(cr, uid, 'account.analytic.line', 'hr_timesheet', vals, 'working_hours_coding') - vals = { - 'name': 'Integration and system testing', - 'user_id': ref('base.user_root'), - 'date': time.strftime('%Y-%m-%d'), - 'unit_amount': 1.00, - 'product_id': ref('product.product_product_1'), - 'product_uom_id': ref('product.product_uom_hour'), - 'account_id': ref('analytic.analytic_administratif'), - 'amount': -30.00, - 'general_account_id': expense_account_id[0], - 'journal_id': ref('analytic_journal') - } - self._update(cr, uid, 'account.analytic.line', 'hr_timesheet', vals, 'working_hours_testing') - vals = { - 'name': 'Delivery and maintenance', - 'user_id': ref('base.user_root'), - 'date': time.strftime('%Y-%m-%d'), - 'unit_amount': 1.00, - 'product_id': ref('product.product_product_1'), - 'product_uom_id': ref('product.product_uom_hour'), - 'account_id': ref('analytic.analytic_administratif'), - 'amount': -30.00, - 'general_account_id': expense_account_id[0], - 'journal_id': ref('analytic_journal') - } - self._update(cr, uid, 'account.analytic.line', 'hr_timesheet', vals, 'working_hours_maintenance') + vals = { + 'name': 'Requirements analysis and specification', + 'user_id': ref('base.user_root'), + 'date': time.strftime('%Y-%m-%d'), + 'unit_amount': 2.00, + 'product_id': ref('product.product_product_1'), + 'product_uom_id': ref('product.product_uom_hour'), + 'account_id': ref('analytic.analytic_administratif'), + 'amount': -60.00, + } + self._update(cr, uid, 'account.analytic.line', 'hr_timesheet', vals, 'working_hours_requirements') + vals = { + 'name': 'Design and specification', + 'user_id': ref('base.user_root'), + 'date': time.strftime('%Y-%m-%d'), + 'unit_amount': 1.00, + 'product_id': ref('product.product_product_1'), + 'product_uom_id': ref('product.product_uom_hour'), + 'account_id': ref('analytic.analytic_administratif'), + 'amount': -30.00, + } + self._update(cr, uid, 'account.analytic.line', 'hr_timesheet', vals, 'working_hours_design') + vals = { + 'name': 'Coding and module testing', + 'user_id': ref('base.user_root'), + 'date': time.strftime('%Y-%m-%d'), + 'unit_amount': 3.00, + 'product_id': ref('product.product_product_1'), + 'product_uom_id': ref('product.product_uom_hour'), + 'account_id': ref('analytic.analytic_administratif'), + 'amount': -90.00, + } + self._update(cr, uid, 'account.analytic.line', 'hr_timesheet', vals, 'working_hours_coding') + vals = { + 'name': 'Integration and system testing', + 'user_id': ref('base.user_root'), + 'date': time.strftime('%Y-%m-%d'), + 'unit_amount': 1.00, + 'product_id': ref('product.product_product_1'), + 'product_uom_id': ref('product.product_uom_hour'), + 'account_id': ref('analytic.analytic_administratif'), + 'amount': -30.00, + } + self._update(cr, uid, 'account.analytic.line', 'hr_timesheet', vals, 'working_hours_testing') + vals = { + 'name': 'Delivery and maintenance', + 'user_id': ref('base.user_root'), + 'date': time.strftime('%Y-%m-%d'), + 'unit_amount': 1.00, + 'product_id': ref('product.product_product_1'), + 'product_uom_id': ref('product.product_uom_hour'), + 'account_id': ref('analytic.analytic_administratif'), + 'amount': -30.00, + } + self._update(cr, uid, 'account.analytic.line', 'hr_timesheet', vals, 'working_hours_maintenance') diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml index 95054979f34..2f15ff8bb19 100644 --- a/addons/hr_timesheet/hr_timesheet_view.xml +++ b/addons/hr_timesheet/hr_timesheet_view.xml @@ -11,13 +11,8 @@ - - - - - - - + + @@ -43,18 +38,16 @@ - + - + - - @@ -81,58 +74,12 @@
- - {'search_default_group_date': 1, 'search_default_group_journal': 1} - [('account_id','child_of', active_id)] - Costs & Revenues - account.analytic.line - account.analytic.account - tree,form - tree - -

- No activity yet on this contract. -

- In Odoo, contracts and projects are implemented using - analytic account. So, you can track costs and revenues to analyse - your margins easily. -

- Costs will be created automatically when you register supplier - invoices, expenses or timesheets. -

- Revenues will be created automatically when you create customer - invoices. Customer invoices can be created based on sale orders - (fixed price invoices), on timesheets (based on the work done) or - on expenses (e.g. reinvoicing of travel costs). -

-
-
- - - - account.analytic.account.invoice.form - account.analytic.account - - - - - -
-
-
-
- Timesheet Accounts ir.actions.act_window account.analytic.account form tree,form - [('invoice_on_timesheets','=', True)] - {'default_invoice_on_timesheets':1} - - hr.timesheet.employee.extd_form - hr.employee - - - - - - - - - - diff --git a/addons/hr_timesheet/report/hr_timesheet_report.py b/addons/hr_timesheet/report/hr_timesheet_report.py index 213ed776c3c..0644cc16d61 100644 --- a/addons/hr_timesheet/report/hr_timesheet_report.py +++ b/addons/hr_timesheet/report/hr_timesheet_report.py @@ -11,8 +11,6 @@ class hr_timesheet_report(models.Model): date = fields.Date('Date', readonly=True) name = fields.Char('Description', readonly=True) product_id = fields.Many2one('product.product', 'Product', readonly=True) - journal_id = fields.Many2one('account.analytic.journal', 'Journal', readonly=True) - general_account_id = fields.Many2one('account.account', 'General Account', readonly=True) user_id = fields.Many2one('res.users', 'User', readonly=True) account_id = fields.Many2one('account.analytic.account', 'Analytic Account', readonly=True) company_id = fields.Many2one('res.company', 'Company', readonly=True) @@ -26,9 +24,7 @@ class hr_timesheet_report(models.Model): sum(aal.amount) as cost, sum(aal.unit_amount) as quantity, aal.account_id as account_id, - aal.journal_id as journal_id, aal.product_id as product_id, - aal.general_account_id as general_account_id, aal.user_id as user_id, aal.company_id as company_id, aal.currency_id as currency_id @@ -46,8 +42,6 @@ class hr_timesheet_report(models.Model): GROUP BY aal.date, aal.account_id, aal.product_id, - aal.general_account_id, - aal.journal_id, aal.user_id, aal.company_id, aal.currency_id diff --git a/addons/hr_timesheet/report/hr_timesheet_report_view.xml b/addons/hr_timesheet/report/hr_timesheet_report_view.xml index 30584e848e4..3769e89255c 100644 --- a/addons/hr_timesheet/report/hr_timesheet_report_view.xml +++ b/addons/hr_timesheet/report/hr_timesheet_report_view.xml @@ -35,9 +35,7 @@ - - diff --git a/addons/hr_timesheet/security/ir.model.access.csv b/addons/hr_timesheet/security/ir.model.access.csv index f51d12df530..692ecbe0a7f 100644 --- a/addons/hr_timesheet/security/ir.model.access.csv +++ b/addons/hr_timesheet/security/ir.model.access.csv @@ -1,10 +1,8 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_hr_account_analytic_line,account.account.analytic.line,account.model_account_analytic_line,base.group_hr_user,1,1,1,1 access_hr_account_analytic_line_employee,account.account.analytic.line employee,account.model_account_analytic_line,base.group_user,1,1,1,1 -access_account_analytic_journal,account.account.analytic.journal,analytic.model_account_analytic_journal,base.group_hr_user,1,1,1,1 access_product_product_user,product.product user,product.model_product_product,base.group_hr_user,1,1,1,1 access_product_template_hr_timesheet,product.template.hr.timesheet,product.model_product_template,base.group_hr_user,1,1,1,1 access_product_uom_hr_timesheet,product.uom.hr.timesheet,product.model_product_uom,base.group_hr_user,1,1,1,1 access_account_analytic_line_user,account.analytic.line.user,model_account_analytic_line,base.group_user,1,1,1,0 -access_account_analytic_journal_user,account.account.analytic.journal.user,analytic.model_account_analytic_journal,base.group_user,1,0,0,0 access_hr_timesheet_report,hr.timesheet.report,model_hr_timesheet_report,base.group_hr_manager,1,1,0,0 diff --git a/addons/hr_timesheet_sheet/__openerp__.py b/addons/hr_timesheet_sheet/__openerp__.py index d09c1db1812..678a44960e9 100644 --- a/addons/hr_timesheet_sheet/__openerp__.py +++ b/addons/hr_timesheet_sheet/__openerp__.py @@ -26,7 +26,7 @@ The validation can be configured in the company: * Maximal difference between timesheet and attendances """, 'website': 'https://www.odoo.com/page/employees', - 'depends': ['hr_timesheet', 'hr_timesheet_invoice'], + 'depends': ['hr_timesheet'], 'data': [ 'security/ir.model.access.csv', 'security/hr_timesheet_sheet_security.xml', diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 30c09356495..d98f29f251e 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -52,8 +52,6 @@ class hr_timesheet_sheet(osv.osv): if 'employee_id' in vals: if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id'], context=context).user_id: raise UserError(_('In order to create a timesheet for this employee, you must link him/her to a user.')) - if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id'], context=context).journal_id: - raise UserError(_('In order to create a timesheet for this employee, you must assign an analytic journal to the employee, like \'Timesheet Journal\'.')) if vals.get('attendances_ids'): # If attendances, we sort them by date asc before writing them, to satisfy the alternance constraint vals['attendances_ids'] = self.sort_attendances(cr, uid, vals['attendances_ids'], context=context) @@ -68,8 +66,6 @@ class hr_timesheet_sheet(osv.osv): raise UserError(_('You cannot have 2 timesheets that overlap!\nYou should use the menu \'My Timesheet\' to avoid this problem.')) if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id'], context=context).product_id: raise UserError(_('In order to create a timesheet for this employee, you must link the employee to a product.')) - if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id'], context=context).journal_id: - raise UserError(_('In order to create a timesheet for this employee, you must assign an analytic journal to the employee, like \'Timesheet Journal\'.')) if vals.get('attendances_ids'): # If attendances, we sort them by date asc before writing them, to satisfy the alternance constraint # In addition to the date order, deleting attendances are done before inserting attendances @@ -587,11 +583,10 @@ class hr_timesheet_sheet_sheet_account(osv.osv): 'name': fields.many2one('account.analytic.account', 'Project / Analytic Account', readonly=True), 'sheet_id': fields.many2one('hr_timesheet_sheet.sheet', 'Sheet', readonly=True), 'total': fields.float('Total Time', digits=(16,2), readonly=True), - 'invoice_rate': fields.many2one('hr_timesheet_invoice.factor', 'Invoice rate', readonly=True), } _depends = { - 'account.analytic.line': ['account_id', 'date', 'to_invoice', 'unit_amount', 'user_id'], + 'account.analytic.line': ['account_id', 'date', 'unit_amount', 'user_id'], 'hr_timesheet_sheet.sheet': ['date_from', 'date_to', 'user_id'], } @@ -601,15 +596,14 @@ class hr_timesheet_sheet_sheet_account(osv.osv): min(l.id) as id, l.account_id as name, s.id as sheet_id, - sum(l.unit_amount) as total, - l.to_invoice as invoice_rate + sum(l.unit_amount) as total from account_analytic_line l LEFT JOIN hr_timesheet_sheet_sheet s ON (s.date_to >= l.date AND s.date_from <= l.date AND s.user_id = l.user_id) - group by l.account_id, s.id, l.to_invoice + group by l.account_id, s.id )""") diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 7f7d8b729bd..9bf04bc2560 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -11,7 +11,6 @@ - @@ -22,7 +21,6 @@ - @@ -35,7 +33,6 @@ - @@ -130,27 +127,17 @@ - + - - - - - - - +
- + - - - - - + @@ -387,7 +374,7 @@ hr.timesheet.sheet.employee.extd_form hr.employee - +