diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py index 7a66dd4f175..bb13f1a5776 100644 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -75,6 +75,9 @@ class account_analytic_line(osv.osv): unit=False, journal_id=False, context=None): if context==None: context={} + if not journal_id: + j_ids = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=','purchase')]) + j_id = j_ids and j_ids[0] or False if not journal_id or not prod_id: return {} product_obj = self.pool.get('product.product') @@ -86,7 +89,7 @@ class account_analytic_line(osv.osv): result = 0.0 is_purchase = False - if j_id.type == 'purchase': + if j_id.type <> 'sale': a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id diff --git a/addons/account/project/project.py b/addons/account/project/project.py index 431d486592b..f082672310e 100644 --- a/addons/account/project/project.py +++ b/addons/account/project/project.py @@ -28,8 +28,8 @@ from osv import osv class account_analytic_journal(osv.osv): _name = 'account.analytic.journal' _columns = { - 'name' : fields.char('Journal name', size=64, required=True), - 'code' : fields.char('Journal code', size=8), + 'name' : fields.char('Journal Name', size=64, required=True), + 'code' : fields.char('Journal Code', size=8), 'active' : fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the analytic journal without removing it."), 'type': fields.selection([('sale','Sale'), ('purchase','Purchase'), ('cash','Cash'), ('general','General'), ('situation','Situation')], 'Type', size=32, required=True, help="Gives the type of the analytic journal. When it needs for a document (eg: an invoice) to create analytic entries, OpenERP will look for a matching journal of the same type."), 'line_ids' : fields.one2many('account.analytic.line', 'journal_id', 'Lines'), diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index 0d335118d3b..fd52619fb10 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -172,19 +172,16 @@ tree - + + - - - - - - - - - - - + + + + + + + @@ -195,22 +192,24 @@ - - + + + - - - - - - + + + + + + - - + + + - + diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 0bb9afc3386..21fe0a7da29 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -99,7 +99,7 @@ class hr_analytic_timesheet(osv.osv): (r.product_id.name, r.product_id.id,)) # Compute based on pricetype amount_unit = self.on_change_unit_amount(cr, uid, ids, - r.product_id.id, unit_amount, r.product_id.uom_id.id)['value']['amount'] + r.product_id.id, unit_amount, False, r.product_id.uom_id.id)['value']['amount'] amount = unit_amount * amount_unit res ['value']['amount']= - round(amount, 2) @@ -134,7 +134,7 @@ class hr_analytic_timesheet(osv.osv): (r.product_id.name, r.product_id.id,)) # Compute based on pricetype amount_unit = self.on_change_unit_amount(cr, uid, ids, - r.product_id.id, unit_amount, r.product_id.uom_id.id)['value']['amount'] + r.product_id.id, unit_amount, False, r.product_id.uom_id.id)['value']['amount'] amount = unit_amount * amount_unit res ['value']['amount']= - round(amount, 2) diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index ee4abdb35c4..75ad6101e11 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -57,14 +57,14 @@ class hr_analytic_timesheet(osv.osv): return super(hr_analytic_timesheet, self).unlink(cr, uid, ids, context=context) - def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, unit, context=None): + def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, company_id, unit=False, journal_id=False, context=None): if context is None: context = {} res = {'value':{}} if prod_id and unit_amount: # find company company_id = self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=context) - res.update(self.pool.get('account.analytic.line').on_change_unit_amount(cr, uid, id, prod_id, unit_amount, company_id, unit, context=context)) + res.update(self.pool.get('account.analytic.line').on_change_unit_amount(cr, uid, id, prod_id, unit_amount, company_id, unit, journal_id, context=context)) # update unit of measurement if prod_id: uom = self.pool.get('product.product').browse(cr, uid, prod_id, context=context) diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml index 4165f71d73f..a47fbf24685 100644 --- a/addons/hr_timesheet/hr_timesheet_view.xml +++ b/addons/hr_timesheet/hr_timesheet_view.xml @@ -12,16 +12,17 @@ tree - - + + - - - - - - + + + + + + + @@ -40,9 +41,9 @@ - - - + + + @@ -67,7 +68,7 @@ - + @@ -81,32 +82,20 @@ - - + + - - My Working Hours - ir.actions.act_window - hr.analytic.timesheet - form - tree,form - [('user_id','=',uid)] - - {"search_default_user_id":uid, "search_default_my": 1} - - - Working Hours ir.actions.act_window hr.analytic.timesheet form tree,form - {"search_default_user_id":uid} + {"search_default_user_id":uid, "search_default_today":1} This functionality gives you a list of work done by user, product and analytic account (or project). A search tool allows you to make fine-grained analysis. diff --git a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py index 9b990556218..88b094f97cc 100644 --- a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py +++ b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py @@ -81,7 +81,7 @@ class hr_so_project(osv.osv_memory): 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'] + up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour,False, res['product_uom_id'])['value'] res['name'] = data['info'] res['account_id'] = data['account_id'].id diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml index c7435127466..4beda0999d0 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml @@ -21,17 +21,6 @@ - hr.analytic.timesheet.form hr.analytic.timesheet @@ -83,13 +72,26 @@ + + account.analytic.line.search.to_invoice + account.analytic.line + search + + + + + + + + + account.analytic.line.tree.to_invoice account.analytic.line tree - + @@ -103,18 +105,19 @@ + - Entries to invoice + Costs to Invoice account.analytic.line form tree,form - [('to_invoice','<>',False)] - {"search_default_user_id":uid} + [] + {'search_default_to_invoice': 1} OpenERP automatically group the entries to be invoiced so you can keep an eye on them on real time in one glance. - - Uninvoiced Entries - account.analytic.line - form - tree,form - [('invoice_id','=',False),('to_invoice','!=',False)] - - - - - Open Analytic Accounts - account.analytic.account - form - tree,form - [('state','<>','close'),('type','<>','view')] - - - - Unclosed Invoiceable Accounts - account.analytic.account - form - tree,form - [('state','<>','close'),('type','<>','view'),('pricelist_id','<>',False)] - - hr_timesheet_invoice.factor.form hr_timesheet_invoice.factor diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index 4e1926fe069..1bb7765b372 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -38,7 +38,7 @@ class hr_timesheet_invoice_create(osv.osv_memory): 'accounts': fields.many2many('account.analytic.account', 'invoice_id', 'account_id', 'Analytic Accounts', required=True), 'date': fields.boolean('Date', help='The real date of each work will be displayed on the invoice'), 'time': fields.boolean('Time spent', help='The time of each work done will be displayed on the invoice'), - 'name': fields.boolean('Name of entry', help='The detail of each work done will be displayed on the invoice'), + 'name': fields.boolean('Description', help='The detail of each work done will be displayed on the invoice'), 'price': fields.boolean('Cost', help='The cost of each work done will be displayed on the invoice. You probably don\'t want to check this'), 'product': fields.many2one('product.product', 'Product', help='Complete this field only if you want to force to use a specific product. Keep empty to use the real product that comes from the cost.'), } @@ -59,8 +59,10 @@ class hr_timesheet_invoice_create(osv.osv_memory): return [x[0] for x in account_ids] _defaults = { - 'accounts': _get_accounts - } + 'accounts': _get_accounts, + 'date': lambda *args: 1, + 'name': lambda *args: 1 + } def do_create(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_view.xml b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_view.xml index a0b20e5ff97..fc6d6da911e 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_view.xml +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_view.xml @@ -2,37 +2,33 @@ - + hr.timesheet.invoice.create.form hr.timesheet.invoice.create form -
- - - - - - - - - - - - - - - - - - - - -