From 4a8e00cac7ba39a99f2a4fac9cdd4a4f171370ed Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Mon, 25 Jun 2012 12:21:09 +0530 Subject: [PATCH 01/68] [FIX]base:fix the issue convert to quote is not working via Scheduled Calls lp bug: https://launchpad.net/bugs/1017353 fixed bzr revid: mma@tinyerp.com-20120625065109-5ciy82syodgtbcg9 --- addons/sale_crm/wizard/crm_make_sale.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/sale_crm/wizard/crm_make_sale.py b/addons/sale_crm/wizard/crm_make_sale.py index 9484b87652e..fd84e33610f 100644 --- a/addons/sale_crm/wizard/crm_make_sale.py +++ b/addons/sale_crm/wizard/crm_make_sale.py @@ -64,7 +64,9 @@ class crm_make_sale(osv.osv_memory): """ if context is None: context = {} - + # update context: if come from phonecall, default state values can make the quote crash lp:1017353 + context.pop('default_state', False) + case_obj = self.pool.get('crm.lead') sale_obj = self.pool.get('sale.order') partner_obj = self.pool.get('res.partner') From 54c0c6e9ca85cb3375e259395847199fc58a1895 Mon Sep 17 00:00:00 2001 From: Ronald Portier Date: Tue, 16 Oct 2012 10:51:41 +0200 Subject: [PATCH 02/68] [FIX] l10n_nl - vat in the Netherlands went up from 19 to 21%. lp bug: https://launchpad.net/bugs/1067059 fixed bzr revid: ronald@therp.nl-20121016085141-zfa3ymjqmp57j1vg --- addons/l10n_nl/account_chart_netherlands.xml | 126 +++++++++---------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/addons/l10n_nl/account_chart_netherlands.xml b/addons/l10n_nl/account_chart_netherlands.xml index 96100d9a442..f736c6f4895 100644 --- a/addons/l10n_nl/account_chart_netherlands.xml +++ b/addons/l10n_nl/account_chart_netherlands.xml @@ -1424,7 +1424,7 @@ - + Btw af te dragen laag 1601 other @@ -1432,7 +1432,7 @@ - + Btw af te dragen hoog 1602 other @@ -1448,7 +1448,7 @@ - + Btw te vorderen laag 1611 other @@ -1456,7 +1456,7 @@ - + Btw te vorderen hoog 1612 other @@ -3909,7 +3909,7 @@ 1a - Leveringen/diensten belast met 19% (BTW) + Leveringen/diensten belast met 21% (BTW) 1b @@ -4021,7 +4021,7 @@ 1a - Leveringen/diensten belast met 19% (omzet) + Leveringen/diensten belast met 21% (omzet) 1b @@ -4149,22 +4149,22 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge 6% BTW percent - - + + sale - + Verkopen/omzet hoog - 19% BTW - + 21% BTW + percent - - + + @@ -4176,10 +4176,10 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge Verkopen/omzet overig variabel BTW - + percent - - + + @@ -4194,20 +4194,20 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge 6% BTW percent - - + + purchase - + BTW te vorderen hoog (inkopen) - 19% BTW - + 21% BTW + percent - - + + purchase @@ -4216,10 +4216,10 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge BTW te vorderen overig (inkopen) variabel BTW - + percent - - + + purchase @@ -4240,8 +4240,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge BTW af te dragen verlegd (inkopen) - 19% BTW verlegd - + 21% BTW verlegd + percent @@ -4277,8 +4277,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge BTW te vorderen verlegd (inkopen) - 19% BTW verlegd - + 21% BTW verlegd + percent @@ -4330,8 +4330,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge percent - - + + purchase @@ -4342,43 +4342,43 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge percent - - + + purchase - + Inkopen import binnen EU hoog - 19% BTW import binnen EU - + 21% BTW import binnen EU + percent purchase - + Inkopen import binnen EU hoog(1) percent - - - + + + purchase - + Inkopen import binnen EU hoog(2) percent - - - + + + purchase @@ -4400,8 +4400,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge percent - - + + purchase @@ -4412,8 +4412,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge percent - - + + purchase @@ -4463,8 +4463,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge percent - - + + purchase @@ -4475,8 +4475,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge percent - - + + purchase @@ -4485,7 +4485,7 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge Inkopen import buiten EU hoog BTW import buiten EU - + percent @@ -4498,8 +4498,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge percent - - + + purchase @@ -4510,8 +4510,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge percent - - + + purchase @@ -4520,7 +4520,7 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge Inkopen import buiten EU overig BTW import buiten EU - + percent @@ -4533,8 +4533,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge percent - - + + purchase @@ -4545,8 +4545,8 @@ TODO rubriek 1c en 1d moeten nog, zijn variabel, dus BTW percentage moet door ge percent - - + + purchase From ae95cab5332fe3730381329bf31d0baf668cd721 Mon Sep 17 00:00:00 2001 From: Vijaykumar Baladaniya Date: Tue, 23 Oct 2012 10:57:15 +0530 Subject: [PATCH 03/68] [FIX] point_of_sale: Add a context on launch_payment() method. bzr revid: vba@tinyerp.com-20121023052715-78d4sykmrrpzult0 --- addons/point_of_sale/wizard/pos_payment.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py index ca9331012b7..6dd02179f30 100644 --- a/addons/point_of_sale/wizard/pos_payment.py +++ b/addons/point_of_sale/wizard/pos_payment.py @@ -85,6 +85,7 @@ class pos_make_payment(osv.osv_memory): 'target': 'new', 'views': False, 'type': 'ir.actions.act_window', + 'context': context, } def print_report(self, cr, uid, ids, context=None): From 603a3030591988a6825bb263759756b15d99d5cd Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Tue, 23 Oct 2012 14:54:57 +0530 Subject: [PATCH 04/68] [IMP]bom_lines=False added in duplicating BOM bzr revid: kbh@tinyerp.com-20121023092457-o6d2ubyb7mzslwtp --- addons/mrp/mrp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 3ae27bf2c41..fb3ad899c88 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -371,7 +371,7 @@ class mrp_bom(osv.osv): if default is None: default = {} bom_data = self.read(cr, uid, id, [], context=context) - default.update(name=_("%s (copy)") % (bom_data['name']), bom_id=False) + default.update(name=_("%s (copy)") % (bom_data['name']), bom_id=False, bom_lines=False) return super(mrp_bom, self).copy_data(cr, uid, id, default, context=context) def create(self, cr, uid, vals, context=None): From c8f0bfc68cdf4b0c6d1d3036e373c6de0b496474 Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Tue, 23 Oct 2012 15:57:34 +0530 Subject: [PATCH 05/68] [REM]remove suffix copy from duplicating BOM bzr revid: kbh@tinyerp.com-20121023102734-1d0upye19ps64be1 --- addons/mrp/mrp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index fb3ad899c88..f760087d872 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -371,7 +371,7 @@ class mrp_bom(osv.osv): if default is None: default = {} bom_data = self.read(cr, uid, id, [], context=context) - default.update(name=_("%s (copy)") % (bom_data['name']), bom_id=False, bom_lines=False) + default.update(name=_("%s") % (bom_data['name']), bom_id=False) return super(mrp_bom, self).copy_data(cr, uid, id, default, context=context) def create(self, cr, uid, vals, context=None): From 3bde64f49c3c5d04b92cdf3cb0d0b67da9655149 Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Tue, 23 Oct 2012 17:44:07 +0530 Subject: [PATCH 06/68] [IMP]hr_expense:fields are readonly when expense is apporved bzr revid: kbh@tinyerp.com-20121023121407-6qarpm3ppdmgm8cu --- addons/hr_expense/hr_expense.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 487e4f58782..ee79e03fa77 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -64,22 +64,22 @@ class hr_expense_expense(osv.osv): _description = "Expense" _order = "id desc" _columns = { - 'name': fields.char('Description', size=128, required=True), + 'name': fields.char('Description', size=128, required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}), 'id': fields.integer('Sheet ID', readonly=True), - 'date': fields.date('Date', select=True), + 'date': fields.date('Date', select=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}), 'journal_id': fields.many2one('account.journal', 'Force Journal', help = "The journal used when the expense is done."), - 'employee_id': fields.many2one('hr.employee', "Employee", required=True), + 'employee_id': fields.many2one('hr.employee', "Employee", required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}), 'user_id': fields.many2one('res.users', 'User', required=True), 'date_confirm': fields.date('Confirmation Date', select=True, help = "Date of the confirmation of the sheet expense. It's filled when the button Confirm is pressed."), 'date_valid': fields.date('Validation Date', select=True, help = "Date of the acceptation of the sheet expense. It's filled when the button Accept is pressed."), - 'user_valid': fields.many2one('res.users', 'Validation User'), + 'user_valid': fields.many2one('res.users', 'Validation User', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}), 'account_move_id': fields.many2one('account.move', 'Ledger Posting'), 'line_ids': fields.one2many('hr.expense.line', 'expense_id', 'Expense Lines', readonly=True, states={'draft':[('readonly',False)]} ), 'note': fields.text('Note'), 'amount': fields.function(_amount, string='Total Amount', digits_compute= dp.get_precision('Account')), 'voucher_id': fields.many2one('account.voucher', "Employee's Receipt"), - 'currency_id': fields.many2one('res.currency', 'Currency', required=True), - 'department_id':fields.many2one('hr.department','Department'), + 'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}), + 'department_id':fields.many2one('hr.department','Department', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}), 'company_id': fields.many2one('res.company', 'Company', required=True), 'state': fields.selection([ ('draft', 'New'), From d4f970ff9ccb21d6e31982e70f8d41f9075b6cbd Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Tue, 23 Oct 2012 18:09:10 +0530 Subject: [PATCH 07/68] [IMP]hr_expense:delete only those expense which are in draft states bzr revid: kbh@tinyerp.com-20121023123910-v1sd0wtgis9cn0w6 --- addons/hr_expense/hr_expense.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index ee79e03fa77..06852e08e96 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -100,6 +100,12 @@ class hr_expense_expense(osv.osv): 'currency_id': _get_currency, } + def unlink(self, cr, uid, ids, context=None): + for rec in self.browse(cr, uid, ids, context=context): + if rec.state != 'draft': + raise osv.except_osv(_('Warning!'),_('You cannot delete an expense which is in %s state!')%(rec.state)) + return super(hr_expense_expense, self).unlink(cr, uid, ids, context) + def onchange_currency_id(self, cr, uid, ids, currency_id=False, company_id=False, context=None): res = {'value': {'journal_id': False}} journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','purchase'), ('currency','=',currency_id), ('company_id', '=', company_id)], context=context) From 5a460a63fa961aab3d1f750481d04438d4414651 Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Thu, 25 Oct 2012 11:58:13 +0530 Subject: [PATCH 08/68] [FIX]: crm: Fixed problem of adding category by automated actions bzr revid: rpa@tinyerp.com-20121025062813-mfckkg0cc0ehsasu --- addons/crm/crm_action_rule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py index 910a1fca169..4a8ee98fbae 100644 --- a/addons/crm/crm_action_rule.py +++ b/addons/crm/crm_action_rule.py @@ -79,7 +79,7 @@ class base_action_rule(osv.osv): write['section_id'] = action.act_section_id.id if hasattr(action, 'act_categ_id') and action.act_categ_id: - write['categ_ids'] = [4, action.act_categ_id.id] + write['categ_ids'] = [(4, action.act_categ_id.id)] model_obj.write(cr, uid, [obj.id], write, context) return res From e2a021bdc016d8305bcc6a44034732feed3be994 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Wed, 31 Oct 2012 16:21:22 +0530 Subject: [PATCH 09/68] [FIX]account : fix the task problem for context bzr revid: mma@tinyerp.com-20121031105122-jmrpm5at8t3iqs7s --- addons/account/account_analytic_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py index f0a420f7496..066f8d1abec 100644 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -107,7 +107,7 @@ class account_analytic_line(osv.osv): if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id, context=context) if journal.type == 'sale': - product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) + product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context=context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context=context)[0] # Take the company currency as the reference one From 74885bf20eceb5ed7e06c1bb9587cc63b16adc3e Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Wed, 31 Oct 2012 16:32:19 +0530 Subject: [PATCH 10/68] [FIX]l10_fr : change the worng account type and internal type in demo data bzr revid: mma@tinyerp.com-20121031110219-ocarfvdbl4lhlpi2 --- addons/l10n_fr/fr_tax.xml | 4 ++-- addons/l10n_fr/plan_comptable_general.xml | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/l10n_fr/fr_tax.xml b/addons/l10n_fr/fr_tax.xml index fc5d4608f45..36c5feb47b6 100644 --- a/addons/l10n_fr/fr_tax.xml +++ b/addons/l10n_fr/fr_tax.xml @@ -131,8 +131,8 @@ - - + + diff --git a/addons/l10n_fr/plan_comptable_general.xml b/addons/l10n_fr/plan_comptable_general.xml index 525dabfcc8a..268f4bd6336 100644 --- a/addons/l10n_fr/plan_comptable_general.xml +++ b/addons/l10n_fr/plan_comptable_general.xml @@ -3903,7 +3903,7 @@ Associés - Comptes courants 455 view - + Pour frais avancés personnellement @@ -3912,8 +3912,8 @@ Principal 4551 - receivable - + payable + @@ -3921,8 +3921,8 @@ Intérêts courus 4558 - receivable - + payable + From c8c8c68cfe8d090efca1a11706a2a794af8dae54 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Wed, 31 Oct 2012 17:06:46 +0530 Subject: [PATCH 11/68] [FIX]account : removed ref of view mode as calender in act_window bzr revid: mma@tinyerp.com-20121031113646-2xhfdb52cjvb0mge --- addons/account/partner_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/partner_view.xml b/addons/account/partner_view.xml index 4bee2002ffd..589c8bd376a 100644 --- a/addons/account/partner_view.xml +++ b/addons/account/partner_view.xml @@ -114,7 +114,7 @@ context="{'search_default_partner_id':[active_id], 'default_partner_id': active_id}" src_model="res.partner" view_type="form" - view_mode="tree,form,calendar"/> + view_mode="tree,form"/> From 15035d86bbcbc6702cd369c2773a31010fc145cf Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Wed, 31 Oct 2012 17:53:04 +0530 Subject: [PATCH 12/68] [FIX] document_ftp : when connecting using FTP client FileZilla and clicking on database named directory after logged in, it gives Invalid database path error bzr revid: mma@tinyerp.com-20121031122304-6ss91ml1ncnmah1f --- addons/document_ftp/ftpserver/abstracted_fs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/document_ftp/ftpserver/abstracted_fs.py b/addons/document_ftp/ftpserver/abstracted_fs.py index dbda715f614..4665de89370 100644 --- a/addons/document_ftp/ftpserver/abstracted_fs.py +++ b/addons/document_ftp/ftpserver/abstracted_fs.py @@ -272,7 +272,7 @@ class abstracted_fs(object): if path.startswith('/'): path = path[1:] - p_parts = path.split('/') # hard-code the unix sep here, by spec. + p_parts = path.split(os.sep) # hard-code the unix sep here, by spec. assert '..' not in p_parts From d21053e79b8db1ca43185edba7a980243f2b9ba2 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Wed, 31 Oct 2012 18:13:04 +0530 Subject: [PATCH 13/68] [FIX]document_ftp : remove comment bzr revid: mma@tinyerp.com-20121031124304-awyhksp0bxxqlvx7 --- addons/document_ftp/ftpserver/abstracted_fs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/document_ftp/ftpserver/abstracted_fs.py b/addons/document_ftp/ftpserver/abstracted_fs.py index 4665de89370..326c62f7a92 100644 --- a/addons/document_ftp/ftpserver/abstracted_fs.py +++ b/addons/document_ftp/ftpserver/abstracted_fs.py @@ -272,7 +272,7 @@ class abstracted_fs(object): if path.startswith('/'): path = path[1:] - p_parts = path.split(os.sep) # hard-code the unix sep here, by spec. + p_parts = path.split(os.sep) assert '..' not in p_parts From 91e4e5ac16d26a1a2cc3258c906e650d7511c941 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Wed, 31 Oct 2012 18:19:47 +0530 Subject: [PATCH 14/68] [FIX]account_budget : list view containing all budget lines are opened instead of only the ones related to the current account bzr revid: mma@tinyerp.com-20121031124947-aza2ikbwdivqwuf3 --- addons/account_budget/account_budget_view.xml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/addons/account_budget/account_budget_view.xml b/addons/account_budget/account_budget_view.xml index fdc358f5c98..4afe7fd90e3 100644 --- a/addons/account_budget/account_budget_view.xml +++ b/addons/account_budget/account_budget_view.xml @@ -220,7 +220,18 @@ - + + + account.budget.line.search + crossovered.budget.lines + search + + + + + + + crossovered.budget.line.tree crossovered.budget.lines From 8f294520278d2fc55cd31e63b83e5a693a32eb29 Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Wed, 31 Oct 2012 15:03:34 +0100 Subject: [PATCH 15/68] [IMP] Improved voucher_id field in bank statement lines. bzr revid: vta@openerp.com-20121031140334-mqi6hcofjuk4zps0 --- addons/account/account_view.xml | 4 +- addons/account_voucher/__openerp__.py | 9 +++ addons/account_voucher/account_voucher.py | 2 +- .../account_voucher/account_voucher_view.xml | 4 +- .../src/js/account_voucher_reconciliation.js | 74 +++++++++++++++++++ 5 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 addons/account_voucher/static/src/js/account_voucher_reconciliation.js diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index d9e95f15079..bf3fe6aaafb 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -650,7 +650,7 @@ - + @@ -661,7 +661,7 @@ - + diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py index c0011c8b3c5..ac80a7f32b0 100644 --- a/addons/account_voucher/__openerp__.py +++ b/addons/account_voucher/__openerp__.py @@ -60,6 +60,15 @@ This module manages: 'security/account_voucher_security.xml', 'account_voucher_data.xml', ], + 'js': [ + 'static/src/js/account_voucher_reconciliation.js', + ], + 'qweb' : [ + 'static/src/xml/account_voucher_reconciliation.xml', + ], + 'css': [ + #'static/src/css/account_voucher_reconciliation.css', + ], 'test' : [ 'test/account_voucher.yml', 'test/sales_receipt.yml', diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index e1caf190316..8774b717477 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -1565,7 +1565,7 @@ class account_bank_statement_line(osv.osv): _columns = { 'amount_reconciled': fields.function(_amount_reconciled, string='Amount reconciled', type='float'), - 'voucher_id': fields.many2one('account.voucher', 'Payment'), + 'voucher_id': fields.many2one('account.voucher', 'Reconciliation'), } def unlink(self, cr, uid, ids, context=None): diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml index 4b02d697982..55a07c5fd99 100644 --- a/addons/account_voucher/account_voucher_view.xml +++ b/addons/account_voucher/account_voucher_view.xml @@ -212,7 +212,7 @@ - + @@ -223,7 +223,7 @@ - + diff --git a/addons/account_voucher/static/src/js/account_voucher_reconciliation.js b/addons/account_voucher/static/src/js/account_voucher_reconciliation.js new file mode 100644 index 00000000000..7a4d47403f6 --- /dev/null +++ b/addons/account_voucher/static/src/js/account_voucher_reconciliation.js @@ -0,0 +1,74 @@ +openerp.account_voucher = function (instance) { + var _t = instance.web._t, + _lt = instance.web._lt; + var QWeb = instance.web.qweb; + + instance.web.account_voucher = {}; + + instance.web.form.widgets.add('account_voucher_field', 'instance.web.account_voucher.AccountVoucherField'); + instance.web.account_voucher.AccountVoucherField = instance.web.form.AbstractField.extend({ + template: 'FieldAccountVoucher', + init: function(field_manager, node) { + this._super.apply(this, arguments); + var self = this; + this.set('value', false); + this.is_started = false; + }, + start: function() { + this._super.apply(this, arguments); + var self = this; + this.string = this.get('value') ? _t('Edit') : _t('Create'); + this.node.attrs.icon = this.get('value') ? '/web/static/src/img/icons/gtk-yes.png' : '/web/static/src/img/icons/gtk-no.png'; + this.$button = $(QWeb.render('WidgetButton', {'widget': this})); + this.$el.append(this.$button); + this.$button.on('click', self.on_click); + this.is_started = true; + }, + on_click: function(ev) { + var self = this; + ev.stopPropagation(); + var popup = new instance.web.form.FormOpenPopup(this); + popup.show_element( + this.field.relation, + this.get('value'), + this.build_context(), + {title: _t("Voucher: ") + this.string} + ); + popup.on('create_completed write_completed', self, function(r){ + self.set_value(r); + }); + }, + // render_value: function() {}, + set_value: function(value_) { + var self = this; + if (value_ instanceof Array) { + value_ = value_[0]; + } + value_ = value_ || false; + this.set('value', value_); + if (this.is_started) { + this.render_value(); + } + }, + // get_value: function() {}, + // set_input_id: function(id) {}, + // is_valid: function() {}, + // is_syntax_valid: function() {}, + // focus: function() {}, + // on_translate: function() {}, + + }); + + instance.web.list.columns.add('field.account_voucher_field', 'instance.web.list.AccountVoucherField'); + instance.web.list.AccountVoucherField = instance.web.list.Column.extend({ + format: function (row_data, options) { + if (row_data.voucher_id.value) { + this.icon = '/web/static/src/img/icons/gtk-yes.png'; + } else { + this.icon = '/web/static/src/img/icons/gtk-no.png'; + } + return QWeb.render('FieldAccountVoucher.cell', {'widget': this}); + }, + }); + +}; \ No newline at end of file From af6f626a2c642320da491966b5f42c3fd4221c3e Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Wed, 31 Oct 2012 16:06:16 +0100 Subject: [PATCH 16/68] [ADD] Added new files. bzr revid: vta@openerp.com-20121031150616-m4i6dp2xa6edkgxr --- .../src/css/account_voucher_reconciliation.css | 0 .../src/js/account_voucher_reconciliation.js | 2 +- .../src/xml/account_voucher_reconciliation.xml | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 addons/account_voucher/static/src/css/account_voucher_reconciliation.css create mode 100644 addons/account_voucher/static/src/xml/account_voucher_reconciliation.xml diff --git a/addons/account_voucher/static/src/css/account_voucher_reconciliation.css b/addons/account_voucher/static/src/css/account_voucher_reconciliation.css new file mode 100644 index 00000000000..e69de29bb2d diff --git a/addons/account_voucher/static/src/js/account_voucher_reconciliation.js b/addons/account_voucher/static/src/js/account_voucher_reconciliation.js index 7a4d47403f6..8c96d7441be 100644 --- a/addons/account_voucher/static/src/js/account_voucher_reconciliation.js +++ b/addons/account_voucher/static/src/js/account_voucher_reconciliation.js @@ -61,7 +61,7 @@ openerp.account_voucher = function (instance) { instance.web.list.columns.add('field.account_voucher_field', 'instance.web.list.AccountVoucherField'); instance.web.list.AccountVoucherField = instance.web.list.Column.extend({ - format: function (row_data, options) { + _format: function (row_data, options) { if (row_data.voucher_id.value) { this.icon = '/web/static/src/img/icons/gtk-yes.png'; } else { diff --git a/addons/account_voucher/static/src/xml/account_voucher_reconciliation.xml b/addons/account_voucher/static/src/xml/account_voucher_reconciliation.xml new file mode 100644 index 00000000000..8ac808920b1 --- /dev/null +++ b/addons/account_voucher/static/src/xml/account_voucher_reconciliation.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file From e60907fa8da7d9cd9c2eb34e38b2beca9090b8b2 Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Wed, 31 Oct 2012 16:21:10 +0100 Subject: [PATCH 17/68] [REM] Removed unused code. bzr revid: vta@openerp.com-20121031152110-1v8qeocy6dd5kntb --- .../static/src/js/account_voucher_reconciliation.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/addons/account_voucher/static/src/js/account_voucher_reconciliation.js b/addons/account_voucher/static/src/js/account_voucher_reconciliation.js index 8c96d7441be..c500125510f 100644 --- a/addons/account_voucher/static/src/js/account_voucher_reconciliation.js +++ b/addons/account_voucher/static/src/js/account_voucher_reconciliation.js @@ -11,8 +11,7 @@ openerp.account_voucher = function (instance) { init: function(field_manager, node) { this._super.apply(this, arguments); var self = this; - this.set('value', false); - this.is_started = false; + this.set('value', false); }, start: function() { this._super.apply(this, arguments); @@ -22,7 +21,6 @@ openerp.account_voucher = function (instance) { this.$button = $(QWeb.render('WidgetButton', {'widget': this})); this.$el.append(this.$button); this.$button.on('click', self.on_click); - this.is_started = true; }, on_click: function(ev) { var self = this; @@ -38,7 +36,6 @@ openerp.account_voucher = function (instance) { self.set_value(r); }); }, - // render_value: function() {}, set_value: function(value_) { var self = this; if (value_ instanceof Array) { @@ -50,12 +47,6 @@ openerp.account_voucher = function (instance) { this.render_value(); } }, - // get_value: function() {}, - // set_input_id: function(id) {}, - // is_valid: function() {}, - // is_syntax_valid: function() {}, - // focus: function() {}, - // on_translate: function() {}, }); From f4463db761a2c6622d210c4f79c82f5f98028e9c Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Thu, 1 Nov 2012 16:09:34 +0530 Subject: [PATCH 18/68] [FIX]stock : fix the problem picking is move in available state bzr revid: mma@tinyerp.com-20121101103934-wgs3o9pjt3b2y793 --- addons/stock/stock.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index dffe1d69cc1..e735c1e02ec 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2433,14 +2433,17 @@ class stock_move(osv.osv): if move.picking_id: picking_ids.append(move.picking_id.id) if move.move_dest_id.id and (move.state != 'done'): - self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]}) - #cr.execute('insert into stock_move_history_ids (parent_id,child_id) values (%s,%s)', (move.id, move.move_dest_id.id)) - if move.move_dest_id.state in ('waiting', 'confirmed'): - self.force_assign(cr, uid, [move.move_dest_id.id], context=context) - if move.move_dest_id.picking_id: - wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr) - if move.move_dest_id.auto_validate: - self.action_done(cr, uid, [move.move_dest_id.id], context=context) + # Downstream move should only be triggered if this move is the last pending upstream move + other_upstream_move_ids = self.search(cr, uid, [('id','!=',move.id),('state','not in',['done','cancel']), + ('move_dest_id','=',move.move_dest_id.id)], context=context) + if not other_upstream_move_ids: + self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]}) + if move.move_dest_id.state in ('waiting', 'confirmed'): + self.force_assign(cr, uid, [move.move_dest_id.id], context=context) + if move.move_dest_id.picking_id: + wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr) + if move.move_dest_id.auto_validate: + self.action_done(cr, uid, [move.move_dest_id.id], context=context) self._create_product_valuation_moves(cr, uid, move, context=context) if move.state not in ('confirmed','done','assigned'): From eca2ee0fe276856b96b61a2f97efdc4d81be7b0f Mon Sep 17 00:00:00 2001 From: Saurang Suthar Date: Thu, 1 Nov 2012 18:45:42 +0530 Subject: [PATCH 19/68] [FIX]account:fixed the issue of traceback instead of constraint while selecting account of view type during journal entry creation bzr revid: ssu@tinyerp.com-20121101131542-3mit3a2qok17q7uz --- addons/account/account_move_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 67a55d8f451..4f38b7dfe3d 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -582,7 +582,7 @@ class account_move_line(osv.osv): lines = self.browse(cr, uid, ids, context=context) for l in lines: if l.account_id.type == 'view': - raise osv.except_osv(_('Error!'), _('You cannot create journal items on “View” type account %s %s.') % (l.account_id.code, l.account_id.name)) + return False return True def _check_no_closed(self, cr, uid, ids, context=None): From eb4b42e85f77dda3790774852fd9876ea296b668 Mon Sep 17 00:00:00 2001 From: "Somesh Khare(OpenERP)" <> Date: Thu, 1 Nov 2012 19:00:24 +0530 Subject: [PATCH 20/68] [FIX]project: Error when no date given in the selected project in Scheduling Task Wizard and Press Compute button bzr revid: mma@tinyerp.com-20121101133024-cvg0lixafru3arjm --- addons/project/project.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/project/project.py b/addons/project/project.py index 3b0057c67b7..f097f541cc6 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -429,6 +429,8 @@ def Project(): return result def _schedule_project(self, cr, uid, project, context=None): + if not project.date_start: + raise osv.except_osv(_('Warning !'),_("You must assign Start Date on the Project '%s' !") % (project.name,)) resource_pool = self.pool.get('resource.resource') calendar_id = project.resource_calendar_id and project.resource_calendar_id.id or False working_days = resource_pool.compute_working_calendar(cr, uid, calendar_id, context=context) From 803bd10eb95e4d5e8ab20e5eb4fe0ab4d6cee72e Mon Sep 17 00:00:00 2001 From: "Somesh Khare(OpenERP)" <> Date: Fri, 2 Nov 2012 10:45:16 +0530 Subject: [PATCH 21/68] [FIX]base_iban: invalid literal Error when trying to save the Bank Accounts details without Account Number and BIC code bzr revid: mma@tinyerp.com-20121102051516-99b3vc97xxhcqn30 --- addons/base_iban/base_iban.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/base_iban/base_iban.py b/addons/base_iban/base_iban.py index c29647a1176..ff492a8d34b 100644 --- a/addons/base_iban/base_iban.py +++ b/addons/base_iban/base_iban.py @@ -99,6 +99,8 @@ class res_partner_bank(osv.osv): @param iban: IBAN as string @return: True if IBAN is valid, False otherwise """ + if not iban: + return False iban = _format_iban(iban).lower() if iban[:2] in _ref_iban and len(iban) != len(_format_iban(_ref_iban[iban[:2]])): return False @@ -128,9 +130,9 @@ class res_partner_bank(osv.osv): def _construct_constraint_msg(self, cr, uid, ids, context=None): def default_iban_check(iban_cn): - return iban_cn[0] in string.ascii_lowercase and iban_cn[1] in string.ascii_lowercase + return iban_cn and iban_cn[0] in string.ascii_lowercase and iban_cn[1] in string.ascii_lowercase - iban_country = self.browse(cr, uid, ids)[0].acc_number[:2].lower() + iban_country = self.browse(cr, uid, ids)[0].acc_number and self.browse(cr, uid, ids)[0].acc_number[:2].lower() if default_iban_check(iban_country): if iban_country in _ref_iban: return _('The IBAN does not seem to be correct. You should have entered something like this %s'), \ From 5cde51e636af826bad7b58bd2134e150632c2c66 Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Fri, 2 Nov 2012 11:41:26 +0530 Subject: [PATCH 22/68] [IMP]hr_payroll:added unlink method for deleteing draft and cancel payslip. bzr revid: kbh@tinyerp.com-20121102061126-uzkprztc5aoo0hjf --- addons/hr_payroll/hr_payroll.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index d1f38ad4a0f..e8c1d71922f 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -363,6 +363,12 @@ class hr_payslip(osv.osv): def check_done(self, cr, uid, ids, context=None): return True + def unlink(self, cr, uid, ids, context=None): + for payslip in self.browse(cr, uid, ids, context=context): + if payslip.state not in ['draft','cancel']: + raise osv.except_osv(_('Warning!'),_('You cannot delete a payslip which is in %s state!')%(payslip.state)) + return super(hr_payslip, self).unlink(cr, uid, ids, context) + #TODO move this function into hr_contract module, on hr.employee object def get_contract(self, cr, uid, employee, date_from, date_to, context=None): """ From 459270ebfffc615f82490a8878fda53cc03506e1 Mon Sep 17 00:00:00 2001 From: jacara <> Date: Fri, 2 Nov 2012 12:55:00 +0530 Subject: [PATCH 23/68] [FIX]account_asset:Fixes the expresion problem in lp bug: https://launchpad.net/bugs/1074228 fixed bzr revid: kbh@tinyerp.com-20121102072500-ylzaw1i75a13kimh --- addons/account_asset/account_asset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index 585798a5235..aed25285ea8 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -376,7 +376,7 @@ class account_asset_depreciation_line(osv.osv): current_currency = line.asset_id.currency_id.id context.update({'date': depreciation_date}) amount = currency_obj.compute(cr, uid, current_currency, company_currency, line.amount, context=context) - sign = line.asset_id.category_id.journal_id.type = 'purchase' and 1 or -1 + sign == (line.asset_id.category_id.journal_id.type == 'purchase' and 1) or -1 asset_name = line.asset_id.name reference = line.name move_vals = { From e519b2b9dc956c1a076714eca038a50e58d15549 Mon Sep 17 00:00:00 2001 From: "Somesh Khare(OpenERP)" <> Date: Fri, 2 Nov 2012 14:10:04 +0530 Subject: [PATCH 24/68] [FIX]product: when you search the product the limit into the name_search() goes None bzr revid: mma@tinyerp.com-20121102084004-af7m8wlov3w627ei --- addons/product/product.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index 6c6c5f2650c..99c36611e9c 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -657,9 +657,9 @@ class product_product(osv.osv): # Performing a quick memory merge of ids in Python will give much better performance ids = set() ids.update(self.search(cr, user, args + [('default_code',operator,name)], limit=limit, context=context)) - if len(ids) < limit: + if not limit or len(ids) < limit: # we may underrun the limit because of dupes in the results, that's fine - ids.update(self.search(cr, user, args + [('name',operator,name)], limit=(limit-len(ids)), context=context)) + ids.update(self.search(cr, user, args + [('name',operator,name)], limit=(limit-len(ids) if limit else limit) , context=context)) ids = list(ids) if not ids: ptrn = re.compile('(\[(.*?)\])') From e9942561c0530faddfbc06b01d08b2e10fcdd4c7 Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Fri, 2 Nov 2012 14:44:45 +0530 Subject: [PATCH 25/68] [FIX]account_asset:Fixes the expresion problem in asset bzr revid: kbh@tinyerp.com-20121102091445-xgsn8kvsu3glom1d --- addons/account_asset/account_asset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index aed25285ea8..6442723c6fc 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -376,7 +376,7 @@ class account_asset_depreciation_line(osv.osv): current_currency = line.asset_id.currency_id.id context.update({'date': depreciation_date}) amount = currency_obj.compute(cr, uid, current_currency, company_currency, line.amount, context=context) - sign == (line.asset_id.category_id.journal_id.type == 'purchase' and 1) or -1 + sign = (line.asset_id.category_id.journal_id.type == 'purchase' and 1) or -1 asset_name = line.asset_id.name reference = line.name move_vals = { From c75d2605059afe5c939147df00bf92c10f04770b Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Fri, 2 Nov 2012 10:38:57 +0100 Subject: [PATCH 26/68] [FIX] Refactoring of view_vendor_receipt_form. bzr revid: vta@openerp.com-20121102093857-es04l1spvh1h63z8 --- addons/account/account_view.xml | 4 +-- .../account_analytic_plans_view.xml | 2 +- .../src/js/account_voucher_reconciliation.js | 2 +- .../voucher_payment_receipt_view.xml | 26 +++++++++---------- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index bf3fe6aaafb..159f2f704a0 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -302,7 +302,7 @@ [('parent_id','=',False)] - + Unrealized Gain or Loss account.account @@ -322,7 +322,7 @@ - + Unrealized Gain or Loss account.account form diff --git a/addons/account_analytic_plans/account_analytic_plans_view.xml b/addons/account_analytic_plans/account_analytic_plans_view.xml index 76d6aeed7b8..a4b8f0756f5 100644 --- a/addons/account_analytic_plans/account_analytic_plans_view.xml +++ b/addons/account_analytic_plans/account_analytic_plans_view.xml @@ -276,7 +276,7 @@ - + account.analytic.default.tree.plans account.analytic.default diff --git a/addons/account_voucher/static/src/js/account_voucher_reconciliation.js b/addons/account_voucher/static/src/js/account_voucher_reconciliation.js index c500125510f..09616a139fb 100644 --- a/addons/account_voucher/static/src/js/account_voucher_reconciliation.js +++ b/addons/account_voucher/static/src/js/account_voucher_reconciliation.js @@ -8,7 +8,7 @@ openerp.account_voucher = function (instance) { instance.web.form.widgets.add('account_voucher_field', 'instance.web.account_voucher.AccountVoucherField'); instance.web.account_voucher.AccountVoucherField = instance.web.form.AbstractField.extend({ template: 'FieldAccountVoucher', - init: function(field_manager, node) { + init: function(field_manager, node) { this._super.apply(this, arguments); var self = this; this.set('value', false); diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index e1a48c6c535..a671fe2c358 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -390,35 +390,33 @@ account.voucher
-
-

