diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 823bb56a7a9..271cc92e41c 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -120,7 +120,6 @@ module named account_voucher. 'project/analytic_account_demo.xml', 'demo/account_minimal.xml', 'account_unit_test.xml', - 'board_account_demo.xml', ], 'test': [ 'test/account_customer_invoice.yml', diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py index 7a66dd4f175..bb13f1a5776 100644 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -75,6 +75,9 @@ class account_analytic_line(osv.osv): unit=False, journal_id=False, context=None): if context==None: context={} + if not journal_id: + j_ids = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=','purchase')]) + j_id = j_ids and j_ids[0] or False if not journal_id or not prod_id: return {} product_obj = self.pool.get('product.product') @@ -86,7 +89,7 @@ class account_analytic_line(osv.osv): result = 0.0 is_purchase = False - if j_id.type == 'purchase': + if j_id.type <> 'sale': a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id diff --git a/addons/account/board_account_demo.xml b/addons/account/board_account_demo.xml deleted file mode 100644 index 93bfed6d56d..00000000000 --- a/addons/account/board_account_demo.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/addons/account/i18n/ru.po b/addons/account/i18n/ru.po index 13a7c72dd5d..2a253811120 100644 --- a/addons/account/i18n/ru.po +++ b/addons/account/i18n/ru.po @@ -7,13 +7,13 @@ msgstr "" "Project-Id-Version: OpenERP Server 6.0dev\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-08-28 16:01+0000\n" -"PO-Revision-Date: 2010-10-03 09:42+0000\n" +"PO-Revision-Date: 2010-10-04 06:51+0000\n" "Last-Translator: Chertykov Denis \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-10-04 04:57+0000\n" +"X-Launchpad-Export-Date: 2010-10-05 04:57+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account diff --git a/addons/account/process/customer_invoice_process.xml b/addons/account/process/customer_invoice_process.xml index 51e8254d20e..b34dca0dbb9 100644 --- a/addons/account/process/customer_invoice_process.xml +++ b/addons/account/process/customer_invoice_process.xml @@ -122,7 +122,6 @@ --> - @@ -131,7 +130,6 @@ - @@ -140,7 +138,6 @@ - @@ -150,7 +147,6 @@ - @@ -159,7 +155,6 @@ - @@ -168,7 +163,6 @@ - @@ -177,7 +171,6 @@ - @@ -186,7 +179,6 @@ - diff --git a/addons/account/process/statement_process.xml b/addons/account/process/statement_process.xml index 704f9f47025..01fd4bc1bfe 100644 --- a/addons/account/process/statement_process.xml +++ b/addons/account/process/statement_process.xml @@ -65,7 +65,6 @@ --> - @@ -74,7 +73,6 @@ - @@ -84,7 +82,6 @@ - diff --git a/addons/account/process/supplier_invoice_process.xml b/addons/account/process/supplier_invoice_process.xml index e24431c48b4..8635b083d72 100644 --- a/addons/account/process/supplier_invoice_process.xml +++ b/addons/account/process/supplier_invoice_process.xml @@ -1,21 +1,21 @@ - - - + - - - + @@ -26,7 +26,7 @@ - + @@ -37,7 +37,7 @@ - + @@ -48,7 +48,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -70,7 +70,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -92,7 +92,7 @@ - + @@ -103,22 +103,20 @@ - - - + - - + - @@ -126,51 +124,46 @@ - + - - + - - + - - + - - + - - + diff --git a/addons/account/project/project.py b/addons/account/project/project.py index 431d486592b..f082672310e 100644 --- a/addons/account/project/project.py +++ b/addons/account/project/project.py @@ -28,8 +28,8 @@ from osv import osv class account_analytic_journal(osv.osv): _name = 'account.analytic.journal' _columns = { - 'name' : fields.char('Journal name', size=64, required=True), - 'code' : fields.char('Journal code', size=8), + 'name' : fields.char('Journal Name', size=64, required=True), + 'code' : fields.char('Journal Code', size=8), 'active' : fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the analytic journal without removing it."), 'type': fields.selection([('sale','Sale'), ('purchase','Purchase'), ('cash','Cash'), ('general','General'), ('situation','Situation')], 'Type', size=32, required=True, help="Gives the type of the analytic journal. When it needs for a document (eg: an invoice) to create analytic entries, OpenERP will look for a matching journal of the same type."), 'line_ids' : fields.one2many('account.analytic.line', 'journal_id', 'Lines'), diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index 0d335118d3b..fd52619fb10 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -172,19 +172,16 @@ tree - + + - - - - - - - - - - - + + + + + + + @@ -195,22 +192,24 @@ - - + + + - - - - - - + + + + + + - - + + + - + diff --git a/addons/account/report/invoice.rml b/addons/account/report/invoice.rml index 6c3c6fc01c3..173cbd1e6c4 100644 --- a/addons/account/report/invoice.rml +++ b/addons/account/report/invoice.rml @@ -232,10 +232,10 @@ [[ formatLang(l.price_unit) ]][[ o.currency_id.symbol ]] - [[ formatLang(l.discount) ]] + [[ formatLang(l.discount, digits=get_digits(dp='Account')) ]] - [[ formatLang(l.price_subtotal) ]] [[ o.currency_id.symbol ]] + [[ formatLang(l.price_subtotal, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]] @@ -294,7 +294,7 @@ Taxes: - [[ formatLang(o.amount_tax) ]] [[ o.currency_id.symbol ]] + [[ formatLang(o.amount_tax, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]] @@ -338,7 +338,7 @@ [[ t.name ]] - [[ formatLang(t.base) ]] [[ o.currency_id.symbol ]] + [[ formatLang(t.base, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]] [[ (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable') or '' ]] [[ formatLang(t.amount) ]] [[ o.currency_id.symbol ]] @@ -373,4 +373,4 @@ - \ No newline at end of file + diff --git a/addons/account/report/rml_parse.py b/addons/account/report/rml_parse.py index cc8299bcecf..0c7018ae290 100644 --- a/addons/account/report/rml_parse.py +++ b/addons/account/report/rml_parse.py @@ -21,12 +21,10 @@ from report import report_sxw import xml.dom.minidom -import os, time +import time import osv import re -import tools import pooler -import re import sys diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index 5a393e1dd83..d9e9bf3907b 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -23,6 +23,8 @@ from osv import osv, fields from osv.orm import intersect import tools.sql from tools.translate import _ +from decimal_precision import decimal_precision as dp + class account_analytic_account(osv.osv): _name = "account.analytic.account" @@ -66,6 +68,8 @@ class account_analytic_account(osv.osv): and invoice_id is not null \ GROUP BY account_analytic_line.account_id;", (parent_ids,)) for account_id, sum in cr.fetchall(): + if account_id not in res: + res[account_id] = {} res[account_id][f] = sum for account in accounts: for child in account.child_ids: @@ -102,6 +106,8 @@ class account_analytic_account(osv.osv): and account_analytic_journal.type in ('purchase','general') \ GROUP BY account_analytic_account.id;""", (parent_ids,)) for account_id, sum in cr.fetchall(): + if account_id not in res: + res[account_id] = {} res[account_id][f] = round(sum, dp) for account in accounts: @@ -142,6 +148,8 @@ class account_analytic_account(osv.osv): and invoice_id is null \ GROUP BY account_analytic_line.account_id" ,(parent_ids,)) for account_id, lwd in cr.fetchall(): + if account_id not in res: + res[account_id] = {} res[account_id][f] = lwd for account in accounts: for child in account.child_ids: @@ -161,6 +169,8 @@ class account_analytic_account(osv.osv): AND to_invoice IS NOT NULL \ GROUP BY account_analytic_line.account_id;",(parent_ids,)) for account_id, sua in cr.fetchall(): + if account_id not in res: + res[account_id] = {} res[account_id][f] = round(sua, dp) for account in accounts: for child in account.child_ids: @@ -181,10 +191,14 @@ class account_analytic_account(osv.osv): GROUP BY account_analytic_line.account_id",(parent_ids,)) ff = cr.fetchall() for account_id, hq in ff: + if account_id not in res: + res[account_id] = {} res[account_id][f] = round(hq, dp) for account in accounts: for child in account.child_ids: if account.id != child.id: + if account.id not in res: + res[account.id] = {f: 0.0} res[account.id][f] += res.get(child.id, {}).get(f, 0.0) for id in ids: res[id][f] = round(res[id][f], dp) @@ -223,6 +237,8 @@ class account_analytic_account(osv.osv): res2.setdefault(account.id, 0.0) for child in account.child_ids: if account.id != child.id: + if account.id not in res: + res[account.id] = {f: 0.0} res[account.id][f] += res.get(child.id, {}).get(f, 0.0) res[account.id][f] += res2.get(child.id, 0.0) @@ -337,22 +353,47 @@ class account_analytic_account(osv.osv): return res _columns ={ - 'ca_invoiced': fields.function(_ca_invoiced_calc, method=True, type='float', string='Invoiced Amount', help="Total customer invoiced amount for this account."), - 'total_cost': fields.function(_total_cost_calc, method=True, type='float', string='Total Costs', help="Total of costs for this account. It includes real costs (from invoices) and indirect costs, like time spent on timesheets."), - 'ca_to_invoice': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Uninvoiced Amount', help="If invoice from analytic account, the remaining amount you can invoice to the customer based on the total costs."), - 'ca_theorical': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Theorical Revenue', help="Based on the costs you had on the project, what would have been the revenue if all these costs have been invoiced at the normal sale price provided by the pricelist."), - 'hours_quantity': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Hours Tot', help="Number of hours you spent on the analytic account (from timesheet). It computes on all journal of type 'general'."), - 'last_invoice_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Last Invoice Date', help="Date of the last invoice created for this analytic account."), - 'last_worked_invoiced_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Invoiced Cost', help="If invoice from the costs, this is the date of the latest work or cost that have been invoiced."), - 'last_worked_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Cost/Work', help="Date of the latest work done on this account."), - 'hours_qtt_non_invoiced': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Uninvoiced Hours', help="Number of hours (from journal of type 'general') that can be invoiced if you invoice based on analytic account."), - 'hours_qtt_invoiced': fields.function(_hours_qtt_invoiced_calc, method=True, type='float', string='Invoiced Hours', help="Number of hours that can be invoiced plus those that already have been invoiced."), - 'remaining_hours': fields.function(_remaining_hours_calc, method=True, type='float', string='Remaining Hours', help="Computed using the formula: Maximum Quantity - Hours Tot."), - 'remaining_ca': fields.function(_remaining_ca_calc, method=True, type='float', string='Remaining Revenue', help="Computed using the formula: Max Invoice Price - Invoiced Amount."), - 'revenue_per_hour': fields.function(_revenue_per_hour_calc, method=True, type='float', string='Revenue per Hours (real)', help="Computed using the formula: Invoiced Amount / Hours Tot."), - 'real_margin': fields.function(_real_margin_calc, method=True, type='float', string='Real Margin', help="Computed using the formula: Invoiced Amount - Total Costs."), - 'theorical_margin': fields.function(_theorical_margin_calc, method=True, type='float', string='Theorical Margin', help="Computed using the formula: Theorial Revenue - Total Costs"), - 'real_margin_rate': fields.function(_real_margin_rate_calc, method=True, type='float', string='Real Margin Rate (%)', help="Computes using the formula: (Real Margin / Total Costs) * 100."), + 'ca_invoiced': fields.function(_ca_invoiced_calc, method=True, type='float', string='Invoiced Amount', + help="Total customer invoiced amount for this account.", + digits_compute=dp.get_precision('Account')), + 'total_cost': fields.function(_total_cost_calc, method=True, type='float', string='Total Costs', + help="Total of costs for this account. It includes real costs (from invoices) and indirect costs, like time spent on timesheets.", + digits_compute=dp.get_precision('Account')), + 'ca_to_invoice': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Uninvoiced Amount', + help="If invoice from analytic account, the remaining amount you can invoice to the customer based on the total costs.", + digits_compute=dp.get_precision('Account')), + 'ca_theorical': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Theorical Revenue', + help="Based on the costs you had on the project, what would have been the revenue if all these costs have been invoiced at the normal sale price provided by the pricelist.", + digits_compute=dp.get_precision('Account')), + 'hours_quantity': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Hours Tot', + help="Number of hours you spent on the analytic account (from timesheet). It computes on all journal of type 'general'."), + 'last_invoice_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Last Invoice Date', + help="Date of the last invoice created for this analytic account."), + 'last_worked_invoiced_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Invoiced Cost', + help="If invoice from the costs, this is the date of the latest work or cost that have been invoiced."), + 'last_worked_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Cost/Work', + help="Date of the latest work done on this account."), + 'hours_qtt_non_invoiced': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Uninvoiced Hours', + help="Number of hours (from journal of type 'general') that can be invoiced if you invoice based on analytic account."), + 'hours_qtt_invoiced': fields.function(_hours_qtt_invoiced_calc, method=True, type='float', string='Invoiced Hours', + help="Number of hours that can be invoiced plus those that already have been invoiced."), + 'remaining_hours': fields.function(_remaining_hours_calc, method=True, type='float', string='Remaining Hours', + help="Computed using the formula: Maximum Quantity - Hours Tot."), + 'remaining_ca': fields.function(_remaining_ca_calc, method=True, type='float', string='Remaining Revenue', + help="Computed using the formula: Max Invoice Price - Invoiced Amount.", + digits_compute=dp.get_precision('Account')), + 'revenue_per_hour': fields.function(_revenue_per_hour_calc, method=True, type='float', string='Revenue per Hours (real)', + help="Computed using the formula: Invoiced Amount / Hours Tot.", + digits_compute=dp.get_precision('Account')), + 'real_margin': fields.function(_real_margin_calc, method=True, type='float', string='Real Margin', + help="Computed using the formula: Invoiced Amount - Total Costs.", + digits_compute=dp.get_precision('Account')), + 'theorical_margin': fields.function(_theorical_margin_calc, method=True, type='float', string='Theorical Margin', + help="Computed using the formula: Theorial Revenue - Total Costs", + digits_compute=dp.get_precision('Account')), + 'real_margin_rate': fields.function(_real_margin_rate_calc, method=True, type='float', string='Real Margin Rate (%)', + help="Computes using the formula: (Real Margin / Total Costs) * 100.", + digits_compute=dp.get_precision('Account')), 'month_ids': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='many2many', relation='account_analytic_analysis.summary.month', string='Month'), 'user_ids': fields.function(_analysis_all, method=True, multi='analytic_analysis', type="many2many", relation='account_analytic_analysis.summary.user', string='User'), } diff --git a/addons/account_budget/crossovered_budget_workflow.xml b/addons/account_budget/crossovered_budget_workflow.xml index f304775bcca..16997d694f2 100644 --- a/addons/account_budget/crossovered_budget_workflow.xml +++ b/addons/account_budget/crossovered_budget_workflow.xml @@ -65,28 +65,24 @@ validate - cancel - cancel - done - diff --git a/addons/account_invoice_layout/account_invoice_layout.py b/addons/account_invoice_layout/account_invoice_layout.py index adb80d787a0..2c2a02d4b9d 100644 --- a/addons/account_invoice_layout/account_invoice_layout.py +++ b/addons/account_invoice_layout/account_invoice_layout.py @@ -130,19 +130,22 @@ class account_invoice_line(osv.osv): default['state'] = self.browse(cr, uid, id).state return super(account_invoice_line, self).copy_data(cr, uid, id, default, context) - def _fnct(self, cr, uid, id, name, args, context=None): + def _fnct(self, cr, uid, ids, name, args, context=None): res = {} - for m in self.browse(cr, uid, id): - if m.state != 'article': - if m.state == 'line': - res[m.id] = '-----------------------------------------' - elif m.state == 'break': - res[m.id] = 'PAGE BREAK' + + lines = self.browse(cr, uid, ids) + account_ids = [line.account_id.id for line in lines] + account_names = dict(self.pool.get('account.account').name_get(cr, uid, account_ids, context=context)) + for line in lines: + if line.state != 'article': + if line.state == 'line': + res[line.id] = '-----------------------------------------' + elif line.state == 'break': + res[line.id] = 'PAGE BREAK' else: - res[m.id] = ' ' + res[line.id] = ' ' else: - [(temp)] = self.pool.get('account.account').name_get(cr, uid, [m.account_id.id], context=context) - res[m.id] = temp[1] + res[line.id] = account_names.get(line.account_id.id, '') return res _name = "account.invoice.line" @@ -205,4 +208,4 @@ class account_invoice(osv.osv): account_invoice() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_invoice_layout/report/report_account_invoice_layout.py b/addons/account_invoice_layout/report/report_account_invoice_layout.py index e28d98479b1..f61a05fd5f4 100644 --- a/addons/account_invoice_layout/report/report_account_invoice_layout.py +++ b/addons/account_invoice_layout/report/report_account_invoice_layout.py @@ -23,6 +23,7 @@ import time from report import report_sxw + class account_invoice_1(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(account_invoice_1, self).__init__(cr, uid, name, context=context) @@ -33,112 +34,111 @@ class account_invoice_1(report_sxw.rml_parse): self.context = context self._node = None - def invoice_lines(self,invoice): - result =[] - sub_total={} - info=[] - invoice_list=[] - res={} - list_in_seq={} + def invoice_lines(self, invoice): + result = [] + sub_total = {} + info = [] + invoice_list = [] + res = {} + list_in_seq = {} ids = self.pool.get('account.invoice.line').search(self.cr, self.uid, [('invoice_id', '=', invoice.id)]) ids.sort() - for id in range(0,len(ids)): + for id in range(0, len(ids)): info = self.pool.get('account.invoice.line').browse(self.cr, self.uid, ids[id], self.context.copy()) - list_in_seq[info]=info.sequence - i=1 - j=0 + list_in_seq[info] = info.sequence + i = 1 + j = 0 final=sorted(list_in_seq.items(), lambda x, y: cmp(x[1], y[1])) - invoice_list=[x[0] for x in final] - sum_flag={} - sum_flag[j]=-1 + invoice_list = [x[0] for x in final] + sum_flag = {} + sum_flag[j] = -1 for entry in invoice_list: - res={} - if entry.state=='article': + res = {} + if entry.state == 'article': self.cr.execute('select tax_id from account_invoice_line_tax where invoice_line_id=%s', (entry.id,)) - tax_ids=self.cr.fetchall() - if tax_ids==[]: - res['tax_types']='' + tax_ids = self.cr.fetchall() + if tax_ids == []: + res['tax_types'] = '' else: - tax_names_dict={} - for item in range(0,len(tax_ids)) : + tax_names_dict = {} + for item in range(0, len(tax_ids)): self.cr.execute('select name from account_tax where id=%s', (tax_ids[item][0],)) - type=self.cr.fetchone() - tax_names_dict[item] =type[0] - tax_names = ','.join([tax_names_dict[x] for x in range(0,len(tax_names_dict))]) - res['tax_types']=tax_names - res['name']=entry.name - res['quantity']="%.2f"%(entry.quantity) - res['price_unit']="%.2f"%(entry.price_unit) - res['discount']="%.2f"%(entry.discount) - res['price_subtotal']="%.2f"%(entry.price_subtotal) - sub_total[i]=entry.price_subtotal - i=i+1 - res['note']=entry.note - res['currency']=invoice.currency_id.symbol - res['type']=entry.state + type = self.cr.fetchone() + tax_names_dict[item] = type[0] + tax_names = ','.join([tax_names_dict[x] for x in range(0, len(tax_names_dict))]) + res['tax_types'] = tax_names + res['name'] = entry.name + res['quantity'] = self.formatLang(entry.quantity, digits=self.get_digits(dp='Account')) + res['price_unit'] = self.formatLang(entry.price_unit, digits=self.get_digits(dp='Account')) + res['discount'] = self.formatLang(entry.discount, digits=self.get_digits(dp='Account')) + res['price_subtotal'] = self.formatLang(entry.price_subtotal, digits=self.get_digits(dp='Account')) + sub_total[i] = entry.price_subtotal + i = i + 1 + res['note'] = entry.note + res['currency'] = invoice.currency_id.symbol + res['type'] = entry.state - if entry.uos_id.id==False: - res['uos']='' + if entry.uos_id.id == False: + res['uos'] = '' else: uos_name = self.pool.get('product.uom').read(self.cr, self.uid, entry.uos_id.id, ['name'], self.context.copy()) res['uos'] = uos_name['name'] else: + res['quantity'] = '' + res['price_unit'] = '' + res['discount'] = '' + res['tax_types'] = '' + res['type'] = entry.state + res['note'] = entry.note + res['uos'] = '' - res['quantity']='' - res['price_unit']='' - res['discount']='' - res['tax_types']='' - res['type']=entry.state - res['note']=entry.note - res['uos']='' - - if entry.state=='subtotal': - res['name']=entry.name - sum=0 - sum_id=0 - if sum_flag[j]==-1: - temp=1 + if entry.state == 'subtotal': + res['name'] = entry.name + sum = 0 + sum_id = 0 + if sum_flag[j] == -1: + temp = 1 else: - temp=sum_flag[j] + temp = sum_flag[j] - for sum_id in range(temp,len(sub_total)+1): - sum+=sub_total[sum_id] - sum_flag[j+1]= sum_id +1 + for sum_id in range(temp, len(sub_total)+1): + sum += sub_total[sum_id] + sum_flag[j+1] = sum_id +1 - j=j+1 - res['price_subtotal']="%.2f"%(sum) - res['currency']=invoice.currency_id.symbol - res['quantity']='' - res['price_unit']='' - res['discount']='' - res['tax_types']='' - res['uos']='' - elif entry.state=='title': - res['name']=entry.name - res['price_subtotal']='' - res['currency']='' - elif entry.state=='text': - res['name']=entry.name - res['price_subtotal']='' - res['currency']='' - elif entry.state=='line': - res['quantity']='_______________' - res['price_unit']='______________' - res['discount']='____________' - res['tax_types']='____________________' - res['uos']='_____' - res['name']='_______________________________________________' - res['price_subtotal']='____________' - res['currency']='____' - elif entry.state=='break': - res['type']=entry.state - res['name']=entry.name - res['price_subtotal']='' - res['currency']='' + j = j + 1 + res['price_subtotal'] = "%.2f" % (sum) + res['currency'] = invoice.currency_id.symbol + res['quantity'] = '' + res['price_unit'] = '' + res['discount'] = '' + res['tax_types'] = '' + res['uos'] = '' + elif entry.state == 'title': + res['name'] = entry.name + res['price_subtotal'] = '' + res['currency'] = '' + elif entry.state == 'text': + res['name'] = entry.name + res['price_subtotal'] = '' + res['currency'] = '' + elif entry.state == 'line': + res['quantity'] = '_______________' + res['price_unit'] = '______________' + res['discount'] = '____________' + res['tax_types'] = '____________________' + res['uos'] = '_____' + res['name'] = '_______________________________________________' + res['price_subtotal'] = '____________' + res['currency'] = '____' + elif entry.state == 'break': + res['type'] = entry.state + res['name'] = entry.name + res['price_subtotal'] = '' + res['currency'] = '' else: - res['name']=entry.name - res['price_subtotal']='' - res['currency']=invoice.currency_id.symbol + res['name'] = entry.name + res['price_subtotal'] = '' + res['currency'] = invoice.currency_id.symbol result.append(res) return result diff --git a/addons/account_invoice_layout/report/report_account_invoice_layout.rml b/addons/account_invoice_layout/report/report_account_invoice_layout.rml index f92cd477f1a..3cd64a08b02 100644 --- a/addons/account_invoice_layout/report/report_account_invoice_layout.rml +++ b/addons/account_invoice_layout/report/report_account_invoice_layout.rml @@ -376,7 +376,7 @@ Net Total: - [[ formatLang(o.amount_untaxed) ]] [[ o.currency_id.symbol ]] + [[ formatLang(o.amount_untaxed, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]] @@ -391,7 +391,7 @@ Taxes: - [[ formatLang(o.amount_tax) ]] [[ o.currency_id.symbol ]] + [[ formatLang(o.amount_tax, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]] @@ -406,7 +406,7 @@ Total: - [[ formatLang(o.amount_total) ]] [[ o.currency_id.symbol ]] + [[ formatLang(o.amount_total, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]] @@ -445,10 +445,10 @@ [[ t.name ]] - [[ formatLang(t.base) ]] + [[ formatLang(t.base, digits=get_digits(dp='Account')) ]] - [[ (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable') or '' ]] [[ formatLang(t.amount) ]] + [[ (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable') or '' ]] [[ formatLang(t.amount, digits=get_digits(dp='Account')) ]] @@ -485,4 +485,4 @@ - \ No newline at end of file + diff --git a/addons/account_invoice_layout/report/special_message_invoice.py b/addons/account_invoice_layout/report/special_message_invoice.py index 7051483828b..bac4a467ae1 100644 --- a/addons/account_invoice_layout/report/special_message_invoice.py +++ b/addons/account_invoice_layout/report/special_message_invoice.py @@ -24,6 +24,7 @@ import time from report import report_sxw import pooler + class account_invoice_with_message(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(account_invoice_with_message, self).__init__(cr, uid, name, context=context) @@ -40,115 +41,113 @@ class account_invoice_with_message(report_sxw.rml_parse): msg = account_msg_data.msg return msg - - def invoice_lines(self,invoice): - result =[] - sub_total={} - info=[] - invoice_list=[] - res={} - list_in_seq={} + def invoice_lines(self, invoice): + result = [] + sub_total = {} + info = [] + invoice_list = [] + res = {} + list_in_seq = {} ids = self.pool.get('account.invoice.line').search(self.cr, self.uid, [('invoice_id', '=', invoice.id)]) ids.sort() - for id in range(0,len(ids)): - info = self.pool.get('account.invoice.line').browse(self.cr, self.uid,ids[id], self.context.copy()) - list_in_seq[info]=info.sequence - i=1 - j=0 - final=sorted(list_in_seq.items(), lambda x, y: cmp(x[1], y[1])) - invoice_list=[x[0] for x in final] - sum_flag={} - sum_flag[j]=-1 + for id in range(0, len(ids)): + info = self.pool.get('account.invoice.line').browse(self.cr, self.uid, ids[id], self.context.copy()) + list_in_seq[info] = info.sequence + i = 1 + j = 0 + final = sorted(list_in_seq.items(), lambda x, y: cmp(x[1], y[1])) + invoice_list = [x[0] for x in final] + sum_flag = {} + sum_flag[j] = -1 for entry in invoice_list: - res={} + res = {} - if entry.state=='article': + if entry.state == 'article': self.cr.execute('select tax_id from account_invoice_line_tax where invoice_line_id=%s', (entry.id,)) - tax_ids=self.cr.fetchall() + tax_ids = self.cr.fetchall() - if tax_ids==[]: - res['tax_types']='' + if tax_ids == []: + res['tax_types'] = '' else: - tax_names_dict={} - for item in range(0,len(tax_ids)) : + tax_names_dict = {} + for item in range(0, len(tax_ids)): self.cr.execute('select name from account_tax where id=%s', (tax_ids[item][0],)) - type=self.cr.fetchone() - tax_names_dict[item] =type[0] - tax_names = ','.join([tax_names_dict[x] for x in range(0,len(tax_names_dict))]) - res['tax_types']=tax_names - res['name']=entry.name - res['quantity']="%.2f"%(entry.quantity) - res['price_unit']="%.2f"%(entry.price_unit) - res['discount']="%.2f"%(entry.discount) - res['price_subtotal']="%.2f"%(entry.price_subtotal) - sub_total[i]=entry.price_subtotal - i=i+1 - res['note']=entry.note - res['currency']=invoice.currency_id.symbol - res['type']=entry.state + type = self.cr.fetchone() + tax_names_dict[item] = type[0] + tax_names = ','.join([tax_names_dict[x] for x in range(0, len(tax_names_dict))]) + res['tax_types'] = tax_names + res['name'] = entry.name + res['quantity'] = self.formatLang(entry.quantity, digits=self.get_digits(dp='Account')) + res['price_unit'] = self.formatLang(entry.price_unit, digits=self.get_digits(dp='Account')) + res['discount'] = self.formatLang(entry.discount, digits=self.get_digits(dp='Account')) + res['price_subtotal'] = self.formatLang(entry.price_subtotal, digits=self.get_digits(dp='Account')) + sub_total[i] = entry.price_subtotal + i = i + 1 + res['note'] = entry.note + res['currency'] = invoice.currency_id.symbol + res['type'] = entry.state - if entry.uos_id.id==False: - res['uos']='' + if entry.uos_id.id == False: + res['uos'] = '' else: uos_name = self.pool.get('product.uom').read(self.cr, self.uid, entry.uos_id.id, ['name'], self.context.copy()) - res['uos']=uos_name['name'] + res['uos'] = uos_name['name'] else: + res['quantity'] = '' + res['price_unit'] = '' + res['discount'] = '' + res['tax_types'] = '' + res['type'] = entry.state + res['note'] = entry.note + res['uos'] = '' - res['quantity']='' - res['price_unit']='' - res['discount']='' - res['tax_types']='' - res['type']=entry.state - res['note']=entry.note - res['uos']='' - - if entry.state=='subtotal': - res['name']=entry.name - sum=0 - sum_id=0 - if sum_flag[j]==-1: - temp=1 + if entry.state == 'subtotal': + res['name'] = entry.name + sum = 0 + sum_id = 0 + if sum_flag[j] == -1: + temp = 1 else: - temp=sum_flag[j] + temp = sum_flag[j] - for sum_id in range(temp,len(sub_total)+1): - sum+=sub_total[sum_id] - sum_flag[j+1]= sum_id +1 + for sum_id in range(temp, len(sub_total)+1): + sum += sub_total[sum_id] + sum_flag[j+1] = sum_id +1 - j=j+1 - res['price_subtotal']="%.2f"%(sum) - res['currency']=invoice.currency_id.symbol - res['quantity']='' - res['price_unit']='' - res['discount']='' - res['tax_types']='' - res['uos']='' - elif entry.state=='title': - res['name']=entry.name - res['price_subtotal']='' - res['currency']='' - elif entry.state=='text': - res['name']=entry.name - res['price_subtotal']='' - res['currency']='' - elif entry.state=='line': - res['quantity']='_______________' - res['price_unit']='______________' - res['discount']='____________' - res['tax_types']='____________________' - res['uos']='_____' - res['name']='_______________________________________________' - res['price_subtotal']='____________' - res['currency']='____' - elif entry.state=='break': - res['type']=entry.state - res['name']=entry.name - res['price_subtotal']='' - res['currency']='' + j = j + 1 + res['price_subtotal'] = "%.2f" % (sum) + res['currency'] = invoice.currency_id.symbol + res['quantity'] = '' + res['price_unit'] = '' + res['discount'] = '' + res['tax_types'] = '' + res['uos'] = '' + elif entry.state == 'title': + res['name'] = entry.name + res['price_subtotal'] = '' + res['currency'] = '' + elif entry.state == 'text': + res['name'] = entry.name + res['price_subtotal'] = '' + res['currency'] = '' + elif entry.state == 'line': + res['quantity'] = '_______________' + res['price_unit'] = '______________' + res['discount'] = '____________' + res['tax_types'] = '____________________' + res['uos'] = '_____' + res['name'] = '_______________________________________________' + res['price_subtotal'] = '____________' + res['currency'] = '____' + elif entry.state == 'break': + res['type'] = entry.state + res['name'] = entry.name + res['price_subtotal'] = '' + res['currency'] = '' else: - res['name']=entry.name - res['price_subtotal']='' - res['currency']=invoice.currency_id.symbol + res['name'] = entry.name + res['price_subtotal'] = '' + res['currency'] = invoice.currency_id.symbol result.append(res) return result diff --git a/addons/account_invoice_layout/report/special_message_invoice.rml b/addons/account_invoice_layout/report/special_message_invoice.rml index 41775417161..8bea44a67f7 100644 --- a/addons/account_invoice_layout/report/special_message_invoice.rml +++ b/addons/account_invoice_layout/report/special_message_invoice.rml @@ -380,7 +380,7 @@ Net Total: - [[ formatLang(o.amount_untaxed) ]] [[ o.currency_id.symbol ]] + [[ formatLang(o.amount_untaxed, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]] @@ -395,7 +395,7 @@ Taxes: - [[ formatLang(o.amount_tax) ]] [[ o.currency_id.symbol ]] + [[ formatLang(o.amount_tax, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]] @@ -410,7 +410,7 @@ Total: - [[ formatLang(o.amount_total) ]] [[ o.currency_id.symbol ]] + [[ formatLang(o.amount_total, digits=get_digits(dp='Account')) ]] [[ o.currency_id.symbol ]] @@ -449,10 +449,10 @@ [[ t.name ]] - [[ formatLang(t.base) ]] + [[ formatLang(t.base, digits=get_digits(dp='Account')) ]] - [[ (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable') or '' ]] [[ formatLang(t.amount) ]] + [[ (t.tax_code_id and t.tax_code_id.notprintable) and removeParentNode('blockTable') or '' ]] [[ formatLang(t.amount, digits=get_digits(dp='Account')) ]] @@ -500,4 +500,4 @@ - \ No newline at end of file + diff --git a/addons/account_payment/account_payment_demo.xml b/addons/account_payment/account_payment_demo.xml index 37705a05b07..65a8d341da4 100644 --- a/addons/account_payment/account_payment_demo.xml +++ b/addons/account_payment/account_payment_demo.xml @@ -6,6 +6,7 @@ 00987654321 bank + Direct Payment diff --git a/addons/account_payment/i18n/pt_BR.po b/addons/account_payment/i18n/pt_BR.po index a50bc4d2c7b..962d7fe7946 100644 --- a/addons/account_payment/i18n/pt_BR.po +++ b/addons/account_payment/i18n/pt_BR.po @@ -7,13 +7,13 @@ msgstr "" "Project-Id-Version: OpenERP Server 6.0dev\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-08-28 16:01+0000\n" -"PO-Revision-Date: 2010-08-02 22:08+0000\n" +"PO-Revision-Date: 2010-10-04 16:08+0000\n" "Last-Translator: Pedro_Maschio \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-09-29 05:07+0000\n" +"X-Launchpad-Export-Date: 2010-10-05 04:57+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_payment diff --git a/addons/account_payment/test/account_payment.yml b/addons/account_payment/test/account_payment.yml index e65b3ba0b89..3d863686847 100644 --- a/addons/account_payment/test/account_payment.yml +++ b/addons/account_payment/test/account_payment.yml @@ -9,6 +9,7 @@ partner_id: base.res_partner_9 sequence: 0.0 state: bank + bank: base.res_bank_1 - I created a new Payment Mode diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py index d223c58316f..7ebb9d933de 100644 --- a/addons/account_payment/wizard/account_payment_populate_statement.py +++ b/addons/account_payment/wizard/account_payment_populate_statement.py @@ -114,7 +114,7 @@ class account_payment_populate_statement(osv.osv_memory): 'voucher_id': voucher_id, }, context=context) - line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id}) + line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id}) return {'type': 'ir.actions.act_window_close'} account_payment_populate_statement() diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index cf96028f01c..66c74a72bc9 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -25,6 +25,7 @@ import operator from osv import fields, osv import decimal_precision as dp + class account_analytic_account(osv.osv): _name = 'account.analytic.account' _description = 'Analytic Account' @@ -272,7 +273,7 @@ class account_analytic_line(osv.osv): _columns = { 'name' : fields.char('Description', size=256, required=True), 'date' : fields.date('Date', required=True, select=1), - 'amount' : fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price. Always expressed in the company main currency.'), + 'amount' : fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price. Always expressed in the company main currency.', digits_compute=dp.get_precision('Account')), 'unit_amount' : fields.float('Quantity', help='Specifies the amount of quantity to count.'), 'account_id' : fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='cascade', select=True), 'user_id' : fields.many2one('res.users', 'User'), diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 0bb9afc3386..21fe0a7da29 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -99,7 +99,7 @@ class hr_analytic_timesheet(osv.osv): (r.product_id.name, r.product_id.id,)) # Compute based on pricetype amount_unit = self.on_change_unit_amount(cr, uid, ids, - r.product_id.id, unit_amount, r.product_id.uom_id.id)['value']['amount'] + r.product_id.id, unit_amount, False, r.product_id.uom_id.id)['value']['amount'] amount = unit_amount * amount_unit res ['value']['amount']= - round(amount, 2) @@ -134,7 +134,7 @@ class hr_analytic_timesheet(osv.osv): (r.product_id.name, r.product_id.id,)) # Compute based on pricetype amount_unit = self.on_change_unit_amount(cr, uid, ids, - r.product_id.id, unit_amount, r.product_id.uom_id.id)['value']['amount'] + r.product_id.id, unit_amount, False, r.product_id.uom_id.id)['value']['amount'] amount = unit_amount * amount_unit res ['value']['amount']= - round(amount, 2) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 88ee1a8ec33..722ac5cb0a8 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1065,7 +1065,7 @@ class calendar_event(osv.osv): 'rule_type': rrule_type, 'id': id, }) - cr.execute(qry, val) # Hopefully psycopg2 works with dicts. But, FIXME + cr.execute(qry % val) return True def _get_rulestring(self, cr, uid, ids, name, arg, context=None): diff --git a/addons/base_calendar/base_calendar_view.xml b/addons/base_calendar/base_calendar_view.xml index 2a0ed14080f..ba91c4b75dd 100644 --- a/addons/base_calendar/base_calendar_view.xml +++ b/addons/base_calendar/base_calendar_view.xml @@ -163,7 +163,8 @@ @@ -496,6 +497,7 @@ diff --git a/addons/base_calendar/i18n/nl.po b/addons/base_calendar/i18n/nl.po index 75ca37ec081..2f356806b1e 100644 --- a/addons/base_calendar/i18n/nl.po +++ b/addons/base_calendar/i18n/nl.po @@ -8,13 +8,13 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2010-08-19 12:50+0000\n" -"PO-Revision-Date: 2010-10-03 20:01+0000\n" -"Last-Translator: Wouter Schrijvers \n" +"PO-Revision-Date: 2010-10-04 06:49+0000\n" +"Last-Translator: OpenERP Administrators \n" "Language-Team: Dutch \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-10-04 04:57+0000\n" +"X-Launchpad-Export-Date: 2010-10-05 04:57+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base_calendar diff --git a/addons/base_contact/process/base_contact_process.xml b/addons/base_contact/process/base_contact_process.xml index 876905c1812..f5b754e7ad9 100644 --- a/addons/base_contact/process/base_contact_process.xml +++ b/addons/base_contact/process/base_contact_process.xml @@ -60,7 +60,6 @@ --> - @@ -69,7 +68,6 @@ - @@ -78,7 +76,6 @@ - diff --git a/addons/base_iban/base_iban_data.xml b/addons/base_iban/base_iban_data.xml index 678b798c82f..dae3999505e 100644 --- a/addons/base_iban/base_iban_data.xml +++ b/addons/base_iban/base_iban_data.xml @@ -3,8 +3,8 @@ + Default bank account description + --> IBAN Account iban diff --git a/addons/board/i18n/pt_BR.po b/addons/board/i18n/pt_BR.po index 9ed7e104348..56340d82ba1 100644 --- a/addons/board/i18n/pt_BR.po +++ b/addons/board/i18n/pt_BR.po @@ -7,13 +7,13 @@ msgstr "" "Project-Id-Version: OpenERP Server 6.0dev\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-08-28 16:01+0000\n" -"PO-Revision-Date: 2009-12-07 16:48+0000\n" +"PO-Revision-Date: 2010-10-04 16:07+0000\n" "Last-Translator: Pedro_Maschio \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-09-29 05:11+0000\n" +"X-Launchpad-Export-Date: 2010-10-05 04:57+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: board @@ -21,8 +21,7 @@ msgstr "" msgid "" "The Object name must start with x_ and not contain any special character !" msgstr "" -"O nome do objeto precisa iniciar com x_ e não conter nenhum caracter " -"especial!" +"O nome do objeto deve começar com x_ e não conter caracteres especiais!" #. module: board #: model:ir.model,name:board.model_board_board @@ -110,7 +109,7 @@ msgstr "Criar menu para painel" #. module: board #: constraint:ir.ui.view:0 msgid "Invalid XML for View Architecture!" -msgstr "Invalido XML para Arquitetura da View" +msgstr "XML inválido para Arquitetura da View!" #. module: board #: wizard_field:board.board.menu.create,init,menu_parent_id:0 diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py index bcc624d6a67..d22fa98f6e4 100644 --- a/addons/caldav/calendar.py +++ b/addons/caldav/calendar.py @@ -716,7 +716,7 @@ class basic_calendar_line(osv.osv): """ cr.execute("SELECT COUNT(id) FROM basic_calendar_lines \ - WHERE name='%s' AND calendar_id=%s", + WHERE name=%s AND calendar_id=%s", (vals.get('name'), vals.get('calendar_id'))) res = cr.fetchone() if res: diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 5de8de6de68..89dc61bef59 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -119,7 +119,6 @@ Create dashboard for CRM that includes: 'crm_meeting_demo.xml', 'crm_opportunity_demo.xml', 'crm_phonecall_demo.xml', - 'board_crm_demo.xml', ], 'test': [ 'test/test_crm_lead.yml', diff --git a/addons/crm/board_crm_demo.xml b/addons/crm/board_crm_demo.xml deleted file mode 100644 index fd8bb480d68..00000000000 --- a/addons/crm/board_crm_demo.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - diff --git a/addons/crm/crm_lead_data.xml b/addons/crm/crm_lead_data.xml index cb80a7d28e9..2a49e43e683 100644 --- a/addons/crm/crm_lead_data.xml +++ b/addons/crm/crm_lead_data.xml @@ -33,9 +33,10 @@ - Win + Won + diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 3afea6c5081..fc7a7dfdb73 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -315,11 +315,11 @@ - - diff --git a/addons/crm/crm_meeting_view.xml b/addons/crm/crm_meeting_view.xml index 2821024bfbf..dd36a994b8d 100644 --- a/addons/crm/crm_meeting_view.xml +++ b/addons/crm/crm_meeting_view.xml @@ -13,7 +13,8 @@ {'object_id':'crm.meeting'} - @@ -311,7 +312,7 @@ - diff --git a/addons/crm/crm_opportunity.py b/addons/crm/crm_opportunity.py index 771212a171d..2b0062eb9d5 100644 --- a/addons/crm/crm_opportunity.py +++ b/addons/crm/crm_opportunity.py @@ -85,10 +85,11 @@ class crm_opportunity(osv.osv): """ res = super(crm_opportunity, self).case_close(cr, uid, ids, args) stage_id = super(crm_opportunity, self).stage_next(cr, uid, ids, context={'force_domain': [('probability', '=', 0)]}) - if not stage_id: - raise osv.except_osv(_('Warning !'), _('There is no stage for lost opportunities defined for this Sale Team.')) - value = self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value'] - value.update({'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'stage_id': stage_id}) + value = {} + if stage_id: + value = self.onchange_stage_id(cr, uid, ids, stage_id, context={}).get('value', {}) + value['stage_id'] = stage_id + value.update({'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}) res = self.write(cr, uid, ids, value) for (id, name) in self.name_get(cr, uid, ids): diff --git a/addons/crm/crm_opportunity_view.xml b/addons/crm/crm_opportunity_view.xml index b52694d8b20..86bb99633ac 100644 --- a/addons/crm/crm_opportunity_view.xml +++ b/addons/crm/crm_opportunity_view.xml @@ -14,14 +14,14 @@