From fb3f7aa747d4d196abd3963ef1cbdfae910551a5 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Tue, 10 Jan 2012 13:35:59 +0100 Subject: [PATCH 01/26] [IMP] delivery: move picking's net weight to extended view bzr revid: ls@numerigraphe.fr-20120110123559-1llywc42k606hryj --- addons/delivery/delivery_view.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml index c46253777d2..47ed9d6d274 100644 --- a/addons/delivery/delivery_view.xml +++ b/addons/delivery/delivery_view.xml @@ -194,7 +194,7 @@ - + - + - + @@ -245,7 +245,7 @@ - + @@ -258,7 +258,7 @@ - + @@ -271,7 +271,7 @@ - + From 32781b0268a8b3583869cd14809e466568ee2a7f Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 16 Jan 2012 11:34:06 +0100 Subject: [PATCH 02/26] [FIX] typo in XML file bzr revid: ls@numerigraphe.fr-20120116103406-gwx3w8zlnrnvlyyr --- addons/delivery/delivery_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml index 47ed9d6d274..6c9e8c85cdb 100644 --- a/addons/delivery/delivery_view.xml +++ b/addons/delivery/delivery_view.xml @@ -194,7 +194,7 @@ - @@ -207,7 +207,7 @@ - From 438cde1f2f9b6204a0cb71338eacc7dfa1fab4e9 Mon Sep 17 00:00:00 2001 From: "nicolas.bessi@camptocamp.com" <> Date: Wed, 8 Feb 2012 11:37:15 +0100 Subject: [PATCH 03/26] [FIX] l10n_ch bvr report to follow last patches of report_webkit addons bzr revid: nicolas.bessi@camptocamp.com-20120208103715-gk6upkf3b47av9h1 --- addons/l10n_ch/report/report_webkit_html.py | 154 +++++++------------- 1 file changed, 51 insertions(+), 103 deletions(-) diff --git a/addons/l10n_ch/report/report_webkit_html.py b/addons/l10n_ch/report/report_webkit_html.py index e6f7239c4e4..72158361da7 100644 --- a/addons/l10n_ch/report/report_webkit_html.py +++ b/addons/l10n_ch/report/report_webkit_html.py @@ -20,22 +20,31 @@ ############################################################################## import time -from report import report_sxw -from report_webkit import webkit_report -from report_webkit import report_helper -from osv import osv -from tools import mod10r import sys import os import re + +from mako.template import Template +from mako.lookup import TemplateLookup +from mako import exceptions + + +from report import report_sxw +from report_webkit import webkit_report +from report_webkit import report_helper + +from osv import osv +from osv.osv import except_osv + +from tools import mod10r +from tools.translate import _ +from tools.config import config + import wizard import addons import pooler -from tools.config import config -from mako.template import Template -from mako import exceptions -from tools.translate import _ -from osv.osv import except_osv + + class l10n_ch_report_webkit_html(report_sxw.rml_parse): @@ -143,53 +152,26 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse): 'digits!\nPlease check your company ' 'information for the invoice:\n%s') %(invoice_name))) return '' + +def mako_template(text): + """Build a Mako template. + + This template uses UTF-8 encoding + """ + tmp_lookup = TemplateLookup() #we need it in order to allow inclusion and inheritance + return Template(text, input_encoding='utf-8', output_encoding='utf-8', lookup=tmp_lookup) class BVRWebKitParser(webkit_report.WebKitParser): - def setLang(self, lang): - if not lang: - lang = 'en_US' - self.localcontext['lang'] = lang - - def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False): - """format using the know cursor, language from localcontext""" - if digits is None: - digits = self.parser_instance.get_digits(value) - if isinstance(value, (str, unicode)) and not value: - return '' - pool_lang = self.pool.get('res.lang') - lang = self.localcontext['lang'] - - lang_ids = pool_lang.search(self.parser_instance.cr, self.parser_instance.uid, [('code','=',lang)])[0] - lang_obj = pool_lang.browse(self.parser_instance.cr, self.parser_instance.uid, lang_ids) - - if date or date_time: - if not str(value): - return '' - - date_format = lang_obj.date_format - parse_format = '%Y-%m-%d' - if date_time: - value=value.split('.')[0] - date_format = date_format + " " + lang_obj.time_format - parse_format = '%Y-%m-%d %H:%M:%S' - if not isinstance(value, time.struct_time): - return time.strftime(date_format, time.strptime(value, parse_format)) - - else: - date = datetime(*value.timetuple()[:6]) - return date.strftime(date_format) - - return lang_obj.format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary) - def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None): """generate the PDF""" - self.parser_instance = self.parser( - cursor, + context = context or {} + if report_xml.report_type != 'webkit': + return super(WebKitParser,self).create_single_pdf(cursor, uid, ids, data, report_xml, context=context) + self.parser_instance = self.parser(cursor, uid, self.name2, - context=context - ) + context=context) self.pool = pooler.get_pool(cursor.dbname) objs = self.getObjects(cursor, uid, ids, context) self.parser_instance.set_context(objs, data, ids, report_xml.report_type) @@ -201,7 +183,7 @@ class BVRWebKitParser(webkit_report.WebKitParser): if not template and report_xml.report_webkit_data : template = report_xml.report_webkit_data if not template : - raise except_osv(_('Webkit Report template not found !'), _('')) + raise except_osv(_('Error'),_('Webkit Report template not found !')) header = report_xml.webkit_header.html footer = report_xml.webkit_header.footer_html if not header and report_xml.header: @@ -210,43 +192,19 @@ class BVRWebKitParser(webkit_report.WebKitParser): _('Please set a header in company settings') ) if not report_xml.header : - #I know it could be cleaner ... - header = u""" - - - - - - - -""" - self.parser_instance.localcontext.update({'setLang':self.setLang}) - self.parser_instance.localcontext.update({'formatLang':self.formatLang}) + header = '' + default_head = addons.get_module_resource('report_webkit', 'default_header.html') + with open(default_head,'r') as f: + header = f.read() css = report_xml.webkit_header.css if not css : css = '' user = self.pool.get('res.users').browse(cursor, uid, uid) company = user.company_id - parse_template = template - #default_filters=['unicode', 'entity'] can be used to set global filter - body_mako_tpl = Template(parse_template ,input_encoding='utf-8', output_encoding='utf-8') + body_mako_tpl = mako_template(template) #BVR specific bvr_path = addons.get_module_resource(os.path.join('l10n_ch','report','bvr.mako')) - body_bvr_tpl = Template(file(bvr_path).read(), input_encoding='utf-8', output_encoding='utf-8') - + body_bvr_tpl = mako_template(file(bvr_path).read()) helper = report_helper.WebKitHelper(cursor, uid, report_xml.id, context) ##BVR Specific htmls = [] @@ -254,58 +212,48 @@ class BVRWebKitParser(webkit_report.WebKitParser): self.parser_instance.localcontext['objects'] = [obj] if not company.bvr_only: try: - html = body_mako_tpl.render( - helper=helper, + html = body_mako_tpl.render(helper=helper, css=css, _=self.translate_call, - **self.parser_instance.localcontext - ) + **self.parser_instance.localcontext) except Exception, e: raise Exception(exceptions.text_error_template().render()) htmls.append(html) if not company.invoice_only: try: - bvr = body_bvr_tpl.render( - helper=helper, - css=css, - _=self.translate_call, - **self.parser_instance.localcontext - ) + bvr = body_bvr_tpl.render(helper=helper, + css=css, + _=self.translate_call, + **self.parser_instance.localcontext) except Exception, e: raise Exception(exceptions.text_error_template().render()) htmls.append(bvr) head_mako_tpl = Template(header, input_encoding='utf-8', output_encoding='utf-8') try: - head = head_mako_tpl.render( - helper=helper, + head = head_mako_tpl.render(helper=helper, css=css, _debug=False, _=self.translate_call, - **self.parser_instance.localcontext - ) + **self.parser_instance.localcontext) except Exception, e: raise Exception(exceptions.text_error_template().render()) foot = False if footer and company.invoice_only : foot_mako_tpl = Template(footer, input_encoding='utf-8', output_encoding='utf-8') try: - foot = foot_mako_tpl.render( - helper=helper, + foot = foot_mako_tpl.render(helper=helper, css=css, _=self.translate_call, - **self.parser_instance.localcontext - ) + **self.parser_instance.localcontext) except Exception, e: raise Exception(exceptions.text_error_template().render()) if report_xml.webkit_debug : try: - deb = head_mako_tpl.render( - helper=helper, + deb = head_mako_tpl.render(helper=helper, css=css, _debug=html, _=self.translate_call, - **self.parser_instance.localcontext - ) + **self.parser_instance.localcontext) except Exception, e: raise Exception(exceptions.text_error_template().render()) return (deb, 'html') From 2c115e6856f5c6eb7f3d730b0ccfa028b386b009 Mon Sep 17 00:00:00 2001 From: Ronald Portier Date: Fri, 22 Jun 2012 16:19:32 +0200 Subject: [PATCH 04/26] [FIX] Problem with runaway cpu and/or postgres crash on analytic account analysis. lp bug: https://launchpad.net/bugs/1015995 fixed bzr revid: ronald@therp.nl-20120622141932-f6rywvd1nawn186w --- .../account_analytic_analysis.py | 54 +++++++------------ 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index 20c170cb5c0..cedcc9fa533 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -418,41 +418,25 @@ class account_analytic_account_summary_user(osv.osv): } def init(self, cr): - tools.sql.drop_view_if_exists(cr, 'account_analytic_analysis_summary_user') - cr.execute('CREATE OR REPLACE VIEW account_analytic_analysis_summary_user AS (' \ - 'SELECT ' \ - '(u.account_id * u.max_user) + u."user" AS id, ' \ - 'u.account_id AS account_id, ' \ - 'u."user" AS "user", ' \ - 'COALESCE(SUM(l.unit_amount), 0.0) AS unit_amount ' \ - 'FROM ' \ - '(SELECT ' \ - 'a.id AS account_id, ' \ - 'u1.id AS "user", ' \ - 'MAX(u2.id) AS max_user ' \ - 'FROM ' \ - 'res_users AS u1, ' \ - 'res_users AS u2, ' \ - 'account_analytic_account AS a ' \ - 'GROUP BY u1.id, a.id ' \ - ') AS u ' \ - 'LEFT JOIN ' \ - '(SELECT ' \ - 'l.account_id AS account_id, ' \ - 'l.user_id AS "user", ' \ - 'SUM(l.unit_amount) AS unit_amount ' \ - 'FROM account_analytic_line AS l, ' \ - 'account_analytic_journal AS j ' \ - 'WHERE (j.type = \'general\') and (j.id=l.journal_id) ' \ - 'GROUP BY l.account_id, l.user_id ' \ - ') AS l ' - 'ON (' \ - 'u.account_id = l.account_id ' \ - 'AND u."user" = l."user"' \ - ') ' \ - 'GROUP BY u."user", u.account_id, u.max_user' \ - ')') - + cr.execute('''CREATE OR REPLACE VIEW account_analytic_analysis_summary_user AS ( + with mu as + (select max(id) as max_user from res_users) + , lu AS + (SELECT + l.account_id AS account_id, + coalesce(l.user_id, 0) AS user_id, + SUM(l.unit_amount) AS unit_amount + FROM account_analytic_line AS l, + account_analytic_journal AS j + WHERE (j.type = 'general' ) and (j.id=l.journal_id) + GROUP BY l.account_id, l.user_id + ) + select (lu.account_id * mu.max_user) + lu.user_id as id, + lu.account_id as account_id, + lu.user_id as "user", + unit_amount + from lu, mu)''') + account_analytic_account_summary_user() class account_analytic_account_summary_month(osv.osv): From 6c1bc3975e2c98d5d38ec8b41c2bc56b55fc807b Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 26 Jul 2012 13:35:30 +0200 Subject: [PATCH 05/26] [FIX] hr_timesheet_invoice: when reinvoicing costs, force the product should set the product on analytic lines without any + code refactoring and better warning message lp bug: https://launchpad.net/bugs/976223 fixed bzr revid: qdp-launchpad@openerp.com-20120726113530-rx713dc6sxy1cu2b --- .../wizard/hr_timesheet_invoice_create.py | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index ea4d286c89f..e4df1f4801e 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -90,32 +90,28 @@ class account_analytic_line(osv.osv): context2 = context.copy() context2['lang'] = partner.lang - cr.execute("SELECT product_id, to_invoice, sum(unit_amount), product_uom_id " \ + cr.execute("SELECT product_id, to_invoice, sum(unit_amount), product_uom_id, name " \ "FROM account_analytic_line as line " \ "WHERE account_id = %s " \ "AND id IN %s AND to_invoice IS NOT NULL " \ "GROUP BY product_id,to_invoice,product_uom_id", (account.id, tuple(ids),)) - for product_id, factor_id, qty, uom in cr.fetchall(): - product = product_obj.browse(cr, uid, product_id, context2) + for product_id, factor_id, qty, uom, line_name in cr.fetchall(): + if data.get('product'): + product_id = data['product'][0] + product = product_obj.browse(cr, uid, product_id, context=context2) if not product: - raise osv.except_osv(_('Error'), _('At least one line has no product !')) - factor_name = '' - factor = invoice_factor_obj.browse(cr, uid, factor_id, context2) - if not data.get('product', False): - if factor.customer_name: - factor_name = product.name+' - '+factor.customer_name - else: - factor_name = product.name - else: - data['product'] = data['product'][0] - factor_name = product_obj.name_get(cr, uid, [data['product']], context=context)[0][1] + raise osv.except_osv(_('Error'), _('There is no product defined for the line %s. Please select one or force the product through the wizard.') % (line_name)) + factor = invoice_factor_obj.browse(cr, uid, factor_id, context=context2) + factor_name = product_obj.name_get(cr, uid, product_id, context=context2)[1] + if factor.customer_name: + factor_name += ' - ' + factor.customer_name ctx = context.copy() ctx.update({'uom':uom}) if account.pricelist_id: pl = account.pricelist_id.id - price = pro_price_obj.price_get(cr,uid,[pl], data.get('product', False) or product_id, qty or 1.0, account.partner_id.id, context=ctx)[pl] + price = pro_price_obj.price_get(cr,uid,[pl], product_id, qty or 1.0, account.partner_id.id, context=ctx)[pl] else: price = 0.0 @@ -131,7 +127,7 @@ class account_analytic_line(osv.osv): 'invoice_line_tax_id': [(6,0,tax )], 'invoice_id': last_invoice, 'name': factor_name, - 'product_id': data.get('product',product_id), + 'product_id': product_id, 'invoice_line_tax_id': [(6,0,tax)], 'uos_id': uom, 'account_id': account_id, @@ -179,7 +175,7 @@ class hr_timesheet_invoice_create(osv.osv_memory): 'time': fields.boolean('Time spent', help='The time of each work done will be displayed on the invoice'), 'name': fields.boolean('Description', help='The detail of each work done will be displayed on the invoice'), 'price': fields.boolean('Cost', help='The cost of each work done will be displayed on the invoice. You probably don\'t want to check this'), - 'product': fields.many2one('product.product', 'Product', help='Fill this field only if you want to force to use a specific product. Keep empty to use the real product that comes from the cost.'), + 'product': fields.many2one('product.product', 'Force Product', help='Fill this field only if you want to force to use a specific product. Keep empty to use the real product that comes from the cost.'), } _defaults = { From 130de4f1a372800ca234e77cf9c78a236c59bbbd Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 26 Jul 2012 13:59:27 +0200 Subject: [PATCH 06/26] [FIX] hr_timesheet_invoice: error in sql query introduced in previous commit bzr revid: qdp-launchpad@openerp.com-20120726115927-6qys36d1eecqfmuj --- .../hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index e4df1f4801e..0945b8f81fb 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -94,7 +94,7 @@ class account_analytic_line(osv.osv): "FROM account_analytic_line as line " \ "WHERE account_id = %s " \ "AND id IN %s AND to_invoice IS NOT NULL " \ - "GROUP BY product_id,to_invoice,product_uom_id", (account.id, tuple(ids),)) + "GROUP BY product_id, to_invoice, product_uom_id, name", (account.id, tuple(ids),)) for product_id, factor_id, qty, uom, line_name in cr.fetchall(): if data.get('product'): From 9dab28d36e4bac8741050f4ab293076323a99fcf Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 26 Jul 2012 14:31:58 +0200 Subject: [PATCH 07/26] [FIX] hr_timesheet_invoice: name_get() only support to receive a list of ids as parameter bzr revid: qdp-launchpad@openerp.com-20120726123158-08ajmydd95ixpp2d --- .../hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index 0945b8f81fb..c9b2439596d 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -103,7 +103,7 @@ class account_analytic_line(osv.osv): if not product: raise osv.except_osv(_('Error'), _('There is no product defined for the line %s. Please select one or force the product through the wizard.') % (line_name)) factor = invoice_factor_obj.browse(cr, uid, factor_id, context=context2) - factor_name = product_obj.name_get(cr, uid, product_id, context=context2)[1] + factor_name = product_obj.name_get(cr, uid, [product_id], context=context2)[0][1] if factor.customer_name: factor_name += ' - ' + factor.customer_name From 66a7dc6359a1a1cb630abfa8a0f292451e0aceef Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 26 Jul 2012 14:32:59 +0200 Subject: [PATCH 08/26] [IMP] customized pager of list view bzr revid: nicolas.vanhoren@openerp.com-20120726123259-ffeg8342bcbgal8o --- addons/web/static/src/css/base.css | 3 +++ addons/web/static/src/css/base.sass | 2 ++ addons/web/static/src/js/view_list.js | 1 + 3 files changed, 6 insertions(+) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index e929ec6c16b..1e59897cd86 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1322,6 +1322,9 @@ .openerp .oe_view_manager .oe_view_manager_pager { line-height: 26px; } +.openerp .oe_view_manager .oe_view_manager_pager .oe_list_pager_single_page .oe_pager_group { + display: none; +} .openerp .oe_view_manager .oe_pager_value { float: left; margin-right: 8px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index c9e00c65a8a..3bb52497454 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1016,6 +1016,8 @@ $sheet-max-width: 860px // ViewManager.pager {{{ .oe_view_manager_pager line-height: 26px + .oe_list_pager_single_page .oe_pager_group + display: none .oe_pager_value float: left margin-right: 8px diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 485b4e8d59b..72df989259d 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -376,6 +376,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi var total = dataset.size(); var limit = this.limit() || total; + this.$pager.toggle(total !== 0); this.$pager.toggleClass('oe_list_pager_single_page', (total <= limit)); var spager = '-'; if (total) { From bf4c39cdf1ae1791164b557743513258afcb2827 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 26 Jul 2012 14:38:19 +0200 Subject: [PATCH 09/26] [FIX] arrow keys handling in editable listview field when field is not a text-based input * Correctly handle HTMLInputElement#selectionStart throwing an error (checkbox and radio) * Correctly handle elements without a selectionStart at all (select) => should ~always let the go-to-other-field behavior go through bzr revid: xmo@openerp.com-20120726123819-74n1gl01p6befgkp --- .../web/static/src/js/view_list_editable.js | 75 ++++++++++++++----- 1 file changed, 58 insertions(+), 17 deletions(-) diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index c7654479864..ca889f68d8d 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -425,26 +425,64 @@ openerp.web.list_editable = function (instance) { keyup_ESCAPE: function () { return this.cancel_edition(); }, + /** + * Gets the selection range (start, end) for the provided element, + * returns ``null`` if it can't get a range. + * + * @private + */ _text_selection_range: function (el) { - if (el.selectionStart !== undefined) { + var selectionStart; + try { + selectionStart = el.selectionStart; + } catch (e) { + // radio or checkbox throw on selectionStart access + return null; + } + if (selectionStart !== undefined) { return { - start: el.selectionStart, + start: selectionStart, end: el.selectionEnd }; - } else if(document.body.createTextRange) { + } else if (document.body.createTextRange) { throw new Error("Implement text range handling for MSIE"); var sel = document.body.createTextRange(); if (sel.parentElement() === el) { } } + // Element without selection ranges (select, div/@contenteditable) + return null; }, _text_cursor: function (el) { var selection = this._text_selection_range(el); - if (selection.start !== selection.end) { + if (!selection) { return null; } - return selection.start; + if (selection.start !== selection.end) { + return {position: null, collapsed: false}; + } + return {position: selection.start, collapsed: true}; + }, + /** + * Checks if the cursor is at the start of the provided el + * + * @param {HTMLInputElement | HTMLTextAreaElement} + * @returns {Boolean} + * @private + */ + _at_start: function (cursor, el) { + return cursor.collapsed && (cursor.position === 0); + }, + /** + * Checks if the cursor is at the end of the provided el + * + * @param {HTMLInputElement | HTMLTextAreaElement} + * @returns {Boolean} + * @private + */ + _at_end: function (cursor, el) { + return cursor.collapsed && (cursor.position === el.value.length); }, /** * @param DOMEvent event @@ -454,10 +492,11 @@ openerp.web.list_editable = function (instance) { */ _key_move_record: function (event, record_direction, is_valid_move) { if (!this.editor.is_editing('edit')) { return $.when(); } - // FIXME: assumes editable widgets are input-type elements - var index = this._text_cursor(event.target); - // If selecting or not at the start of the input - if (!is_valid_move(event.target, index)) { return $.when(); } + var cursor = this._text_cursor(event.target); + // if text-based input (has a cursor) + // and selecting (not collapsed) or not at a field boundary + // don't move to the next record + if (cursor && !is_valid_move(event.target, cursor)) { return $.when(); } event.preventDefault(); var source_field = $(event.target).closest('[data-fieldname]') @@ -466,13 +505,15 @@ openerp.web.list_editable = function (instance) { }, keydown_UP: function (e) { - return this._key_move_record(e, 'pred', function (el, index) { - return index === 0; + var self = this; + return this._key_move_record(e, 'pred', function (el, cursor) { + return self._at_start(cursor, el); }); }, keydown_DOWN: function (e) { - return this._key_move_record(e, 'succ', function (el, index) { - return index === el.value.length; + var self = this; + return this._key_move_record(e, 'succ', function (el, cursor) { + return self._at_end(cursor, el); }); }, @@ -480,8 +521,8 @@ openerp.web.list_editable = function (instance) { // If the cursor is at the beginning of the field var source_field = $(e.target).closest('[data-fieldname]') .attr('data-fieldname'); - var index = this._text_cursor(e.target); - if (index !== 0) { return $.when(); } + var cursor = this._text_cursor(e.target); + if (cursor && !this._at_start(cursor, e.target)) { return $.when(); } var fields_order = this.editor.form.fields_order; var field_index = _(fields_order).indexOf(source_field); @@ -504,8 +545,8 @@ openerp.web.list_editable = function (instance) { // looking for new fields at the right var source_field = $(e.target).closest('[data-fieldname]') .attr('data-fieldname'); - var index = this._text_cursor(e.target); - if (index !== e.target.value.length) { return $.when(); } + var cursor = this._text_cursor(e.target); + if (cursor && !this._at_end(cursor, e.target)) { return $.when(); } var fields_order = this.editor.form.fields_order; var field_index = _(fields_order).indexOf(source_field); From 806aac15b0b96a9094a5c1a59de0449d801a15e2 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Thu, 26 Jul 2012 18:12:58 +0530 Subject: [PATCH 10/26] [IMP] project : In project / sales setting, the default working time unit must be Hour. bzr revid: mdi@tinyerp.com-20120726124258-8u7u4j6ei9q95rh3 --- addons/project/project_data.xml | 4 ++++ addons/project/project_demo.xml | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml index 966b1c49f74..a905e074f7b 100644 --- a/addons/project/project_data.xml +++ b/addons/project/project_data.xml @@ -1,6 +1,10 @@ + + + + diff --git a/addons/project/project_demo.xml b/addons/project/project_demo.xml index 07951280dc7..7f96ff87198 100644 --- a/addons/project/project_demo.xml +++ b/addons/project/project_demo.xml @@ -274,9 +274,6 @@ - - -