- + - + - - - + + + -
-
+
From 907c98376018401ae1e58f0dbe6ae5c9f22284df Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Fri, 2 Nov 2012 18:33:17 +0530 Subject: [PATCH 27/68] [FIX]sale: Update context as it was none in method and was not able to translate raised exception bzr revid: mma@tinyerp.com-20121102130317-kmuxgk7vjdneq0da --- addons/sale/sale.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index da662acd768..180974adcc1 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -265,6 +265,9 @@ class sale_order(osv.osv): return osv.osv.unlink(self, cr, uid, unlink_ids, context=context) def onchange_pricelist_id(self, cr, uid, ids, pricelist_id, order_lines, context=None): + if context is None: + context = {} + context.update({'lang': self.pool.get('res.users').context_get(cr, uid, context)['lang']}) if not pricelist_id: return {} value = { @@ -601,6 +604,9 @@ class sale_order(osv.osv): } def action_wait(self, cr, uid, ids, context=None): + if context is None: + context = {} + context.update({'lang': self.pool.get('res.users').context_get(cr, uid, context)['lang']}) for o in self.browse(cr, uid, ids): if not o.order_line: raise osv.except_osv(_('Error!'),_('You cannot confirm a sale order which has no line.')) From b855f0bdd81e41c1596072e0e8061b3248b8121c Mon Sep 17 00:00:00 2001 From: Dhruti Shastri <> Date: Mon, 5 Nov 2012 11:45:18 +0530 Subject: [PATCH 28/68] [FIX]l10_be : Wizard thorws error instead of User Friendly Warning bzr revid: mma@tinyerp.com-20121105061518-9zixa8lr22z7v9j5 --- addons/l10n_be/wizard/l10n_be_partner_vat_listing.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py index d15b300597e..5234dadf479 100644 --- a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py +++ b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py @@ -65,6 +65,8 @@ class partner_vat(osv.osv_memory): partners = [] partner_ids = obj_partner.search(cr, uid, [('vat_subjected', '!=', False), ('vat','ilike','BE%')], context=context) + if not partner_ids: + raise osv.except_osv(_('Missing Partner Configuration'),_('Could not find VAT and Legal Statement Validation')) cr.execute("""SELECT sub1.partner_id, sub1.name, sub1.vat, sub1.turnover, sub2.vat_amount FROM (SELECT l.partner_id, p.name, p.vat, SUM(CASE WHEN c.code ='49' THEN -l.tax_amount ELSE l.tax_amount END) as turnover FROM account_move_line l @@ -190,7 +192,7 @@ class partner_vat_list(osv.osv_memory): addr = obj_partner.address_get(cr, uid, [obj_cmpny.partner_id.id], ['invoice']) if addr.get('invoice',False): ads = obj_partner.browse(cr, uid, [addr['invoice']], context=context)[0] - phone = ads.phone.replace(' ','') or '' + phone = ads.phone.replace(' ','') if ads.phone else '' email = ads.email or '' name = ads.name or '' city = ads.city or '' @@ -259,6 +261,8 @@ class partner_vat_list(osv.osv_memory): # Turnover and Farmer tags are not included client_datas = self._get_datas(cr, uid, ids, context=context) + if not client_datas: + raise osv.except_osv(_('Data Insufficient!'),_('No data available for the client.')) data_client_info = '' for amount_data in client_datas: data_client_info += """ @@ -309,6 +313,8 @@ class partner_vat_list(osv.osv_memory): datas['year'] = context['year'] datas['limit_amount'] = context['limit_amount'] datas['client_datas'] = self._get_datas(cr, uid, ids, context=context) + if not datas['client_datas']: + raise osv.except_osv(_('Error !'),_('No record to print.')) return { 'type': 'ir.actions.report.xml', 'report_name': 'partner.vat.listing.print', From 9a6e7799feac185e3273b45ad76b73b8b669cd35 Mon Sep 17 00:00:00 2001 From: "Nehal Panchal (OpenERP)" <> Date: Mon, 5 Nov 2012 11:58:07 +0530 Subject: [PATCH 29/68] [FIX]hr_payroll : Fixed Salary Rules Python Code and Quantity for payslip computation bzr revid: mma@tinyerp.com-20121105062807-byz6d0kd7scxq3r3 --- addons/hr_payroll/hr_payroll_demo.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_payroll/hr_payroll_demo.xml b/addons/hr_payroll/hr_payroll_demo.xml index 836814860c1..6fb30f1fb04 100644 --- a/addons/hr_payroll/hr_payroll_demo.xml +++ b/addons/hr_payroll/hr_payroll_demo.xml @@ -75,7 +75,7 @@ fix - worked_days.WORK100.number_of_days + worked_days.WORK100 and worked_days.WORK100.number_of_days MA @@ -89,7 +89,7 @@ Get 1% of sales - result = (inputs.SALEURO.amount + inputs.SALASIA.amount) * 0.01 + result = ((inputs.SALEURO and inputs.SALEURO.amount) + (inputs.SALASIA and inputs.SALASIA.amount)) * 0.01 From 3518a4f2dcdb111440c9e9dc6231b71f8ae72983 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Mon, 5 Nov 2012 15:44:07 +0530 Subject: [PATCH 30/68] [IMP]10_be : improved code bzr revid: mma@tinyerp.com-20121105101407-fsxjwisg9ajgim07 --- addons/l10n_be/wizard/l10n_be_partner_vat_listing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py index 5234dadf479..6d82541345f 100644 --- a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py +++ b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py @@ -66,7 +66,7 @@ class partner_vat(osv.osv_memory): partners = [] partner_ids = obj_partner.search(cr, uid, [('vat_subjected', '!=', False), ('vat','ilike','BE%')], context=context) if not partner_ids: - raise osv.except_osv(_('Missing Partner Configuration'),_('Could not find VAT and Legal Statement Validation')) + raise osv.except_osv(_('Missing Partner Configuration'),_('Could not find VAT and Legal Statement Validation'.)) cr.execute("""SELECT sub1.partner_id, sub1.name, sub1.vat, sub1.turnover, sub2.vat_amount FROM (SELECT l.partner_id, p.name, p.vat, SUM(CASE WHEN c.code ='49' THEN -l.tax_amount ELSE l.tax_amount END) as turnover FROM account_move_line l @@ -314,7 +314,7 @@ class partner_vat_list(osv.osv_memory): datas['limit_amount'] = context['limit_amount'] datas['client_datas'] = self._get_datas(cr, uid, ids, context=context) if not datas['client_datas']: - raise osv.except_osv(_('Error !'),_('No record to print.')) + raise osv.except_osv(_('Error!'),_('No record to print.')) return { 'type': 'ir.actions.report.xml', 'report_name': 'partner.vat.listing.print', From 81560c12fada241014b713dc83f29c9d3be75b36 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Mon, 5 Nov 2012 15:49:00 +0530 Subject: [PATCH 31/68] [FIX]hr_payroll : improved some code bzr revid: mma@tinyerp.com-20121105101900-bg5pjmsc5pt957pl --- addons/hr_payroll/hr_payroll_demo.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_payroll/hr_payroll_demo.xml b/addons/hr_payroll/hr_payroll_demo.xml index 6fb30f1fb04..a22809b00e3 100644 --- a/addons/hr_payroll/hr_payroll_demo.xml +++ b/addons/hr_payroll/hr_payroll_demo.xml @@ -75,7 +75,7 @@ fix - worked_days.WORK100 and worked_days.WORK100.number_of_days + worked_days.WORK100 and worked_days.WORK100.number_of_days MA From ce2d38922e409da2bc1e81b08e792a2c6e5b6db7 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Mon, 5 Nov 2012 15:51:02 +0530 Subject: [PATCH 32/68] [FIX]l10_be : imp little bit bzr revid: mma@tinyerp.com-20121105102102-sxbu9q584bp7gyfy --- addons/l10n_be/wizard/l10n_be_partner_vat_listing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py index 6d82541345f..4f5863d76b2 100644 --- a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py +++ b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py @@ -66,7 +66,7 @@ class partner_vat(osv.osv_memory): partners = [] partner_ids = obj_partner.search(cr, uid, [('vat_subjected', '!=', False), ('vat','ilike','BE%')], context=context) if not partner_ids: - raise osv.except_osv(_('Missing Partner Configuration'),_('Could not find VAT and Legal Statement Validation'.)) + raise osv.except_osv(_('Missing Partner Configuration'),_('Could not find VAT and Legal Statement Validation.')) cr.execute("""SELECT sub1.partner_id, sub1.name, sub1.vat, sub1.turnover, sub2.vat_amount FROM (SELECT l.partner_id, p.name, p.vat, SUM(CASE WHEN c.code ='49' THEN -l.tax_amount ELSE l.tax_amount END) as turnover FROM account_move_line l From c4fe6c2f58f43a1434f13a538ba8df034e5d8348 Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Mon, 5 Nov 2012 13:53:46 +0100 Subject: [PATCH 33/68] [REM] Removed many2onebutton widget from account_voucher, now in view_form.js and view_list.js, as standard widget. bzr revid: vta@openerp.com-20121105125346-v8hgfn157ef0j8fl --- addons/account/account_view.xml | 4 +- addons/account_voucher/__openerp__.py | 9 --- .../account_voucher/account_voucher_view.xml | 4 +- .../css/account_voucher_reconciliation.css | 0 .../src/js/account_voucher_reconciliation.js | 65 ------------------- .../xml/account_voucher_reconciliation.xml | 15 ----- 6 files changed, 4 insertions(+), 93 deletions(-) delete mode 100644 addons/account_voucher/static/src/css/account_voucher_reconciliation.css delete mode 100644 addons/account_voucher/static/src/js/account_voucher_reconciliation.js delete mode 100644 addons/account_voucher/static/src/xml/account_voucher_reconciliation.xml diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 159f2f704a0..e050daec2b1 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1055,7 +1055,7 @@ - + account.move.line.tree account.move.line @@ -1850,7 +1850,7 @@ - + account.subscription.search account.subscription diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py index ac80a7f32b0..c0011c8b3c5 100644 --- a/addons/account_voucher/__openerp__.py +++ b/addons/account_voucher/__openerp__.py @@ -60,15 +60,6 @@ This module manages: 'security/account_voucher_security.xml', 'account_voucher_data.xml', ], - 'js': [ - 'static/src/js/account_voucher_reconciliation.js', - ], - 'qweb' : [ - 'static/src/xml/account_voucher_reconciliation.xml', - ], - 'css': [ - #'static/src/css/account_voucher_reconciliation.css', - ], 'test' : [ 'test/account_voucher.yml', 'test/sales_receipt.yml', diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml index 55a07c5fd99..333cde7638f 100644 --- a/addons/account_voucher/account_voucher_view.xml +++ b/addons/account_voucher/account_voucher_view.xml @@ -212,7 +212,7 @@ - + @@ -223,7 +223,7 @@ - + diff --git a/addons/account_voucher/static/src/css/account_voucher_reconciliation.css b/addons/account_voucher/static/src/css/account_voucher_reconciliation.css deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/addons/account_voucher/static/src/js/account_voucher_reconciliation.js b/addons/account_voucher/static/src/js/account_voucher_reconciliation.js deleted file mode 100644 index 09616a139fb..00000000000 --- a/addons/account_voucher/static/src/js/account_voucher_reconciliation.js +++ /dev/null @@ -1,65 +0,0 @@ -openerp.account_voucher = function (instance) { - var _t = instance.web._t, - _lt = instance.web._lt; - var QWeb = instance.web.qweb; - - instance.web.account_voucher = {}; - - instance.web.form.widgets.add('account_voucher_field', 'instance.web.account_voucher.AccountVoucherField'); - instance.web.account_voucher.AccountVoucherField = instance.web.form.AbstractField.extend({ - template: 'FieldAccountVoucher', - init: function(field_manager, node) { - this._super.apply(this, arguments); - var self = this; - this.set('value', false); - }, - start: function() { - this._super.apply(this, arguments); - var self = this; - this.string = this.get('value') ? _t('Edit') : _t('Create'); - this.node.attrs.icon = this.get('value') ? '/web/static/src/img/icons/gtk-yes.png' : '/web/static/src/img/icons/gtk-no.png'; - this.$button = $(QWeb.render('WidgetButton', {'widget': this})); - this.$el.append(this.$button); - this.$button.on('click', self.on_click); - }, - on_click: function(ev) { - var self = this; - ev.stopPropagation(); - var popup = new instance.web.form.FormOpenPopup(this); - popup.show_element( - this.field.relation, - this.get('value'), - this.build_context(), - {title: _t("Voucher: ") + this.string} - ); - popup.on('create_completed write_completed', self, function(r){ - self.set_value(r); - }); - }, - set_value: function(value_) { - var self = this; - if (value_ instanceof Array) { - value_ = value_[0]; - } - value_ = value_ || false; - this.set('value', value_); - if (this.is_started) { - this.render_value(); - } - }, - - }); - - instance.web.list.columns.add('field.account_voucher_field', 'instance.web.list.AccountVoucherField'); - instance.web.list.AccountVoucherField = instance.web.list.Column.extend({ - _format: function (row_data, options) { - if (row_data.voucher_id.value) { - this.icon = '/web/static/src/img/icons/gtk-yes.png'; - } else { - this.icon = '/web/static/src/img/icons/gtk-no.png'; - } - return QWeb.render('FieldAccountVoucher.cell', {'widget': this}); - }, - }); - -}; \ No newline at end of file diff --git a/addons/account_voucher/static/src/xml/account_voucher_reconciliation.xml b/addons/account_voucher/static/src/xml/account_voucher_reconciliation.xml deleted file mode 100644 index 8ac808920b1..00000000000 --- a/addons/account_voucher/static/src/xml/account_voucher_reconciliation.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file From 01d33d5d063078002a289b045bda483cd2e140f1 Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Tue, 6 Nov 2012 16:36:02 +0100 Subject: [PATCH 34/68] [IMP] Make account.voucher inactive by default, and only change its state when confirming the corresponding bank statement. Improved bank statement unlink method, also removing its corresponding vouchers. bzr revid: vta@openerp.com-20121106153602-jmtaqkn55o5hxwyv --- addons/account_voucher/account_voucher.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 8774b717477..8f34fd8a1fc 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -267,6 +267,7 @@ class account_voucher(osv.osv): _order = "date desc, id desc" # _rec_name = 'number' _columns = { + 'active':fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the payment term without removing it."), 'type':fields.selection([ ('sale','Sale'), ('purchase','Purchase'), @@ -328,6 +329,7 @@ class account_voucher(osv.osv): 'is_multi_currency': fields.boolean('Multi Currency Voucher', help='Fields with internal purpose only that depicts if the voucher is a multi currency one or not'), } _defaults = { + 'active': lambda *a: False, 'period_id': _get_period, 'partner_id': _get_partner, 'journal_id':_get_journal, @@ -1504,6 +1506,15 @@ account_voucher_line() class account_bank_statement(osv.osv): _inherit = 'account.bank.statement' + def button_confirm_bank(self, cr, uid, ids, context=None): + statementLine = self.pool.get('account.bank.statement.line') + voucher = self.pool.get('account.voucher') + for statement in self.browse(cr, uid, ids, context=context): + for line in statement.line_ids: + if line.voucher_id: + voucher.write(cr, uid, line.voucher_id.id, {'active':True}, context=context) + return super(account_bank_statement, self).button_confirm_bank(cr, uid, ids, context=context) + def button_cancel(self, cr, uid, ids, context=None): voucher_obj = self.pool.get('account.voucher') for st in self.browse(cr, uid, ids, context=context): @@ -1534,6 +1545,13 @@ class account_bank_statement(osv.osv): return move_line_obj.write(cr, uid, [x.id for x in v.move_ids], {'statement_id': st_line.statement_id.id}, context=context) return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line.id, company_currency_id, next_number, context=context) + def unlink(self, cr, uid, ids, context=None): + statementLine = self.pool.get('account.bank.statement.line') + for statement in self.read(cr, uid, ids, ['line_ids'], context=context): + statementLine.unlink(cr, uid, statement['line_ids'], context=context) + return super(account_bank_statement, self).unlink(cr, uid, ids, context=context) + + account_bank_statement() class account_bank_statement_line(osv.osv): From 71c73945facd6aed08cc1d355bb6e3bb94ec07bb Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 6 Nov 2012 20:12:55 +0100 Subject: [PATCH 35/68] [IMP] email template: add a email_to_partner field for send a email to a partner with the id bzr revid: chm@openerp.com-20121106191255-dd1xv90ebsejqunf --- addons/account/edi/invoice_action_data.xml | 1 + addons/email_template/email_template.py | 3 ++- addons/email_template/email_template_view.xml | 3 ++- .../wizard/email_template_preview_view.xml | 1 + .../email_template/wizard/mail_compose_message.py | 13 +++++++++++-- addons/mail/wizard/mail_compose_message_view.xml | 1 - addons/purchase/edi/purchase_order_action_data.xml | 3 ++- 7 files changed, 19 insertions(+), 6 deletions(-) diff --git a/addons/account/edi/invoice_action_data.xml b/addons/account/edi/invoice_action_data.xml index 53fa03a6902..e19b4df5c27 100644 --- a/addons/account/edi/invoice_action_data.xml +++ b/addons/account/edi/invoice_action_data.xml @@ -41,6 +41,7 @@ ${object.user_id.email or object.company_id.email or 'noreply@localhost'} ${object.company_id.name} Invoice (Ref ${object.number or 'n/a' }) ${object.partner_id.email or ''} + ${object.partner_id.id} - + + diff --git a/addons/email_template/wizard/email_template_preview_view.xml b/addons/email_template/wizard/email_template_preview_view.xml index f91535a17a5..a3dbf40ad70 100644 --- a/addons/email_template/wizard/email_template_preview_view.xml +++ b/addons/email_template/wizard/email_template_preview_view.xml @@ -17,6 +17,7 @@ + diff --git a/addons/email_template/wizard/mail_compose_message.py b/addons/email_template/wizard/mail_compose_message.py index fe6f85da544..49f66734ae6 100644 --- a/addons/email_template/wizard/mail_compose_message.py +++ b/addons/email_template/wizard/mail_compose_message.py @@ -148,15 +148,24 @@ class mail_compose_message(osv.TransientModel): mail.compose.message, transform email_cc and email_to into partner_ids """ template_values = self.pool.get('email.template').generate_email(cr, uid, template_id, res_id, context=context) # filter template values - fields = ['body', 'body_html', 'subject', 'email_to', 'email_cc', 'attachments'] + fields = ['body', 'body_html', 'subject', 'email_to', 'email_to_partner', 'email_cc', 'attachments'] values = dict((field, template_values[field]) for field in fields if template_values.get(field)) values['body'] = values.pop('body_html', '') # transform email_to, email_cc into partner_ids values['partner_ids'] = [] - mails = tools.email_split(values.pop('email_to', '') + ' ' + values.pop('email_cc', '')) + + mails = tools.email_split( values.pop('email_to', '') + ' ' + values.pop('email_cc', '') ) for mail in mails: partner_id = self.pool.get('res.partner').find_or_create(cr, uid, mail, context=context) values['partner_ids'].append(partner_id) + + partner_ids = values.pop('email_to_partner', '').split(',') + for partner_id in partner_ids: + if partner_id: + values['partner_ids'].append(int(partner_id)) + + values['partner_ids'] = list(set(values['partner_ids'])) + return values def render_message(self, cr, uid, wizard, res_id, context=None): diff --git a/addons/mail/wizard/mail_compose_message_view.xml b/addons/mail/wizard/mail_compose_message_view.xml index 5e571eb4338..7b2f5632cbd 100644 --- a/addons/mail/wizard/mail_compose_message_view.xml +++ b/addons/mail/wizard/mail_compose_message_view.xml @@ -15,7 +15,6 @@ diff --git a/addons/purchase/edi/purchase_order_action_data.xml b/addons/purchase/edi/purchase_order_action_data.xml index daad4467929..8464c533696 100644 --- a/addons/purchase/edi/purchase_order_action_data.xml +++ b/addons/purchase/edi/purchase_order_action_data.xml @@ -40,7 +40,8 @@ Automated Purchase Order Notification Mail ${object.validator.email or ''} ${object.company_id.name} Order (Ref ${object.name or 'n/a' }) - ${object.partner_id.email} + ${object.partner_id.email or ''} + ${object.partner_id.id} Date: Wed, 7 Nov 2012 09:18:27 +0100 Subject: [PATCH 36/68] [IMP] Set the new voucher as inactive. bzr revid: vta@openerp.com-20121107081827-ncls1h2c5pbjvis3 --- addons/account_voucher/__openerp__.py | 3 +++ addons/account_voucher/account_voucher.py | 2 +- .../account_voucher/static/src/js/account_voucher.js | 12 ++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 addons/account_voucher/static/src/js/account_voucher.js diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py index c0011c8b3c5..85090cd617d 100644 --- a/addons/account_voucher/__openerp__.py +++ b/addons/account_voucher/__openerp__.py @@ -60,6 +60,9 @@ This module manages: 'security/account_voucher_security.xml', 'account_voucher_data.xml', ], + 'js': [ + 'static/src/js/account_voucher.js', + ], 'test' : [ 'test/account_voucher.yml', 'test/sales_receipt.yml', diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 8f34fd8a1fc..85ab06714e7 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -329,7 +329,7 @@ class account_voucher(osv.osv): 'is_multi_currency': fields.boolean('Multi Currency Voucher', help='Fields with internal purpose only that depicts if the voucher is a multi currency one or not'), } _defaults = { - 'active': lambda *a: False, + 'active': lambda *a: True, 'period_id': _get_period, 'partner_id': _get_partner, 'journal_id':_get_journal, diff --git a/addons/account_voucher/static/src/js/account_voucher.js b/addons/account_voucher/static/src/js/account_voucher.js new file mode 100644 index 00000000000..9d38ad252cf --- /dev/null +++ b/addons/account_voucher/static/src/js/account_voucher.js @@ -0,0 +1,12 @@ +openerp.account_voucher = function(instance) { + + instance.web.form.Many2OneButton = instance.web.form.Many2OneButton.extend({ + on_click: function() { + this._super.apply(this, arguments); + this.popup.on('create_completed write_completed', self, function(r) { + var voucher = new instance.web.Model('account.voucher'); + voucher.call('write', [[r], {'active':false}]); + }); + }, + }); +} \ No newline at end of file From 0ad71eb405a2ec089904ec3a13db2b02d3e0fe05 Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Wed, 7 Nov 2012 09:45:40 +0100 Subject: [PATCH 37/68] [FIX] Hide open m2o icon. bzr revid: vta@openerp.com-20121107084540-iahqvnuh4q9tcejo --- addons/account/account_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index e050daec2b1..8441c8dbfc9 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -650,7 +650,7 @@ - + From 621c8b4bb76414375eec15cfe4822ac33513256c Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 7 Nov 2012 11:27:45 +0100 Subject: [PATCH 38/68] [IMP] email_template: add test: The fields email_to, email_to_partner and email_cc return the good list of partner_id bzr revid: chm@openerp.com-20121107102745-9d0dt1fkzauvfyjs --- addons/email_template/tests/test_mail.py | 82 +++++++++++++++++------- 1 file changed, 59 insertions(+), 23 deletions(-) diff --git a/addons/email_template/tests/test_mail.py b/addons/email_template/tests/test_mail.py index 7af05f38b0e..5db90504db3 100644 --- a/addons/email_template/tests/test_mail.py +++ b/addons/email_template/tests/test_mail.py @@ -32,6 +32,8 @@ class test_message_compose(test_mail.TestMailMockups): self.mail_message = self.registry('mail.message') self.res_users = self.registry('res.users') self.res_partner = self.registry('res.partner') + self.mail_compose = self.registry('mail.compose.message') + self.email_template = self.registry('email.template') # create a 'pigs' and 'bird' groups that will be used through the various tests self.group_pigs_id = self.mail_group.create(self.cr, self.uid, @@ -40,9 +42,8 @@ class test_message_compose(test_mail.TestMailMockups): {'name': 'Bird', 'description': 'I am angry !'}) def test_00_message_compose_wizard(self): - """ Tests designed for the mail.compose.message wizard updated by email_template. """ + """ Tests designed for the mail.compose.message wizard updated by self.email_template. """ cr, uid = self.cr, self.uid - mail_compose = self.registry('mail.compose.message') self.res_users.write(cr, uid, [uid], {'signature': 'Admin', 'email': 'a@a.a'}) user_admin = self.res_users.browse(cr, uid, uid) p_a_id = user_admin.partner_id.id @@ -62,8 +63,7 @@ class test_message_compose(test_mail.TestMailMockups): # Create template on mail.group, with attachments group_model_id = self.registry('ir.model').search(cr, uid, [('model', '=', 'mail.group')])[0] - email_template = self.registry('email.template') - email_template_id = email_template.create(cr, uid, {'model_id': group_model_id, + self.email_template_id = self.email_template.create(cr, uid, {'model_id': group_model_id, 'name': 'Pigs Template', 'subject': '${object.name}', 'body_html': '${object.description}', 'user_signature': True, 'attachment_ids': [(0, 0, _attachments[0]), (0, 0, _attachments[1])], @@ -74,37 +74,37 @@ class test_message_compose(test_mail.TestMailMockups): # ---------------------------------------- # 1. Comment on pigs - compose_id = mail_compose.create(cr, uid, + compose_id = self.mail_compose.create(cr, uid, {'subject': 'Forget me subject', 'body': '

Dummy body

'}, {'default_composition_mode': 'comment', 'default_model': 'mail.group', 'default_res_id': self.group_pigs_id, - 'default_template_id': email_template_id, + 'default_template_id': self.email_template_id, 'active_ids': [self.group_pigs_id, self.group_bird_id]}) - compose = mail_compose.browse(cr, uid, compose_id) + compose = self.mail_compose.browse(cr, uid, compose_id) # 2. Save current composition form as a template - mail_compose.save_as_template(cr, uid, [compose_id], context={'default_model': 'mail.group'}) - # Test: email_template subject, body_html, model - last_template_id = email_template.search(cr, uid, [('model', '=', 'mail.group'), ('subject', '=', 'Forget me subject')], limit=1)[0] - self.assertTrue(last_template_id, 'email_template not found for model mail.group, subject Forget me subject') - last_template = email_template.browse(cr, uid, last_template_id) - self.assertEqual(last_template.body_html, '

Dummy body

', 'email_template incorrect body_html') + self.mail_compose.save_as_template(cr, uid, [compose_id], context={'default_model': 'mail.group'}) + # Test: self.email_template subject, body_html, model + last_template_id = self.email_template.search(cr, uid, [('model', '=', 'mail.group'), ('subject', '=', 'Forget me subject')], limit=1)[0] + self.assertTrue(last_template_id, 'self.email_template not found for model mail.group, subject Forget me subject') + last_template = self.email_template.browse(cr, uid, last_template_id) + self.assertEqual(last_template.body_html, '

Dummy body

', 'self.email_template incorrect body_html') # ---------------------------------------- # CASE2: comment with template, save as template # ---------------------------------------- # 1. Comment on pigs - compose_id = mail_compose.create(cr, uid, + compose_id = self.mail_compose.create(cr, uid, {'subject': 'Forget me subject', 'body': 'Dummy body'}, {'default_composition_mode': 'comment', 'default_model': 'mail.group', 'default_res_id': self.group_pigs_id, - 'default_template_id': email_template_id, + 'default_template_id': self.email_template_id, 'active_ids': [self.group_pigs_id, self.group_bird_id]}) - compose = mail_compose.browse(cr, uid, compose_id) + compose = self.mail_compose.browse(cr, uid, compose_id) # 2. Perform 'toggle_template', to set use_template and use template_id - mail_compose.toggle_template(cr, uid, [compose_id], {'default_composition_mode': 'comment', 'default_model': 'mail.group'}) + self.mail_compose.toggle_template(cr, uid, [compose_id], {'default_composition_mode': 'comment', 'default_model': 'mail.group'}) compose.refresh() message_pids = [partner.id for partner in compose.partner_ids] partner_ids = self.res_partner.search(cr, uid, [('email', 'in', ['b@b.b', 'c@c.c', 'd@d.d'])]) @@ -122,7 +122,7 @@ class test_message_compose(test_mail.TestMailMockups): 'mail.message attachment name / data incorrect') # 3. Perform 'toggle_template': template is not set anymore - mail_compose.toggle_template(cr, uid, [compose_id], {'default_composition_mode': 'comment', 'default_model': 'mail.group'}) + self.mail_compose.toggle_template(cr, uid, [compose_id], {'default_composition_mode': 'comment', 'default_model': 'mail.group'}) compose.refresh() # Test: subject, body, partner_ids self.assertEqual(compose.subject, False, 'mail.compose.message subject incorrect') @@ -133,17 +133,17 @@ class test_message_compose(test_mail.TestMailMockups): # ---------------------------------------- # 1. Mass_mail on pigs and bird, with a default_partner_ids set to check he is correctly added - compose_id = mail_compose.create(cr, uid, + compose_id = self.mail_compose.create(cr, uid, {'subject': 'Forget me subject', 'body': 'Dummy body'}, {'default_composition_mode': 'mass_mail', 'default_model': 'mail.group', 'default_res_id': self.group_pigs_id, - 'default_template_id': email_template_id, + 'default_template_id': self.email_template_id, 'default_partner_ids': [p_a_id], 'active_ids': [self.group_pigs_id, self.group_bird_id]}) - compose = mail_compose.browse(cr, uid, compose_id) + compose = self.mail_compose.browse(cr, uid, compose_id) # 2. Perform 'toggle_template', to set use_template and use template_id - mail_compose.toggle_template(cr, uid, [compose_id], {'default_composition_mode': 'comment', 'default_model': 'mail.group'}) + self.mail_compose.toggle_template(cr, uid, [compose_id], {'default_composition_mode': 'comment', 'default_model': 'mail.group'}) compose.refresh() message_pids = [partner.id for partner in compose.partner_ids] partner_ids = [p_a_id] @@ -154,7 +154,7 @@ class test_message_compose(test_mail.TestMailMockups): self.assertEqual(set(message_pids), set(partner_ids), 'mail.compose.message partner_ids incorrect') # 3. Post the comment, get created message - mail_compose.send_mail(cr, uid, [compose_id], {'default_res_id': -1, 'active_ids': [self.group_pigs_id, self.group_bird_id]}) + self.mail_compose.send_mail(cr, uid, [compose_id], {'default_res_id': -1, 'active_ids': [self.group_pigs_id, self.group_bird_id]}) group_pigs.refresh() group_bird.refresh() message_pigs = group_pigs.message_ids[0] @@ -170,3 +170,39 @@ class test_message_compose(test_mail.TestMailMockups): partner_ids = self.res_partner.search(cr, uid, [('email', 'in', ['b@b.b', 'c@c.c', 'd@d.d'])]) self.assertEqual(set(message_pigs_pids), set(partner_ids), 'mail.message on pigs incorrect number of notified_partner_ids') self.assertEqual(set(message_bird_pids), set(partner_ids), 'mail.message on bird notified_partner_ids incorrect') + + + def test_10_template_email_for_composer(self): + """ Tests designed for message_post. """ + cr, uid = self.cr, self.uid + + # 1 - Bert Tartopoils, with email, object to send message, add his partner_id from email_to + u_a_id = self.res_users.create(cr, uid, {'name': 'Bert Tartopoils', 'email': 'raoul@raoul.fr', 'login': 'raoul'}) + p_a_id = self.res_users.browse(cr, uid, u_a_id).partner_id.id + # 2 - Carine Poilvache, with email, add his partner_id from email_to and email_to_partner + p_b_id = self.res_partner.create(cr, uid, {'name': 'Carine Poilvache', 'email': 'c@c'}) + # 3 - Dédé Grosbedon, without email, add his partner_id from email_to_partner + p_c_id = self.res_partner.create(cr, uid, {'name': 'Dédé Grosbedon'}) + # 4 - Truc Much, without email, add his partner_id from email_cc + p_d_id = self.res_partner.create(cr, uid, {'name': 'Truc Much', 'email': 'd@d'}) + + # Create template on res.users + user_model_id = self.registry('ir.model').search(cr, uid, [('model', '=', 'res.users')])[0] + self.email_template_id = self.email_template.create(cr, uid, { + 'model_id': user_model_id, + 'name': 'Pigs Template', + 'subject': '${object.name}', + 'body_html': '${object.login}', + 'email_to': '${object.email} c@c', + 'email_to_partner': '%i,%i' % (p_b_id, p_c_id), + 'email_cc': 'd@d' + }) + + # patner by email + partner by id (no double) + send_to = [p_a_id, p_b_id, p_c_id, p_d_id]; + + # Generate messsage with default email and partner on template + mail_value = self.mail_compose.generate_email_for_composer(cr, uid, self.email_template_id, u_a_id) + mail_value['partner_ids'].sort() + + self.assertEqual(mail_value['partner_ids'], send_to, 'mail.message the partner_ids list create by template is incorrect') From 42dd7711b59d5c4774ac921123d64fdbbe1181ce Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 7 Nov 2012 12:39:25 +0100 Subject: [PATCH 39/68] [FIX] email_template: change name value and concat test bzr revid: chm@openerp.com-20121107113925-1nmjicj444nez25c --- addons/account/edi/invoice_action_data.xml | 3 +-- addons/email_template/email_template.py | 6 ++--- addons/email_template/email_template_view.xml | 2 +- addons/email_template/tests/test_mail.py | 23 ++++++++----------- .../wizard/email_template_preview_view.xml | 2 +- .../wizard/mail_compose_message.py | 4 ++-- .../edi/purchase_order_action_data.xml | 3 +-- 7 files changed, 18 insertions(+), 25 deletions(-) diff --git a/addons/account/edi/invoice_action_data.xml b/addons/account/edi/invoice_action_data.xml index e19b4df5c27..d86ebca3537 100644 --- a/addons/account/edi/invoice_action_data.xml +++ b/addons/account/edi/invoice_action_data.xml @@ -40,8 +40,7 @@ Automated Invoice Notification Mail ${object.user_id.email or object.company_id.email or 'noreply@localhost'} ${object.company_id.name} Invoice (Ref ${object.number or 'n/a' }) - ${object.partner_id.email or ''} - ${object.partner_id.id} + ${object.partner_id.id} - + diff --git a/addons/email_template/tests/test_mail.py b/addons/email_template/tests/test_mail.py index 5db90504db3..769a1c2f9f7 100644 --- a/addons/email_template/tests/test_mail.py +++ b/addons/email_template/tests/test_mail.py @@ -172,20 +172,18 @@ class test_message_compose(test_mail.TestMailMockups): self.assertEqual(set(message_bird_pids), set(partner_ids), 'mail.message on bird notified_partner_ids incorrect') - def test_10_template_email_for_composer(self): - """ Tests designed for message_post. """ - cr, uid = self.cr, self.uid + # ---------------------------------------- + # CASE4: Created message with template, test recipients + # ---------------------------------------- - # 1 - Bert Tartopoils, with email, object to send message, add his partner_id from email_to - u_a_id = self.res_users.create(cr, uid, {'name': 'Bert Tartopoils', 'email': 'raoul@raoul.fr', 'login': 'raoul'}) - p_a_id = self.res_users.browse(cr, uid, u_a_id).partner_id.id - # 2 - Carine Poilvache, with email, add his partner_id from email_to and email_to_partner + # 1 - Admin, with email, object to send message, add his partner_id from email_to + # p_a_id + # 2 - Carine Poilvache, with email, add his partner_id from email_to and email_recipients p_b_id = self.res_partner.create(cr, uid, {'name': 'Carine Poilvache', 'email': 'c@c'}) - # 3 - Dédé Grosbedon, without email, add his partner_id from email_to_partner + # 3 - Dédé Grosbedon, without email, add his partner_id from email_recipients p_c_id = self.res_partner.create(cr, uid, {'name': 'Dédé Grosbedon'}) # 4 - Truc Much, without email, add his partner_id from email_cc p_d_id = self.res_partner.create(cr, uid, {'name': 'Truc Much', 'email': 'd@d'}) - # Create template on res.users user_model_id = self.registry('ir.model').search(cr, uid, [('model', '=', 'res.users')])[0] self.email_template_id = self.email_template.create(cr, uid, { @@ -194,15 +192,12 @@ class test_message_compose(test_mail.TestMailMockups): 'subject': '${object.name}', 'body_html': '${object.login}', 'email_to': '${object.email} c@c', - 'email_to_partner': '%i,%i' % (p_b_id, p_c_id), + 'email_recipients': '%i,%i' % (p_b_id, p_c_id), 'email_cc': 'd@d' }) # patner by email + partner by id (no double) send_to = [p_a_id, p_b_id, p_c_id, p_d_id]; - # Generate messsage with default email and partner on template mail_value = self.mail_compose.generate_email_for_composer(cr, uid, self.email_template_id, u_a_id) - mail_value['partner_ids'].sort() - - self.assertEqual(mail_value['partner_ids'], send_to, 'mail.message the partner_ids list create by template is incorrect') + self.assertEqual(set(mail_value['partner_ids']), set(send_to), 'mail.message the partner_ids list create by template is incorrect') diff --git a/addons/email_template/wizard/email_template_preview_view.xml b/addons/email_template/wizard/email_template_preview_view.xml index a3dbf40ad70..8dd4bc92ba7 100644 --- a/addons/email_template/wizard/email_template_preview_view.xml +++ b/addons/email_template/wizard/email_template_preview_view.xml @@ -17,7 +17,7 @@ - + diff --git a/addons/email_template/wizard/mail_compose_message.py b/addons/email_template/wizard/mail_compose_message.py index 49f66734ae6..1f69377cf53 100644 --- a/addons/email_template/wizard/mail_compose_message.py +++ b/addons/email_template/wizard/mail_compose_message.py @@ -148,7 +148,7 @@ class mail_compose_message(osv.TransientModel): mail.compose.message, transform email_cc and email_to into partner_ids """ template_values = self.pool.get('email.template').generate_email(cr, uid, template_id, res_id, context=context) # filter template values - fields = ['body', 'body_html', 'subject', 'email_to', 'email_to_partner', 'email_cc', 'attachments'] + fields = ['body', 'body_html', 'subject', 'email_to', 'email_recipients', 'email_cc', 'attachments'] values = dict((field, template_values[field]) for field in fields if template_values.get(field)) values['body'] = values.pop('body_html', '') # transform email_to, email_cc into partner_ids @@ -159,7 +159,7 @@ class mail_compose_message(osv.TransientModel): partner_id = self.pool.get('res.partner').find_or_create(cr, uid, mail, context=context) values['partner_ids'].append(partner_id) - partner_ids = values.pop('email_to_partner', '').split(',') + partner_ids = values.pop('email_recipients', '').split(',') for partner_id in partner_ids: if partner_id: values['partner_ids'].append(int(partner_id)) diff --git a/addons/purchase/edi/purchase_order_action_data.xml b/addons/purchase/edi/purchase_order_action_data.xml index 8464c533696..fab7eeacf6c 100644 --- a/addons/purchase/edi/purchase_order_action_data.xml +++ b/addons/purchase/edi/purchase_order_action_data.xml @@ -40,8 +40,7 @@ Automated Purchase Order Notification Mail ${object.validator.email or ''} ${object.company_id.name} Order (Ref ${object.name or 'n/a' }) - ${object.partner_id.email or ''} - ${object.partner_id.id} + ${object.partner_id.id} Date: Wed, 7 Nov 2012 16:22:20 +0100 Subject: [PATCH 40/68] [FIX] Remove icon in Import Invoice button, added Journal Entries button. bzr revid: vta@openerp.com-20121107152220-20k5s5i37bem6gug --- addons/account/account_view.xml | 12 ++++++++++++ addons/account_voucher/account_voucher_view.xml | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 8441c8dbfc9..7931668d6ef 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -680,6 +680,18 @@
+ + account.bank.statement.journal.items.form.inherit + account.bank.statement + + + +
- From 7d745f7195827088b9f01648effcaf5e0a4797f7 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 13 Nov 2012 11:14:48 +0100 Subject: [PATCH 49/68] [FIX] comment jquery ui bootstrap global styling bzr revid: fme@openerp.com-20121113101448-a3603utoogsvvjta --- .../css/custom-theme/jquery-ui-1.9.0.custom.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/web/static/lib/jquery.ui.bootstrap/css/custom-theme/jquery-ui-1.9.0.custom.css b/addons/web/static/lib/jquery.ui.bootstrap/css/custom-theme/jquery-ui-1.9.0.custom.css index a06e9447afc..f19c56caed1 100644 --- a/addons/web/static/lib/jquery.ui.bootstrap/css/custom-theme/jquery-ui-1.9.0.custom.css +++ b/addons/web/static/lib/jquery.ui.bootstrap/css/custom-theme/jquery-ui-1.9.0.custom.css @@ -1115,7 +1115,7 @@ body .ui-tooltip { border-width:2px; } /*** Input field styling from Bootstrap **/ - input, textarea { +/* input, textarea { -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; -moz-transition: border linear 0.2s, box-shadow linear 0.2s; -ms-transition: border linear 0.2s, box-shadow linear 0.2s; @@ -1137,12 +1137,12 @@ input[type=file]:focus, input[type=checkbox]:focus, select:focus { -moz-box-shadow: none; box-shadow: none; outline: 1px dotted #666; -} +}*/ -input[type="text"], -input[type="password"], +/*input[type="text"], +input[type="password"],*/ .ui-autocomplete-input, -textarea, +/*textarea,*/ .uneditable-input { display: inline-block; padding: 4px; From 22edf6193dda6bd1e966b34a7fc80687473b1cf9 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 13 Nov 2012 11:44:07 +0100 Subject: [PATCH 50/68] [FIX] listview display when action button deletes the corresponding record if a record has disappeared between activating a button and refreshing the record, remove it from the list view lp bug: https://launchpad.net/bugs/1042718 fixed bzr revid: xmo@openerp.com-20121113104407-n924vinluqfdtesf --- addons/web/static/src/js/view_list.js | 5 ++ addons/web/static/test/list.js | 68 +++++++++++++++++++++++++++ addons/web/static/test/test.html | 1 + 3 files changed, 74 insertions(+) create mode 100644 addons/web/static/test/list.js diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 3d777b381bb..321faf40c0f 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -503,12 +503,17 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi return this.reload_content(); }, reload_record: function (record) { + var self = this; return this.dataset.read_ids( [record.get('id')], _.pluck(_(this.columns).filter(function (r) { return r.tag === 'field'; }), 'name') ).done(function (records) { + if (!records[0]) { + self.records.remove(record); + return; + } _(records[0]).each(function (value, key) { record.set(key, value, {silent: true}); }); diff --git a/addons/web/static/test/list.js b/addons/web/static/test/list.js new file mode 100644 index 00000000000..63cc16a5022 --- /dev/null +++ b/addons/web/static/test/list.js @@ -0,0 +1,68 @@ +$(document).ready(function () { + var instance; + var $fix = $('#qunit-fixture'); + + module('list.buttons', { + setup: function () { + instance = openerp.testing.instanceFor('list'); + + openerp.testing.loadTemplate(instance); + + openerp.testing.mockifyRPC(instance); + } + }); + asyncTest('record-deletion', 2, function () { + instance.session.responses['/web/view/load'] = function () { + return {result: { + type: 'tree', + fields: { + a: {type: 'char', string: "A"} + }, + arch: { + tag: 'tree', + attrs: { }, + children: [ + {tag: 'field', attrs: {name: 'a'}}, + {tag: 'button', attrs: {type: 'object', name: 'foo'}} + ] + } + }}; + }; + instance.session.responses['/web/dataset/call_kw:read'] = function (req) { + var args = req.params.args[0]; + if (_.isEqual(args, [1, 2, 3])) { + return {result: [ + {id: 1, a: 'foo'}, {id: 2, a: 'bar'}, {id: 3, a: 'baz'} + ]}; + } else if (_.isEqual(args, [2])) { + // button action virtually removed record + return {result: []}; + } + throw new Error(JSON.stringify(req.params)); + }; + instance.session.responses['/web/dataset/call_button'] = function () { + return {result: false}; + }; + var ds = new instance.web.DataSetStatic(null, 'demo', null, [1, 2, 3]); + var l = new instance.web.ListView({}, ds, false, {editable: 'top'}); + l.appendTo($fix) + .then(l.proxy('reload_content')) + .then(function () { + var d = $.Deferred(); + l.records.bind('remove', function () { + d.resolve(); + }); + $fix.find('table tbody tr:eq(1) button').click(); + return d.promise(); + }) + .always(function () { start(); }) + .then(function () { + strictEqual(l.records.length, 2, + "should have 2 records left"); + strictEqual($fix.find('table tbody tr[data-id]').length, 2, + "should have 2 rows left"); + }, function (e) { + ok(false, e && e.message || e); + }); + }); +}); diff --git a/addons/web/static/test/test.html b/addons/web/static/test/test.html index 185125659cc..275db0f37a7 100644 --- a/addons/web/static/test/test.html +++ b/addons/web/static/test/test.html @@ -58,5 +58,6 @@ + From ea4eb01ac15ddf2fbe1b3e0e2649d72eaf706e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 13 Nov 2012 12:20:38 +0100 Subject: [PATCH 51/68] [FIX] sale, purchase, account: send by email button calls the mail.compose.message in comment mode. bzr revid: tde@openerp.com-20121113112038-hwp41jldofq1al6k --- addons/account/account_invoice.py | 1 + addons/purchase/purchase.py | 1 + addons/sale/sale.py | 1 + 3 files changed, 3 insertions(+) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index b37118c3baa..409551585fa 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -402,6 +402,7 @@ class account_invoice(osv.osv): 'default_res_id': ids[0], 'default_use_template': True, 'default_template_id': template_id, + 'default_composition_mode': 'comment', }) return { 'view_type': 'form', diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 0227e74905f..5bb38316604 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -395,6 +395,7 @@ class purchase_order(osv.osv): 'default_res_id': ids[0], 'default_use_template': True, 'default_template_id': template_id, + 'default_composition_mode': 'comment', }) return { 'view_type': 'form', diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 3c21492827f..5fe84c34bc3 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -645,6 +645,7 @@ class sale_order(osv.osv): 'default_res_id': ids[0], 'default_use_template': True, 'default_template_id': template_id, + 'default_composition_mode': 'comment', 'mark_so_as_sent': True }) return { From a370d1c0598a52b4a2020289620d45a27e65a36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 13 Nov 2012 12:36:25 +0100 Subject: [PATCH 52/68] [IMP] email_template: relooked a bit the mail.compose.message wizard, use_template by default, on bottom-right choose the template; rendre only when use_template and template_id set. bzr revid: tde@openerp.com-20121113113625-fg3jp3047gnrx2wr --- .../wizard/mail_compose_message.py | 9 ++++-- .../wizard/mail_compose_message_view.xml | 32 +++++++++---------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/addons/email_template/wizard/mail_compose_message.py b/addons/email_template/wizard/mail_compose_message.py index 1f69377cf53..742f9646406 100644 --- a/addons/email_template/wizard/mail_compose_message.py +++ b/addons/email_template/wizard/mail_compose_message.py @@ -52,8 +52,9 @@ class mail_compose_message(osv.TransientModel): context = {} result = super(mail_compose_message, self).default_get(cr, uid, fields, context=context) result['template_id'] = context.get('default_template_id', context.get('mail.compose.template_id', False)) + # pre-render the template if any - if result.get('use_template'): + if result.get('use_template') and result.get('template_id'): onchange_res = self.onchange_use_template(cr, uid, [], result.get('use_template'), result.get('template_id'), result.get('composition_mode'), result.get('model'), result.get('res_id'), context=context) result.update(onchange_res['value']) @@ -65,6 +66,10 @@ class mail_compose_message(osv.TransientModel): 'template_id': fields.selection(_get_templates, 'Template', size=-1), } + _defaults = { + 'use_template': True, + } + def onchange_template_id(self, cr, uid, ids, use_template, template_id, composition_mode, model, res_id, context=None): """ - use_template not set: return default_get - use_template set in mass_mailing: we cannot render, so return the template values @@ -154,7 +159,7 @@ class mail_compose_message(osv.TransientModel): # transform email_to, email_cc into partner_ids values['partner_ids'] = [] - mails = tools.email_split( values.pop('email_to', '') + ' ' + values.pop('email_cc', '') ) + mails = tools.email_split(values.pop('email_to', '') + ' ' + values.pop('email_cc', '')) for mail in mails: partner_id = self.pool.get('res.partner').find_or_create(cr, uid, mail, context=context) values['partner_ids'].append(partner_id) diff --git a/addons/email_template/wizard/mail_compose_message_view.xml b/addons/email_template/wizard/mail_compose_message_view.xml index 05d0e8dffa1..0a530299d4a 100644 --- a/addons/email_template/wizard/mail_compose_message_view.xml +++ b/addons/email_template/wizard/mail_compose_message_view.xml @@ -8,23 +8,23 @@ - - - - - + + - -