From ec6815cac2a6229b0f29be74ebc5360606115dd6 Mon Sep 17 00:00:00 2001 From: Hardik Date: Tue, 28 Aug 2012 16:50:05 +0530 Subject: [PATCH 1/6] [IMP]Sale module improved bzr revid: hsa@tinyerp.com-20120828112005-r1atqht06r5pxh8k --- .../account_analytic_analysis/account_analytic_analysis.py | 2 +- addons/crm/res_config_view.xml | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index c84b311f307..dff41fd9584 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -465,7 +465,7 @@ class account_analytic_account(osv.osv): def open_sale_order_lines(self,cr,uid,ids,context=None): if context is None: context = {} - sale_ids = self.pool.get('sale.order').search(cr,uid,[('project_id','=',context.get('search_default_project_id',False)),('partner_id','=',context.get('search_default_partner_id',False))]) + sale_ids = self.pool.get('sale.order').search(cr,uid,[('project_id','=',context.get('search_default_project_id',False))]) names = [record.name for record in self.browse(cr, uid, ids, context=context)] name = _('Sale Order Lines of %s') % ','.join(names) return { diff --git a/addons/crm/res_config_view.xml b/addons/crm/res_config_view.xml index 3ab9ac8a32c..56d46140d2f 100644 --- a/addons/crm/res_config_view.xml +++ b/addons/crm/res_config_view.xml @@ -32,12 +32,6 @@ -
-
- -
-
From 91d7b2e168a5c9754e771f058b763357bb1c4a73 Mon Sep 17 00:00:00 2001 From: Hardik Date: Wed, 29 Aug 2012 16:58:40 +0530 Subject: [PATCH 2/6] [IMP]Sale : Contract allowed timesheet, click on the link all timesheet and create a new entry bzr revid: hsa@tinyerp.com-20120829112840-9vw1git194zc68eo --- addons/hr_timesheet/hr_timesheet_view.xml | 6 +++--- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml index d364d605b5f..af6d2114211 100644 --- a/addons/hr_timesheet/hr_timesheet_view.xml +++ b/addons/hr_timesheet/hr_timesheet_view.xml @@ -9,14 +9,14 @@ - + - + - + diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index 4cba4a18680..2d59a3779c6 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -129,15 +129,18 @@ class account_analytic_line(osv.osv): def _default_journal(self, cr, uid, context=None): proxy = self.pool.get('hr.employee') record_ids = proxy.search(cr, uid, [('user_id', '=', uid)], context=context) - employee = proxy.browse(cr, uid, record_ids[0], context=context) - return employee.journal_id and employee.journal_id.id or False + if record_ids: + employee = proxy.browse(cr, uid, record_ids[0], context=context) + return employee.journal_id and employee.journal_id.id or False + return False def _default_general_account(self, cr, uid, context=None): proxy = self.pool.get('hr.employee') record_ids = proxy.search(cr, uid, [('user_id', '=', uid)], context=context) - employee = proxy.browse(cr, uid, record_ids[0], context=context) - if employee.product_id and employee.product_id.property_account_income: - return employee.product_id.property_account_income.id + if record_ids: + employee = proxy.browse(cr, uid, record_ids[0], context=context) + if employee.product_id and employee.product_id.property_account_income: + return employee.product_id.property_account_income.id return False _defaults = { From 7d4264b0e6e391ab21718c31c60b4a3f32466242 Mon Sep 17 00:00:00 2001 From: "pso (OpenERP)" Date: Fri, 31 Aug 2012 14:32:56 +0530 Subject: [PATCH 3/6] [IMP] Raised exception if no employee defined for user bzr revid: pso@tinyerp.com-20120831090256-fr78rip32awurwjv --- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index 4cba4a18680..0d0e5c2d1eb 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -125,17 +125,25 @@ class account_analytic_line(osv.osv): 'invoice_id': fields.many2one('account.invoice', 'Invoice', ondelete="set null"), 'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Type of Invoicing', help="It allows to set the discount while making invoice"), } + + def get_employee(self, cr, uid, emp_ids): + if not emp_ids: + user_name = self.pool.get('res.users').read(cr, uid, [uid], ['name'])[0]['name'] + raise osv.except_osv(_('Warning!'), _('Please define employee for this user "%s"!') % (user_name,)) + return emp_ids def _default_journal(self, cr, uid, context=None): proxy = self.pool.get('hr.employee') record_ids = proxy.search(cr, uid, [('user_id', '=', uid)], context=context) - employee = proxy.browse(cr, uid, record_ids[0], context=context) + employee_ids = self.get_employee(cr, uid, record_ids) + employee = proxy.browse(cr, uid, employee_ids[0], context=context) return employee.journal_id and employee.journal_id.id or False def _default_general_account(self, cr, uid, context=None): proxy = self.pool.get('hr.employee') record_ids = proxy.search(cr, uid, [('user_id', '=', uid)], context=context) - employee = proxy.browse(cr, uid, record_ids[0], context=context) + employee_ids = self.get_employee(cr, uid, record_ids) + employee = proxy.browse(cr, uid, employee_ids[0], context=context) if employee.product_id and employee.product_id.property_account_income: return employee.product_id.property_account_income.id return False From 5e2d8687903bbd7d029f2adadad4a7b0fa13bdaa Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 6 Sep 2012 18:43:10 +0530 Subject: [PATCH 4/6] [FIX] sale: in a sale order, if a line is created with only a description, no product, the system must propose direclty to create the final invoice whatever the invoicing policy bzr revid: hmo@tinyerp.com-20120906131310-pzx34w7fcu8j28zy --- addons/sale/sale.py | 7 +++++++ addons/sale/sale_view.xml | 2 +- addons/sale/sale_workflow.xml | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 6a6678d6163..9b8057c2289 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -582,6 +582,13 @@ class sale_order(osv.osv): result.update(view_id = res and res[1] or False) return result + def test_no_product(self, cr, uid, ids, *args): + for order in self.browse(cr, uid, ids): + for line in order.order_line: + if line.product_id: + return False + return True + def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'exception'], date_inv = False, context=None): res = False invoices = {} diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 2c2acff227e..1bc110312db 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -163,7 +163,7 @@