From 542b15e5b856cf4258badcd35715924d0fcdf37c Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Thu, 9 Dec 2010 13:14:57 +0100 Subject: [PATCH 01/14] [FIX] l10n_uk: set a valid certificate number (second try) bzr revid: qdp-launchpad@tinyerp.com-20101209121457-iokquzx4bzwsgzgh --- addons/l10n_uk/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_uk/__openerp__.py b/addons/l10n_uk/__openerp__.py index c84385ba1d3..e39f620e1f3 100644 --- a/addons/l10n_uk/__openerp__.py +++ b/addons/l10n_uk/__openerp__.py @@ -75,6 +75,6 @@ 'demo_xml': [], 'installable': True, 'active': False, - 'certificate': '18956603329629', + 'certificate': '008956603329629', } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From aa27cd5b1c9343b25e6397b07994026dd4ee4caf Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 8 Dec 2010 18:53:48 +0100 Subject: [PATCH 02/14] [REVERT] project/board_project_manager_view.xml: reverted previous incorrect patch (incorrect view_id) bzr revid: odo@openerp.com-20101208175348-rfp94f9w4js0nbrd --- addons/project/board_project_manager_view.xml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/addons/project/board_project_manager_view.xml b/addons/project/board_project_manager_view.xml index 6a563bd2910..f9db634d51d 100644 --- a/addons/project/board_project_manager_view.xml +++ b/addons/project/board_project_manager_view.xml @@ -15,14 +15,7 @@ res_model="project.project" view_mode="tree,form" view_type="form"/> - + From eb25611f004e8cd33e9beb9766bc475aaf7de4ba Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 9 Dec 2010 16:04:42 +0100 Subject: [PATCH 03/14] [FIX] res.lang.unlink: renamed local variable that shadowed the enclosing type, preventing call to super() bzr revid: odo@openerp.com-20101209150442-f47eucdfylpokagt --- bin/addons/base/res/res_lang.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/addons/base/res/res_lang.py b/bin/addons/base/res/res_lang.py index 48c583c54cd..64bdb948d14 100644 --- a/bin/addons/base/res/res_lang.py +++ b/bin/addons/base/res/res_lang.py @@ -81,10 +81,10 @@ class lang(osv.osv): context = {} languages = self.read(cr, uid, ids, ['code','active'], context=context) for language in languages: - lang = context.get('lang') + ctx_lang = context.get('lang') if language['code']=='en_US': raise osv.except_osv(_('User Error'), _("Base Language 'en_US' can not be deleted !")) - if lang and (language['code']==lang): + if ctx_lang and (language['code']==ctx_lang): raise osv.except_osv(_('User Error'), _("You cannot delete the language which is User's Preferred Language !")) if language['active']: raise osv.except_osv(_('User Error'), _("You cannot delete the language which is Active !\nPlease de-activate the language first.")) From bb82904ba3b4f63f6c099c4a0c7b6b1814c61a33 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 10 Dec 2010 00:07:42 +0100 Subject: [PATCH 04/14] [FIX] fields.function: make sure all binary values can always be serialized as valid XML Nnormally, binary fields should be 7-bit ASCII base64-encoded data, but sometimes it's not the case, so we do additional sanity checks to make sure the binary values can pass safely via xmlrpc as strings. As a last resort we coerce the binary values to unicode to make sure they can be safely serialized as utf-8-encoded values, always valid XML characters. When this happens, decoding on the other endpoint is not likely to produce the expected output, but this isjust a safety mechanism(in these cases base64 data or xmlrpc. Binary values should be returned instead by the function field. In a future version we should probably switch to using XMLRPC Binary types always for passing fields.binary values, but this requires more refactoring. lp bug: https://launchpad.net/bugs/670778 fixed bzr revid: odo@openerp.com-20101209230742-gwf8e4zvmk43k6ln --- bin/osv/fields.py | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/bin/osv/fields.py b/bin/osv/fields.py index 135296779b1..423bd9cf1d1 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -33,12 +33,12 @@ # import datetime as DT import string -import netsvc import sys import warnings - +import xmlrpclib from psycopg2 import Binary +import netsvc import tools from tools.translate import _ @@ -673,6 +673,37 @@ def get_nice_size(a): size = 0 return (x, tools.human_size(size)) +def sanitize_binary_value(dict_item): + # binary fields should be 7-bit ASCII base64-encoded data, + # but we do additional sanity checks to make sure the values + # will are not something else that won't pass via xmlrpc + index, value = dict_item + if isinstance(value, (xmlrpclib.Binary, tuple, list, dict)): + # these builtin types are meant to pass untouched + return index, value + + # For all other cases, handle the value as a binary string: + # it could be a 7-bit ASCII string (e.g base64 data), but also + # any 8-bit content from files, with byte values that cannot + # be passed inside XML! + # See for more info: + # - http://bugs.python.org/issue10066 + # - http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char + # + # One solution is to convert the byte-string to unicode, + # so it gets serialized as utf-8 encoded data (always valid XML) + # If invalid XML byte values were present, tools.ustr() uses + # the Latin-1 codec as fallback, which converts any 8-bit + # byte value, resulting in valid utf-8-encoded bytes + # in the end: + # >>> unicode('\xe1','latin1').encode('utf8') == '\xc3\xa1' + # Note: when this happens, decoding on the other endpoint + # is not likely to produce the expected output, but this is + # just a safety mechanism (in these cases base64 data or + # xmlrpc.Binary values should be used instead + return index, tools.ustr(value) + + # --------------------------------------------------------- # Function fields # --------------------------------------------------------- @@ -763,9 +794,13 @@ class function(_column): if res[r] and res[r] in dict_names: res[r] = (res[r], dict_names[res[r]]) - if self._type == 'binary' and context.get('bin_size', False): - # convert the data returned by the function with the size of that data... - res = dict(map( get_nice_size, res.items())) + if self._type == 'binary': + if context.get('bin_size', False): + # client requests only the size of binary fields + res = dict(map(get_nice_size, res.items())) + else: + res = dict(map(sanitize_binary_value, res.items())) + if self._type == "integer": for r in res.keys(): # Converting value into string so that it does not affect XML-RPC Limits From ff1d7c720968ad4b006e3a6eed7c32d7084cc454 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 10 Dec 2010 01:35:57 +0100 Subject: [PATCH 05/14] [FIX] account: P&L and BS reports should properly compute the IDs passed to set_context() Now that the server uses the objects passed to the report to determine the company, these reports were failing, due to the peculiar way they pass IDs between the wizard and report. Hopefully there are no other reports that need the same fix. bzr revid: odo@openerp.com-20101210003557-pbaj9s1607zuof3j --- addons/account/report/account_balance_sheet.py | 7 +++++++ addons/account/report/account_profit_loss.py | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/addons/account/report/account_balance_sheet.py b/addons/account/report/account_balance_sheet.py index b6f39fbbebd..db75eff0dcf 100644 --- a/addons/account/report/account_balance_sheet.py +++ b/addons/account/report/account_balance_sheet.py @@ -60,6 +60,13 @@ class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header) }) self.context = context + def set_context(self, objects, data, ids, report_type=None): + new_ids = ids + if (data['model'] == 'ir.ui.menu'): + new_ids = 'chart_account_id' in data['form'] and [data['form']['chart_account_id']] or [] + objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) + return super(report_balancesheet_horizontal, self).set_context(objects, data, new_ids, report_type=report_type) + def sum_dr(self): if self.res_bl['type'] == _('Net Profit'): self.result_sum_dr += self.res_bl['balance']*-1 diff --git a/addons/account/report/account_profit_loss.py b/addons/account/report/account_profit_loss.py index 117f9e351fb..9198edf7105 100644 --- a/addons/account/report/account_profit_loss.py +++ b/addons/account/report/account_profit_loss.py @@ -56,6 +56,13 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header): }) self.context = context + def set_context(self, objects, data, ids, report_type=None): + new_ids = ids + if (data['model'] == 'ir.ui.menu'): + new_ids = 'chart_account_id' in data['form'] and [data['form']['chart_account_id']] or [] + objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) + return super(report_pl_account_horizontal, self).set_context(objects, data, new_ids, report_type=report_type) + def final_result(self): return self.res_pl From e20452310d64f6c8c07fc3e7830c4ddb88e8d8fd Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Fri, 10 Dec 2010 11:44:04 +0530 Subject: [PATCH 06/14] [FIX] Timesheet allows sign in in the future lp bug: https://launchpad.net/bugs/676445 fixed bzr revid: mra@mra-laptop-20101210061404-xs52l3jkalw87fil --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 04cdc7231e5..447b04ecf68 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -289,7 +289,7 @@ class hr_timesheet_sheet(osv.osv): 'draft': [('readonly', False)], 'new': [('readonly', False)]} ), - 'attendances_ids' : one2many_mod2('hr.attendance', 'sheet_id', 'Attendances', readonly=True, states={'draft':[('readonly',False)],'new':[('readonly',False)]}), + 'attendances_ids' : one2many_mod2('hr.attendance', 'sheet_id', 'Attendances', readonly=True,), 'state' : fields.selection([ ('new', 'New'), ('draft','Draft'), From 74cd546e26b0b2c076b64fc8e55feddcdcc92304 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Fri, 10 Dec 2010 12:32:33 +0530 Subject: [PATCH 07/14] [FIX] in job position, the employee notebook use a O2M to employee form instead of m2m lp bug: https://launchpad.net/bugs/687318 fixed bzr revid: mra@mra-laptop-20101210070233-b9j441y0uqyh4tw5 --- addons/hr/hr_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index f8c92db4693..076c207f850 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -340,7 +340,7 @@ - + From d9c77fffbe74afa004704cde116918cb108e8e5f Mon Sep 17 00:00:00 2001 From: mtr Date: Fri, 10 Dec 2010 15:10:23 +0530 Subject: [PATCH 08/14] [IMP] account:filtered already configured companies in Accounting Application Configuration wizard bzr revid: mtr@mtr-20101210094023-3hbll2inkty6ilxw --- addons/account/installer.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/addons/account/installer.py b/addons/account/installer.py index b1be04f7c70..0301126a373 100644 --- a/addons/account/installer.py +++ b/addons/account/installer.py @@ -95,6 +95,25 @@ class account_installer(osv.osv_memory): 'bank_accounts_id': _get_default_accounts, 'charts': _get_default_charts } + + def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): + res = super(account_installer, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False) + configured_cmp = [] + unconfigured_cmp = [] + cmp_select = [] + company_ids = self.pool.get('res.company').search(cr, uid, [], context=context) + cr.execute("SELECT company_id FROM account_account WHERE account_account.parent_id IS NULL") + for r in cr.fetchall(): + configured_cmp.append(r[0]) + unconfigured_cmp = list(set(company_ids)-set(configured_cmp)) + if unconfigured_cmp: + for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp): + cmp_select.append((line.id,line.name)) + for field in res['fields']: + if field == 'company_id': + res['fields'][field]['domain'] = unconfigured_cmp + res['fields'][field]['selection'] = cmp_select + return res def on_change_tax(self, cr, uid, id, tax): return {'value': {'purchase_tax': tax}} From 36ee30f34881372be5e0bb24e82a2cc084a7229b Mon Sep 17 00:00:00 2001 From: pso Date: Fri, 10 Dec 2010 15:19:58 +0530 Subject: [PATCH 09/14] [FIX] account: Improved product onchange in invoice line lp bug: https://launchpad.net/bugs/539539 fixed bzr revid: pso@tinyerp.com-20101210094958-vphz0yrgcuuufiln --- addons/account/invoice.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 3f675f90a07..859550a84b2 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -1399,18 +1399,25 @@ class account_invoice_line(osv.osv): a = fpos_obj.map_account(cr, uid, fpos, a) if a: result['account_id'] = a - + + tax_ids = self.pool.get('account.tax').search(cr, uid, [('company_id', '=', company_id)]) if type in ('out_invoice', 'out_refund'): - taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False) - tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes) + def_sale_taxes = map(lambda x: x.id, res.taxes_id) + sale_tax_list = [tax for tax in tax_ids if tax in def_sale_taxes] + sale_tax_id = self.pool.get('account.tax').browse(cr, uid, sale_tax_list) + sale_taxes = sale_tax_id and sale_tax_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False) + tax_id = fpos_obj.map_tax(cr, uid, fpos, sale_taxes) else: - taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False) - tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes) + def_pur_taxes = map(lambda x: x.id, res.supplier_taxes_id) + pur_tax_list = [tax for tax in tax_ids if tax in def_pur_taxes] + pur_tax_id = self.pool.get('account.tax').browse(cr, uid, pur_tax_list) + pur_taxes = pur_tax_id and pur_tax_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False) + tax_id = fpos_obj.map_tax(cr, uid, fpos, pur_taxes) + if type in ('in_invoice', 'in_refund'): result.update( {'price_unit': price_unit or res.standard_price,'invoice_line_tax_id': tax_id} ) else: result.update({'price_unit': res.list_price, 'invoice_line_tax_id': tax_id}) - # if not name: result['name'] = res.partner_ref @@ -1420,7 +1427,7 @@ class account_invoice_line(osv.osv): res2 = res.uom_id.category_id.id if res2: domain = {'uos_id':[('category_id','=',res2 )]} - + result['categ_id'] = res.categ_id.id res_final = {'value':result, 'domain':domain} From 1339b69375c4f949523678c78efcc78ffc5d9567 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Fri, 10 Dec 2010 16:01:12 +0530 Subject: [PATCH 10/14] [FIX] Account: posted/unposted entries filter lp bug: https://launchpad.net/bugs/678441 fixed bzr revid: mra@mra-laptop-20101210103112-kitohyv96eux3ud6 --- addons/account/account_view.xml | 3 ++- addons/account/wizard/account_chart.py | 7 +++--- addons/account/wizard/account_move_journal.py | 23 +++++++++++++++---- .../account/wizard/account_report_common.py | 7 +++--- addons/account/wizard/account_tax_chart.py | 7 +++--- 5 files changed, 33 insertions(+), 14 deletions(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 3f608c62e7c..d4a731fb3b7 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1170,7 +1170,7 @@ - + account.move.line form tree,form + {'search_default_posted': 1} This view is used by accountants in order to record entries massively in OpenERP. If you want to record a supplier invoice, start by recording the line of the expense account, OpenERP will propose to you automatically the Tax related to this account and the counter-part "Account Payable". diff --git a/addons/account/wizard/account_chart.py b/addons/account/wizard/account_chart.py index f4c360cd253..e8f0e432d69 100644 --- a/addons/account/wizard/account_chart.py +++ b/addons/account/wizard/account_chart.py @@ -33,8 +33,9 @@ class account_chart(osv.osv_memory): help = 'Keep empty for all open fiscal years'), 'period_from': fields.many2one('account.period', 'Start period'), 'period_to': fields.many2one('account.period', 'End period'), - 'target_move': fields.selection([('all', 'All Entries'), - ('posted', 'All Posted Entries')], 'Target Moves', required = True), + 'target_move': fields.selection([('posted', 'All Posted Entries'), + ('all', 'All Entries'), + ], 'Target Moves', required = True), } def onchange_fiscalyear(self, cr, uid, ids, fiscalyear_id=False, context=None): @@ -92,7 +93,7 @@ class account_chart(osv.osv_memory): return result _defaults = { - 'target_move': 'all' + 'target_move': 'posted' } account_chart() diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py index 72ae65f83b9..5f4616075fc 100644 --- a/addons/account/wizard/account_move_journal.py +++ b/addons/account/wizard/account_move_journal.py @@ -21,7 +21,7 @@ from lxml import etree -from osv import osv +from osv import osv, fields from tools.translate import _ import tools @@ -29,6 +29,15 @@ class account_move_journal(osv.osv_memory): _name = "account.move.journal" _description = "Move journal" + _columns = { + 'target_move': fields.selection([('posted', 'All Posted Entries'), + ('all', 'All Entries'), + ], 'Target Moves', required=True), + } + + _defaults = { + 'target_move': 'posted' + } def _get_period(self, cr, uid, context={}): """ Return default account period value @@ -93,6 +102,8 @@ class account_move_journal(osv.osv_memory): view = """
+ +