From df4c619986fa6efe3090c9d33a9be4fff1beb2b1 Mon Sep 17 00:00:00 2001 From: "pap (openerp)" Date: Tue, 8 Jun 2010 14:44:47 +0530 Subject: [PATCH 1/2] [IMP]:added menus for working hours in hr.timesheet and put fields.selection on uos in invoice line in account.invoice bzr revid: pap@tinyerp.co.in-20100608091447-kc2o31rijy0a2l1h --- addons/account/account_invoice_view.xml | 2 +- addons/account/invoice.py | 18 ++++++++++++++++-- addons/hr_timesheet/hr_timesheet_view.xml | 5 ++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 263c711dfff..eda507508e4 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -53,7 +53,7 @@ - + diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 5ef80d40560..848fa72b3b5 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -1300,7 +1300,7 @@ class account_invoice_line(osv.osv): result['name'] = res.partner_ref domain = {} - result['uos_id'] = uom or res.uom_id.id or False + result['uos_id'] = res.uom_id.id or uom or False if result['uos_id']: res2 = res.uom_id.category_id.id if res2 : @@ -1323,8 +1323,22 @@ class account_invoice_line(osv.osv): if company.currency_id.id != currency.id: new_price = res_final['value']['price_unit'] * currency.rate res_final['value']['price_unit'] = new_price + + if uom: + uom = self.pool.get('product.uom').browse(cr, uid, uom, context=context) + if res.uom_id.category_id.id == uom.category_id.id: + new_price=res_final['value']['price_unit']*uom.factor_inv + res_final['value']['price_unit'] = new_price return res_final - + + def uos_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): + res = self.product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context) + if 'uos_id' in res['value']: + del res['value']['uos_id'] + if not uom: + res['value']['price_unit'] = 0.0 + return res + def move_line_get(self, cr, uid, invoice_id, context=None): res = [] tax_grouped = {} diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml index 947f0d34c41..3b54631415e 100644 --- a/addons/hr_timesheet/hr_timesheet_view.xml +++ b/addons/hr_timesheet/hr_timesheet_view.xml @@ -83,7 +83,10 @@ tree,form - + + + + hr.timesheet.employee.extd_form hr.employee From 44bb287a487ed4803c0d089a904cf4a3d530749f Mon Sep 17 00:00:00 2001 From: "pap (openerp)" Date: Tue, 8 Jun 2010 14:59:33 +0530 Subject: [PATCH 2/2] [IMP]:widget=selection on uos_id field bzr revid: pap@tinyerp.co.in-20100608092933-3704rham6sl9rz5w --- addons/account/account_invoice_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index eda507508e4..51a020b9b75 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -53,7 +53,7 @@ - +