From 4edbd158455f7249bf9c36207148047c11ad270a Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 10 Nov 2016 13:16:48 +0100 Subject: [PATCH 01/51] [IMP] website_sale: disable zoom on xxs device by default This is a cherry-pick of 44911af6fd0fd5f0996419ba789861b1e35148df opw-710491 --- .../website/static/src/js/website.zoomodoo.js | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/addons/website/static/src/js/website.zoomodoo.js b/addons/website/static/src/js/website.zoomodoo.js index 54dc32bdde0..0e152d0e6de 100644 --- a/addons/website/static/src/js/website.zoomodoo.js +++ b/addons/website/static/src/js/website.zoomodoo.js @@ -32,6 +32,9 @@ // Prevent clicks on the zoom image link. preventClicks: true, + // disable on mobile + disabledOnMobile: true, + // Callback function to execute before the flyout is displayed. beforeShow: $.noop, @@ -69,20 +72,22 @@ * @private */ ZoomOdoo.prototype._init = function() { - this.$link = this.$target.find(this.opts.linkTag).length && this.$target.find(this.opts.linkTag) || this.$target; - this.$image = this.$target.find('img').length && this.$target.find('img') || this.$target; - this.$flyout = $('
'); + if (window.outerWidth > 467 || !this.opts.disabledOnMobile) { + this.$link = this.$target.find(this.opts.linkTag).length && this.$target.find(this.opts.linkTag) || this.$target; + this.$image = this.$target.find('img').length && this.$target.find('img') || this.$target; + this.$flyout = $('
'); - var $attach = this.$target; - if (this.opts.attach !== undefined && this.$target.parents(this.opts.attach).length) { - $attach = this.$target.parents(this.opts.attach); - } - $attach.parent().on('mousemove.zoomodoo touchmove.zoomodoo', $.proxy(this._onMove, this)); - $attach.parent().on('mouseleave.zoomodoo touchend.zoomodoo', $.proxy(this._onLeave, this)); - this.$target.parent().on(this.opts.event + '.zoomodoo touchstart.zoomodoo', $.proxy(this._onEnter, this)); + var $attach = this.$target; + if (this.opts.attach !== undefined && this.$target.parents(this.opts.attach).length) { + $attach = this.$target.parents(this.opts.attach); + } + $attach.parent().on('mousemove.zoomodoo touchmove.zoomodoo', $.proxy(this._onMove, this)); + $attach.parent().on('mouseleave.zoomodoo touchend.zoomodoo', $.proxy(this._onLeave, this)); + this.$target.parent().on(this.opts.event + '.zoomodoo touchstart.zoomodoo', $.proxy(this._onEnter, this)); - if (this.opts.preventClicks) { - this.$target.on('click.zoomodoo', function(e) { e.preventDefault(); }); + if (this.opts.preventClicks) { + this.$target.on('click.zoomodoo', function(e) { e.preventDefault(); }); + } } }; @@ -146,7 +151,6 @@ var touches = e.originalEvent.touches; this.isMouseOver = true; - if (!touches || touches.length === 1) { e.preventDefault(); this.show(e, true); From fb35132bc655748e8f16fec9540732aecf5bab54 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 6 Mar 2017 10:46:49 +0100 Subject: [PATCH 02/51] [FIX] sale_stock: incorrect `return` - Create a SO with both 'service' and 'consu' products - Depending on the order of the lines, the 'Delivered qty' might not be editable consistently. This is because of an incorrect `return` statement in the `_compute_qty_delivered_updateable` method. opw-710561 --- addons/sale_stock/sale_stock.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index 0e4fe11a395..63f03f4a64f 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -121,8 +121,9 @@ class SaleOrderLine(models.Model): def _compute_qty_delivered_updateable(self): for line in self: if line.product_id.type not in ('consu', 'product'): - return super(SaleOrderLine, self)._compute_qty_delivered_updateable() - line.qty_delivered_updateable = False + super(SaleOrderLine, line)._compute_qty_delivered_updateable() + else: + line.qty_delivered_updateable = False @api.onchange('product_id') def _onchange_product_id_set_customer_lead(self): From 3d2841aac0684e71c8eda78e7dd3959062ebd9da Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 6 Mar 2017 16:03:54 +0100 Subject: [PATCH 03/51] [FIX] crm: New / opportunity in the dashboard opens an opp form Up to now, it opened the lead form view instead of the opportunity form view. Most-likely, a new / lead should be added to the dashboard in addition to the new opp, as this is the case with the view lead/opportunity but it doesn't seem it was expected up to now so I leave it like it is. opw-710583 --- addons/crm/views/crm_team_views.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/crm/views/crm_team_views.xml b/addons/crm/views/crm_team_views.xml index 87e2c025bee..4b2f9a9b121 100644 --- a/addons/crm/views/crm_team_views.xml +++ b/addons/crm/views/crm_team_views.xml @@ -145,6 +145,7 @@ ir.actions.act_window form form + [('type','=','opportunity')] { 'search_default_team_id': [active_id], From 2d10c5eb432412c55b452c2aea12ee473b85b92e Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 3 Mar 2017 20:40:50 +0100 Subject: [PATCH 04/51] [FIX] website: use public user for sitemap making (up to s14) The current user was used to generate the sitemap. So if a user with more permissions than `public user` goes on the sitemap, he could generate it (if he is the first to see it or the last generation was more than 12 hours ago (by default)) and have pages unavailables for a user with lower permission in the sitemap (until the sitemap is generated again). The issue was solved in 8.0 with d08facdcb but was introduced back in 10.0 with fd09ddb6f because the `uid` argument was dropped from `generate` method on `ModelConverter`. From 10.0 up to saas-14 the fix introduced is to use a `use_public_user` key in `request.context` but in master we will keep the fd09ddb6f fix by adding uid to the `generate` method. opw-708456 note: to forward-port only up to saas-14 --- addons/website/controllers/main.py | 2 +- addons/website/models/ir_http.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index a1424a72a18..1e5e5a09dd7 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -168,7 +168,7 @@ class Website(Home): sitemaps.unlink() pages = 0 - locs = request.website.sudo(user=request.website.user_id.id).enumerate_pages() + locs = request.website.with_context(use_public_user=True).enumerate_pages() while True: values = { 'locs': islice(locs, 0, LOC_PER_SITEMAP), diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index be90d31c341..b69f9417ac2 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -363,6 +363,8 @@ class ModelConverter(ir.ir_http.ModelConverter): def generate(self, query=None, args=None): Model = request.env[self.model] + if request.context.get('use_public_user'): + Model = Model.sudo(request.website.user_id.id) domain = safe_eval(self.domain, (args or {}).copy()) if query: domain.append((Model._rec_name, 'ilike', '%' + query + '%')) From a14cf3432764f94982229b61a05b83a5b23ece05 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 6 Mar 2017 16:34:47 +0100 Subject: [PATCH 05/51] [FIX] im_livechat: Add the livechat on an external site The file `/web/static/src/js/services/session.js` is not required for the livechat to works, and with it it fails on external websites because it makes RPC calls to the relative URLs: `/web/webclient/bootstrap_translations` `/web/webclient/qweb` opw-710049 Closes #15518 --- addons/im_livechat/views/im_livechat_channel_templates.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/im_livechat/views/im_livechat_channel_templates.xml b/addons/im_livechat/views/im_livechat_channel_templates.xml index 0e3a4b911c8..0e5b476942a 100644 --- a/addons/im_livechat/views/im_livechat_channel_templates.xml +++ b/addons/im_livechat/views/im_livechat_channel_templates.xml @@ -126,7 +126,6 @@ - From 6458210250fb97c75412d88b6c589c28082038e0 Mon Sep 17 00:00:00 2001 From: Atte Isopuro Date: Thu, 2 Mar 2017 11:41:25 +0200 Subject: [PATCH 06/51] [FIX] sale_stock: don't link groupless backorders to all sales When a backorder is created from an outgoing picking, a message is posted, linking to the related sale orders as source of the original picking. If the initial picking was not created from a sale, the resulting backorder group was `False`. The domain ('procurement_group_id', '=', False) matches many unrelated (e.g. unconfirmed) sale orders. Avoid trying to find the origin SO for pickings with no SO Closes #15693 --- addons/sale_stock/models/stock.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/sale_stock/models/stock.py b/addons/sale_stock/models/stock.py index 94693801023..2ced7a63d72 100644 --- a/addons/sale_stock/models/stock.py +++ b/addons/sale_stock/models/stock.py @@ -65,11 +65,12 @@ class StockPicking(models.Model): res = super(StockPicking, self)._create_backorder(backorder_moves) for picking in self.filtered(lambda pick: pick.picking_type_id.code == 'outgoing'): backorder = picking.search([('backorder_id', '=', picking.id)]) - order = self.env['sale.order'].search([('procurement_group_id', '=', backorder.group_id.id)]) - backorder.message_post_with_view( - 'mail.message_origin_link', - values={'self': backorder, 'origin': order}, - subtype_id=self.env.ref('mail.mt_note').id) + if backorder.group_id: # origin from a sale + order = self.env['sale.order'].search([('procurement_group_id', '=', backorder.group_id.id)]) + backorder.message_post_with_view( + 'mail.message_origin_link', + values={'self': backorder, 'origin': order}, + subtype_id=self.env.ref('mail.mt_note').id) return res From cde86680342307fdc0fd20823bc7ee9715a47ab7 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 6 Mar 2017 18:18:58 +0100 Subject: [PATCH 07/51] [FIX] web: IE <= 11.0 doesn't support ChildNode.remove IE 11.0 doesn't support `Childnode.remove`: http://caniuse.com/#feat=childnode-remove As a workaround, we use `Node.removeChild`, which is more widely supported. opw-710617 --- addons/web/static/lib/qweb/qweb2.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js index 1ea73e6278e..1e854a6960c 100644 --- a/addons/web/static/lib/qweb/qweb2.js +++ b/addons/web/static/lib/qweb/qweb2.js @@ -327,7 +327,8 @@ QWeb2.Engine = (function() { if (self.tools.trim(text_node.nodeValue)) { return self.tools.exception("Error: text is not allowed between branching directives"); } - text_node.remove(); + // IE <= 11.0 doesn't support ChildNode.remove + text_node.parentNode.removeChild(text_node); } } else { return self.tools.exception("Error: t-elif and t-else directives must be preceded by a t-if or t-elif directive"); From 69d6c374569d1161599ede74accc4d16c2062121 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 6 Mar 2017 16:27:35 +0100 Subject: [PATCH 08/51] [FIX] web: prepare_dropdown_selection Steps to reproduce the bug: 1.Create a new company 2.Set a user in this company 3.Go to Helpdesk > All tickets > Create It raised a traceback because stage_id was not defined opw:710084 --- addons/web/static/src/js/views/form_widgets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/form_widgets.js b/addons/web/static/src/js/views/form_widgets.js index 8ab953305fb..2bc92bb90cf 100644 --- a/addons/web/static/src/js/views/form_widgets.js +++ b/addons/web/static/src/js/views/form_widgets.js @@ -200,7 +200,7 @@ var KanbanSelection = common.AbstractField.extend({ prepare_dropdown_selection: function() { var self = this; var _data = []; - var current_stage_id = self.view.datarecord.stage_id[0]; + var current_stage_id = self.view.datarecord.stage_id && self.view.datarecord.stage_id[0]; var stage_data = { id: current_stage_id, legend_normal: self.view.datarecord.legend_normal || undefined, From ee78aa7d6a20cc03a8bd2615c07593299b400d9a Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 7 Mar 2017 11:24:01 +0100 Subject: [PATCH 09/51] [FIX] web: avoid undefined options options is not mandatory, crashed when navigating with tabs Complete 2bf6e69e --- addons/web/static/src/js/views/list_view_editable.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/web/static/src/js/views/list_view_editable.js b/addons/web/static/src/js/views/list_view_editable.js index 003b6f18d01..c3b2209c477 100644 --- a/addons/web/static/src/js/views/list_view_editable.js +++ b/addons/web/static/src/js/views/list_view_editable.js @@ -641,6 +641,9 @@ ListView.include(/** @lends instance.web.ListView# */{ if (saveInfo.created) { return self.start_edition(); } + if (!options) { + options = {}; + } options.wraparound = !self.is_action_enabled('create'); var record = self.records[next_record](saveInfo.record, options); if (record === undefined) { From 4ce309dfabc173183c8102080192366d154fa239 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 7 Mar 2017 11:57:14 +0100 Subject: [PATCH 10/51] [FIX] web: deactivate buttons To reproduce: - Get a slow connection, e.g. activate throttling in debug mode of the browser. - Create an invoice with at least one tax. - Change a price unit. - Click on 'Save' then repeatedly on 'Validate' The tax lines are duplicated. The issue comes from two identical `write` calls whose purpose is to delete the existing tax line and create a new tax line. The two calls are issued by the click on 'Save' and the click on 'Validate', which triggers a 'Save' since it doesn't consider the form as being saved yet. There were several issues: - The buttons from the statusbar were not disabled - The buttons were enabled too soon. They should be enabled again when the form is reloaded, otherwise the call to 'Validate' doesn't consider the form saved. This is an extension of commit https://github.com/odoo/odoo/commit/bbbf3db581b5cf883 opw-710642 --- addons/web/static/src/js/views/form_view.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/views/form_view.js b/addons/web/static/src/js/views/form_view.js index 27753aab766..76f9cae7fdd 100644 --- a/addons/web/static/src/js/views/form_view.js +++ b/addons/web/static/src/js/views/form_view.js @@ -728,11 +728,11 @@ var FormView = View.extend(common.FieldManagerMixin, { } }, disable_button: function () { - this.$('.oe_form_buttons').add(this.$buttons).find('button').addClass('o_disabled').prop('disabled', true); + this.$('.oe_form_buttons,.o_statusbar_buttons').add(this.$buttons).find('button').addClass('o_disabled').prop('disabled', true); this.is_disabled = true; }, enable_button: function () { - this.$('.oe_form_buttons').add(this.$buttons).find('button.o_disabled').removeClass('o_disabled').prop('disabled', false); + this.$('.oe_form_buttons,.o_statusbar_buttons').add(this.$buttons).find('button.o_disabled').removeClass('o_disabled').prop('disabled', false); this.is_disabled = false; }, on_button_save: function(e) { @@ -747,8 +747,10 @@ var FormView = View.extend(common.FieldManagerMixin, { self.to_view_mode(); core.bus.trigger('do_reload_needaction'); core.bus.trigger('form_view_saved', self); + }).always(function() { + self.enable_button(); }); - }).always(function(){ + }).fail(function(){ self.enable_button(); }); }, From a7cd820fc14fbe183aba2289ee478ae337b8cb1c Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 7 Mar 2017 10:02:21 +0100 Subject: [PATCH 11/51] [FIX] account: Duplicates a refund customer invoice When clicking on button "Invoices"(below "Print") on a refund customer invoice, it prints "Refund + number". But when clicking on button "Duplicates" it printed "Duplicate + number". Now it prints " Duplicate refund + number" if the customer invoice is of type out_refund. opw:708440 --- addons/account/i18n/account.pot | 5 +++++ addons/account/views/report_invoice.xml | 1 + 2 files changed, 6 insertions(+) diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index e07135c43e6..eef8d521b8c 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -397,6 +397,11 @@ msgstr "" msgid "Duplicate" msgstr "" +#. module: account +#: model:ir.ui.view,arch_db:account.account_invoice_report_duplicate +msgid "refund" +msgstr "" + #. module: account #: model:ir.ui.view,arch_db:account.account_journal_dashboard_kanban_view msgid "New Bill" diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml index 8e3779d5fd2..7d6738c5fcf 100644 --- a/addons/account/views/report_invoice.xml +++ b/addons/account/views/report_invoice.xml @@ -166,6 +166,7 @@

Duplicate + refund

From c0f1f27dbd3eed7b30c0d7b40747e31073f2de31 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 6 Mar 2017 20:11:38 +0100 Subject: [PATCH 12/51] [FIX] crm: translation in merge message - Install a language different from English, set it to your user - Merge two opportunities The merge message which summarizes the operation contains the name of the fields in English. opw-708381 --- addons/crm/models/crm_lead.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py index 9a37435ba43..55dd43323b2 100644 --- a/addons/crm/models/crm_lead.py +++ b/addons/crm/models/crm_lead.py @@ -485,24 +485,21 @@ class Lead(FormatAddress, models.Model): """ title = "%s : %s\n" % (_('Merged opportunity') if self.type == 'opportunity' else _('Merged lead'), self.name) body = [title] - for field_name in fields: - field = self._fields.get(field_name) - if field is None: - continue - - value = self[field_name] - if field.type == 'selection': + fields = self.env['ir.model.fields'].search([('name', 'in', fields or []), ('model_id.model', '=', self._name)]) + for field in fields: + value = self[field.name] + if field.ttype == 'selection': value = dict(field.get_values(self.env)).get(value, value) - elif field.type == 'many2one': + elif field.ttype == 'many2one': if value: value = value.sudo().name_get()[0][1] - elif field.type == 'many2many': + elif field.ttype == 'many2many': if value: value = ','.join( val.name_get()[0][1] for val in value.sudo() ) - body.append("%s: %s" % (field.string, value or '')) + body.append("%s: %s" % (field.field_description, value or '')) return "
".join(body + ['
']) @api.multi From 04bb06fcb30795732e618940b1ed500fb7d80354 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 7 Mar 2017 12:48:27 +0100 Subject: [PATCH 13/51] [FIX] mrp: Do not ask for to provide a lot if there is no finished product. If `product_move` is an empty browse record `produce_move.product_id.tracking` is `False`, not `none`, and therefore `produce_move.product_id.tracking != 'none'` returns True, and it therefore asked to provide a lot for no reason. opw-710748 --- addons/mrp/wizard/mrp_product_produce.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/wizard/mrp_product_produce.py b/addons/mrp/wizard/mrp_product_produce.py index b636fc15ec7..f6a70c4a1f6 100644 --- a/addons/mrp/wizard/mrp_product_produce.py +++ b/addons/mrp/wizard/mrp_product_produce.py @@ -102,7 +102,7 @@ class MrpProductProduce(models.TransientModel): def check_finished_move_lots(self): lots = self.env['stock.move.lots'] produce_move = self.production_id.move_finished_ids.filtered(lambda x: x.product_id == self.product_id and x.state not in ('done', 'cancel')) - if produce_move.product_id.tracking != 'none': + if produce_move and produce_move.product_id.tracking != 'none': if not self.lot_id: raise UserError(_('You need to provide a lot for the finished product')) existing_move_lot = produce_move.move_lot_ids.filtered(lambda x: x.lot_id == self.lot_id) From 8eb759dcff0c90e05fa2546615ed47a895e5f66a Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 7 Mar 2017 11:49:49 +0100 Subject: [PATCH 14/51] [FIX] hr_expense: Multi company rule for hr.expense.sheet To apply to multi company rule on hr.expense.sheet Inspired from Expense multi company rule opw:709834 --- addons/hr_expense/security/ir_rule.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/hr_expense/security/ir_rule.xml b/addons/hr_expense/security/ir_rule.xml index e084a2b9283..61aba78d7ed 100644 --- a/addons/hr_expense/security/ir_rule.xml +++ b/addons/hr_expense/security/ir_rule.xml @@ -20,6 +20,12 @@ ['|',('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] + + Expense Report multi company rule + + + ['|',('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] + From 76b724294aa21c83edd3409d4664e041dd70cd00 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Sat, 4 Mar 2017 22:45:53 +0100 Subject: [PATCH 15/51] [FIX] calendar: correct search in recurrent event Add a 3 use cases with tests that were failing before. datetime filters were not working correctly on stop filters The `_get_recurrent_date_by_event` was only computing recurrency on the start field of an event which can make a difference. A recurring event start=2017-01-01 09:00:00; stop=2017-01-01 10:00:0 was not matched in a search ('stop', '>', '2017-01-01 09:30:00') The filter != was not handled in the recurring use cases. e.g. making the search 'start is set' in the web client is equal to ('start', '!=', False) Searching with only a start filter matching recurring events but not the first ("real") occurence, was returning no result if no stop filter was present. start=2017-01-01 09:00:00; count=5 had no result in a search ('start', '>', '2017-01-02') --- addons/calendar/models/calendar.py | 67 ++++++++++++++----- .../test_calendar_recurrent_event_case2.py | 49 ++++++++++++++ 2 files changed, 101 insertions(+), 15 deletions(-) diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py index 7db83a3cb29..55f99a5239b 100644 --- a/addons/calendar/models/calendar.py +++ b/addons/calendar/models/calendar.py @@ -523,9 +523,23 @@ class Meeting(models.Model): return partners @api.multi - def _get_recurrent_date_by_event(self): - """ Get recurrent dates based on Rule string and all event where recurrent_id is child """ + def _get_recurrent_dates_by_event(self): + """ Get recurrent start and stop dates based on Rule string""" + start_dates = self._get_recurrent_date_by_event(date_field='start') + stop_dates = self._get_recurrent_date_by_event(date_field='stop') + return zip(start_dates, stop_dates) + + @api.multi + def _get_recurrent_date_by_event(self, date_field='start'): + """ Get recurrent dates based on Rule string and all event where recurrent_id is child + + date_field: the field containing the reference date information for recurrency computation + """ self.ensure_one() + if date_field in self._fields.keys() and self._fields[date_field].type in ('date', 'datetime'): + reference_date = self[date_field] + else: + reference_date = self.start def todate(date): val = parser.parse(''.join((re.compile('\d')).findall(date))) @@ -535,14 +549,14 @@ class Meeting(models.Model): return val.astimezone(timezone) timezone = pytz.timezone(self._context.get('tz') or 'UTC') - startdate = pytz.UTC.localize(fields.Datetime.from_string(self.start)) # Add "+hh:mm" timezone - if not startdate: - startdate = datetime.now() + event_date = pytz.UTC.localize(fields.Datetime.from_string(reference_date)) # Add "+hh:mm" timezone + if not event_date: + event_date = datetime.now() - # Convert the start date to saved timezone (or context tz) as it'll + # Convert the event date to saved timezone (or context tz) as it'll # define the correct hour/day asked by the user to repeat for recurrence. - startdate = startdate.astimezone(timezone) # transform "+hh:mm" timezone - rset1 = rrule.rrulestr(str(self.rrule), dtstart=startdate, forceset=True) + event_date = event_date.astimezone(timezone) # transform "+hh:mm" timezone + rset1 = rrule.rrulestr(str(self.rrule), dtstart=event_date, forceset=True) recurring_meetings = self.search([('recurrent_id', '=', self.id), '|', ('active', '=', False), ('active', '=', True)]) for meeting in recurring_meetings: @@ -986,27 +1000,38 @@ class Meeting(models.Model): result.append(meeting.id) result_data.append(meeting.get_search_fields(order_fields)) continue - rdates = meeting._get_recurrent_date_by_event() + rdates = meeting._get_recurrent_dates_by_event() - for r_date in rdates: + for r_start_date, r_stop_date in rdates: # fix domain evaluation # step 1: check date and replace expression by True or False, replace other expressions by True # step 2: evaluation of & and | # check if there are one False pile = [] ok = True + r_date = r_start_date # default for empty domain for arg in domain: if str(arg[0]) in ('start', 'stop', 'final_date'): + if str(arg[0]) == 'start': + r_date = r_start_date + else: + r_date = r_stop_date + if arg[2] and len(arg[2]) > len(r_date.strftime(DEFAULT_SERVER_DATE_FORMAT)): + dformat = DEFAULT_SERVER_DATETIME_FORMAT + else: + dformat = DEFAULT_SERVER_DATE_FORMAT if (arg[1] == '='): - ok = r_date.strftime('%Y-%m-%d') == arg[2] + ok = r_date.strftime(dformat) == arg[2] if (arg[1] == '>'): - ok = r_date.strftime('%Y-%m-%d') > arg[2] + ok = r_date.strftime(dformat) > arg[2] if (arg[1] == '<'): - ok = r_date.strftime('%Y-%m-%d') < arg[2] + ok = r_date.strftime(dformat) < arg[2] if (arg[1] == '>='): - ok = r_date.strftime('%Y-%m-%d') >= arg[2] + ok = r_date.strftime(dformat) >= arg[2] if (arg[1] == '<='): - ok = r_date.strftime('%Y-%m-%d') <= arg[2] + ok = r_date.strftime(dformat) <= arg[2] + if (arg[1] == '!='): + ok = r_date.strftime(dformat) != arg[2] pile.append(ok) elif str(arg) == str('&') or str(arg) == str('|'): pile.append(arg) @@ -1531,6 +1556,18 @@ class Meeting(models.Model): if not self._context.get('virtual_id', True): return super(Meeting, self).search(new_args, offset=offset, limit=limit, order=order, count=count) + if any(arg[0] == 'start' for arg in args) and \ + not any(arg[0] in ('stop', 'final_date') for arg in args): + # domain with a start filter but with no stop clause should be extended + # e.g. start=2017-01-01, count=5 => virtual occurences must be included in ('start', '>', '2017-01-02') + start_args = new_args + new_args = [] + for arg in start_args: + new_arg = arg + if arg[0] in ('start_date', 'start_datetime', 'start',): + new_args += ['|', '&', ('recurrency', '=', 1), ('final_date', arg[1], arg[2])] + new_args.append(new_arg) + # offset, limit, order and count must be treated separately as we may need to deal with virtual ids events = super(Meeting, self).search(new_args, offset=0, limit=0, order=None, count=False) events = self.browse(events.get_recurrent_ids(args, order=order)) diff --git a/addons/calendar/tests/test_calendar_recurrent_event_case2.py b/addons/calendar/tests/test_calendar_recurrent_event_case2.py index da39fa6509b..e05428593ae 100644 --- a/addons/calendar/tests/test_calendar_recurrent_event_case2.py +++ b/addons/calendar/tests/test_calendar_recurrent_event_case2.py @@ -96,3 +96,52 @@ class TestRecurrentEvent(common.TransactionCase): # I update the description of two meetings, and check that both have been updated self.calendar_event_sprint_review.write({'description': "Some description"}) self.assertEqual(self.calendar_event_sprint_review.description, "Some description", "Event %d has not been updated" % self.calendar_event_sprint_review.id) + + def test_recurrent_meeting4(self): + # I create a weekly meeting till a particular end date. + self.CalendarEvent.create({ + 'start': '2017-01-22 11:47:00', + 'stop': '2017-01-22 12:47:00', + 'day': 0.0, + 'duration': 1.0, + 'final_date': '2017-06-30', + 'end_type': 'end_date', + 'fr': True, + 'mo': True, + 'th': True, + 'tu': True, + 'we': True, + 'name': 'Review code with programmer', + 'recurrency': True, + 'rrule_type': 'weekly' + }) + + # I search for a recurrent weekly meetings that take place at a given date. + meetings_count = self.CalendarEvent.with_context({'virtual_id': True}).search_count([ + ('start', '<=', '2017-01-24'), ('stop', '>=', '2017-01-24'), ('name', '=', 'Review code with programmer') + ]) + self.assertEqual(meetings_count, 1, 'Recurrent weekly meetings are not found using date filter !') + + # I search for a recurrent weekly meetings that take place at a given date and time. + meetings_count = self.CalendarEvent.with_context({'virtual_id': True}).search_count([ + ('start', '<=', '2017-01-24 11:55:00'), ('stop', '>=', '2017-01-24 11:55:00'), ('name', '=', 'Review code with programmer') + ]) + self.assertEqual(meetings_count, 1, 'Recurrent weekly meetings are not found using time filter !') + + # I search using the filter 'start date is set' + meetings_count = self.CalendarEvent.with_context({'virtual_id': True}).search_count([ + ('start', '!=', False), ('stop', '>=', '2017-06-30 11:55:00'), ('name', '=', 'Review code with programmer') + ]) + self.assertEqual(meetings_count, 1, "Last recurrent weekly meetings are not found using 'is set' filter !") + + # I search for a recurrent weekly meetings that take place at a given date and time. + meetings_count = self.CalendarEvent.with_context({'virtual_id': True}).search_count([ + ('start', '<=', '2017-01-24 11:55:00'), ('stop', '>=', '2017-01-24 15:55:00') + ]) + self.assertEqual(meetings_count, 0, 'Too late recurrent meetings are found using time filter !') + + # I search using a start filter but no stop + meetings_count = self.CalendarEvent.with_context({'virtual_id': True}).search_count([ + ('start', '>=', '2017-06-30 08:00:00'), ('name', '=', 'Review code with programmer') + ]) + self.assertEqual(meetings_count, 1, "Last recurrent weekly meetings are not found without stop filter !") From 0a2b99f98569c625e1d2b18f1f09f6b17ab6d6a9 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 7 Mar 2017 16:55:05 +0100 Subject: [PATCH 16/51] [FIX] product_visible_discount: use defined variable Oversight of a previous forward-port --- addons/product_visible_discount/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product_visible_discount/models/sale_order.py b/addons/product_visible_discount/models/sale_order.py index 29565b9ae71..6be0f2d5e0b 100644 --- a/addons/product_visible_discount/models/sale_order.py +++ b/addons/product_visible_discount/models/sale_order.py @@ -24,7 +24,7 @@ class SaleOrderLine(models.Model): if pricelist_item.pricelist_id.discount_policy == 'without_discount': partner = self.env.context.get('partner_id') while pricelist_item.base == 'pricelist' and pricelist_item.base_pricelist_id and pricelist_item.base_pricelist_id.discount_policy == 'without_discount': - price, rule_id = pricelist_item.base_pricelist_id.with_context(uom=uom.id).price_rule_get(product_id, qty, partner)[pricelist_item.base_pricelist_id.id] + price, rule_id = pricelist_item.base_pricelist_id.with_context(uom=uom.id).price_rule_get(product.id, qty, partner)[pricelist_item.base_pricelist_id.id] pricelist_item = PricelistItem.browse(rule_id) if pricelist_item.base == 'standard_price': From 629d80c3c2f6e3050e18ff966e7ee0b04612575f Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Tue, 7 Mar 2017 17:34:30 +0100 Subject: [PATCH 17/51] [FIX] mail: fix typo in attachment managment Fix some dead code. This is a fallback for linking mail attachment with its data. The issue was not reported since a long time since this just disable a fallback which in my tests was not used anyway. opw-710502 --- addons/mail/models/mail_thread.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index c610a316d3c..2084f14fda3 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -1324,9 +1324,9 @@ class MailThread(models.AbstractModel): to_remove.append(node) if node.tag == 'img' and node.get('src', '').startswith('cid:'): cid = node.get('src').split(':', 1)[1] - related_attachment = [attach for attach in attachments if len(attach) == 2 and attach[2] == cid] + related_attachment = [attach for attach in attachments if attach[2] and attach[2].get('cid') == cid] if related_attachment: - node.set('data-filename', related_attachment[0]) + node.set('data-filename', related_attachment[0][0]) postprocessed = True for node in to_remove: From 8c2db9a9a22ffe702d844d1bb1cb1c5003c2959e Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 7 Mar 2017 17:25:05 +0100 Subject: [PATCH 18/51] [FIX] account: Duplicates a customer invoice Fine tuning of this commit: a7cd820 When clicking on button "Duplicates" it printed "Duplicate + number". Now it prints " Duplicate invoice + number" if the customer invoice is of type out_invoice. opw:708440 --- addons/account/i18n/account.pot | 7 ++++++- addons/account/views/report_invoice.xml | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index eef8d521b8c..29b240e3c00 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -394,7 +394,7 @@ msgstr "" #. module: account #: model:ir.ui.view,arch_db:account.account_invoice_report_duplicate -msgid "Duplicate" +msgid "invoice" msgstr "" #. module: account @@ -402,6 +402,11 @@ msgstr "" msgid "refund" msgstr "" +#. module: account +#: model:ir.ui.view,arch_db:account.account_invoice_report_duplicate +msgid "Duplicate" +msgstr "" + #. module: account #: model:ir.ui.view,arch_db:account.account_journal_dashboard_kanban_view msgid "New Bill" diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml index 7d6738c5fcf..479689fbaab 100644 --- a/addons/account/views/report_invoice.xml +++ b/addons/account/views/report_invoice.xml @@ -167,6 +167,7 @@

Duplicate refund + invoice

From fb1b9baeb1d0f497d2ebe4756a7b011844527302 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 8 Mar 2017 09:28:24 +0100 Subject: [PATCH 19/51] [FIX] stock: prevent location creation Prevent location creation in pack operation view to avoid location inconsistencies. opw-707439 --- addons/stock/views/stock_pack_operation_views.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/views/stock_pack_operation_views.xml b/addons/stock/views/stock_pack_operation_views.xml index 1f79f6fd758..5b6919dab83 100644 --- a/addons/stock/views/stock_pack_operation_views.xml +++ b/addons/stock/views/stock_pack_operation_views.xml @@ -21,8 +21,8 @@
- - + + From 218a21a37e6af2e2ba0e2b4d8d61d8d52a7547fc Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 8 Mar 2017 10:47:19 +0100 Subject: [PATCH 20/51] [FIX] sale: do not run procurement twice When procurements are created, they are automatically run. Avoid this behavior, to run all procurements at the end of the process and used the optimized JIT behavior. opw-710007 --- addons/sale/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 35db9cec6e6..83dcb3111df 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -596,7 +596,7 @@ class SaleOrderLine(models.Model): vals = line._prepare_order_line_procurement(group_id=line.order_id.procurement_group_id.id) vals['product_qty'] = line.product_uom_qty - qty - new_proc = self.env["procurement.order"].create(vals) + new_proc = self.env["procurement.order"].with_context(procurement_autorun_defer=True).create(vals) new_procs += new_proc new_procs.run() return new_procs From b0321b1474b27b00a1598c0e34942255f8038a72 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 8 Mar 2017 11:44:56 +0100 Subject: [PATCH 21/51] [FIX] sale: do not run procurement twice When procurements are created, they are automatically run. Avoid this behavior, to run all procurements at the end of the process and used the optimized JIT behavior. opw-710007 --- addons/sale/models/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 113cf79245f..8b02ee687b3 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -660,7 +660,7 @@ class SaleOrderLine(models.Model): vals = line._prepare_order_line_procurement(group_id=line.order_id.procurement_group_id.id) vals['product_qty'] = line.product_uom_qty - qty - new_proc = self.env["procurement.order"].create(vals) + new_proc = self.env["procurement.order"].with_context(procurement_autorun_defer=True).create(vals) new_proc.message_post_with_view('mail.message_origin_link', values={'self': new_proc, 'origin': line.order_id}, subtype_id=self.env.ref('mail.mt_note').id) From 8428910a741277d4f3afa1b09cb2042b7b58bc58 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 3 Mar 2017 16:34:46 +0100 Subject: [PATCH 22/51] [FIX] mail: format_date with falsy date If the date passed is falsy, return an empty string instead of crashing. opw-704260 --- addons/mail/models/mail_template.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mail/models/mail_template.py b/addons/mail/models/mail_template.py index 3bfbf636a89..200057f8449 100644 --- a/addons/mail/models/mail_template.py +++ b/addons/mail/models/mail_template.py @@ -20,6 +20,8 @@ _logger = logging.getLogger(__name__) def format_date(pool, cr, uid, date, pattern=False, context=None): + if not date: + return '' date = datetime.datetime.strptime(date[:10], openerp.tools.DEFAULT_SERVER_DATE_FORMAT) lang_code = context.get('lang') or 'en_US' if not pattern: From 4d440caafd4ea42de33b6151a0f17fbac081fd49 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 8 Mar 2017 12:48:30 +0100 Subject: [PATCH 23/51] [FIX] mass_mailing: mailing users requires write on utm.source Since revision 731356a1558f49a0f1cca285cf73364dc9b56ebb and the fact `mail.mass_mailing.campaign` inherits (with s) from `utm.source`, and the name of the mass mailing is took from this `utm.source` linked to the mass mailing, a mass mailing user requires the write access on the model `utm.source` to be able to change the subject of a mass mailing. As a side node, I notice there is no group applied on the base `access_utm_source` access rule of the module UTM, meaning a portal user can create `utm.source`. I am not sure if this is wanted or not. opw-710525 --- addons/mass_mailing/security/ir.model.access.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/mass_mailing/security/ir.model.access.csv b/addons/mass_mailing/security/ir.model.access.csv index b8513df98bc..40a182fe6bd 100644 --- a/addons/mass_mailing/security/ir.model.access.csv +++ b/addons/mass_mailing/security/ir.model.access.csv @@ -10,3 +10,4 @@ access_mass_mailing_system,mail.mass_mailing.system,model_mail_mass_mailing,base access_mail_mail_statistics_user,mail.mail.statistics,model_mail_mail_statistics,base.group_user,1,1,1,1 access_mail_mail_statistics_mass_mailing_user,mail.mail.statistics,model_mail_mail_statistics,mass_mailing.group_mass_mailing_user,1,1,1,1 access_mail_statistics_report,mail.statistics.report,model_mail_statistics_report,mass_mailing.group_mass_mailing_user,1,1,1,1 +access_utm_source,access_utm_source,utm.model_utm_source,mass_mailing.group_mass_mailing_user,1,1,1,0 \ No newline at end of file From 9732c3049a21c12f710ba46819e64e12af8d4661 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 8 Mar 2017 11:15:42 +0100 Subject: [PATCH 24/51] [FIX] hr_timesheet_sheet: keep timesheets linked to a task When deleting an hr_timesheet_sheet.sheet, the linked analytic lines are dropped too. This was introduced in 8.0 at 5f45e7ca The initial bug, reported at #5326, was targeting the analytic lines created independantly, directly from the timesheet encoding. In version 8, the timesheets were encoded via project.task.work and the unlink on the hr_timesheet_sheet.sheet had no effect on the works. In version 10, this model no longer exists and it needs to be filtered to avoid removing independant timesheets. Fixes #15741 --- addons/hr_timesheet_sheet/models/hr_timesheet_sheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/models/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/models/hr_timesheet_sheet.py index 07de39b8bb6..f017760e070 100644 --- a/addons/hr_timesheet_sheet/models/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/models/hr_timesheet_sheet.py @@ -152,7 +152,7 @@ class HrTimesheetSheet(models.Model): analytic_timesheet_toremove = self.env['account.analytic.line'] for sheet in self: - analytic_timesheet_toremove += sheet.timesheet_ids + analytic_timesheet_toremove += sheet.timesheet_ids.filtered(lambda t: not t.task_id) analytic_timesheet_toremove.unlink() return super(HrTimesheetSheet, self).unlink() From 681625ea5645ceb16ce68d5708f7053f72d0bc44 Mon Sep 17 00:00:00 2001 From: Florent de Labarre Date: Tue, 7 Mar 2017 16:41:11 +0100 Subject: [PATCH 25/51] [FIX] account: correct domain evaluation 'is set' filter is the equivalent to != False A many2one has not the value True but an ID Closes #15749 --- addons/account/views/account_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index aeef38f5ffa..861a7943484 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -1068,7 +1068,7 @@ class="oe_link" type="object" string="-> View partially reconciled entries" - attrs="{'invisible': ['|', ('full_reconcile_id', '=', True), '&', ('matched_debit_ids', '=', []),('matched_credit_ids', '=', [])]}"> + attrs="{'invisible': ['|', ('full_reconcile_id', '!=', False), '&', ('matched_debit_ids', '=', []),('matched_credit_ids', '=', [])]}">
From bfef35774d4f4c38da027d2acf45d01dc446abd6 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 8 Mar 2017 13:27:20 +0100 Subject: [PATCH 26/51] [FIX] sale, purchase: currency in subtotal The "Subtotal" field of a SO/PO line is not rounding following the currency rules. opw-710701 --- addons/purchase/views/purchase_views.xml | 1 + addons/sale/views/sale_views.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/addons/purchase/views/purchase_views.xml b/addons/purchase/views/purchase_views.xml index 6046aed830d..7ba8d5708f4 100644 --- a/addons/purchase/views/purchase_views.xml +++ b/addons/purchase/views/purchase_views.xml @@ -210,6 +210,7 @@ + diff --git a/addons/sale/views/sale_views.xml b/addons/sale/views/sale_views.xml index 2405cf6c8fc..f2e502f67e5 100644 --- a/addons/sale/views/sale_views.xml +++ b/addons/sale/views/sale_views.xml @@ -289,6 +289,7 @@ + From 6bb63edb98e0ad3244e2da54ae04c5f62aa69052 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 8 Mar 2017 15:15:42 +0100 Subject: [PATCH 27/51] [FIX] base: save ir.values - Install accounting module - Create new tax, keep note of its ID - Go to Settings > Technical > User-Defined Defaults - Change the value of 'taxes_id' to the ID of the tax created - Create a new product => crash The issue is that the value of 'taxes_id' is saved as a string, not as a list. Therefore, once retrieved, it crashes. opw-709906 --- odoo/addons/base/ir/ir_values.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/odoo/addons/base/ir/ir_values.py b/odoo/addons/base/ir/ir_values.py index 46d533b465b..3093851f5d2 100644 --- a/odoo/addons/base/ir/ir_values.py +++ b/odoo/addons/base/ir/ir_values.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +from ast import literal_eval + from odoo import api, fields, models, tools, _ from odoo.exceptions import AccessError, MissingError from odoo.tools import pickle @@ -132,6 +134,12 @@ class IrValues(models.Model): context.pop(self.CONCURRENCY_CHECK_FIELD, None) for record in self.with_context(context): value = record.value_unpickle + # Only char-like fields should be written directly. Other types should be converted to + # their appropriate type first. + if record.model in self.env and record.name in self.env[record.model]._fields: + field = self.env[record.model]._fields[record.name] + if field.type not in ['char', 'text', 'html', 'selection']: + value = literal_eval(value) if record.key == 'default': value = pickle.dumps(value) record.value = value From f9fa39a8c0edad8624be6327b0b0c6ef59650464 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 8 Mar 2017 16:31:03 +0100 Subject: [PATCH 28/51] [FIX] board: correctly handle invalid actions This may happen when a dashboard contain references to deleted actions. --- addons/board/static/src/js/dashboard.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/board/static/src/js/dashboard.js b/addons/board/static/src/js/dashboard.js index 0d1d210a4de..588d2a862d7 100644 --- a/addons/board/static/src/js/dashboard.js +++ b/addons/board/static/src/js/dashboard.js @@ -173,6 +173,8 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({ action = result, view_mode = action_attrs.view_mode; + if (!action) { return; } + // evaluate action_attrs context and domain action_attrs.context_string = action_attrs.context; action_attrs.context = instance.web.pyeval.eval( From a8efeffbf22bcff497a7ffb9eada545510bac2cd Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 8 Mar 2017 18:00:22 +0100 Subject: [PATCH 29/51] [FIX] pos_mercury: support for Inernet Explorer / Edge In the method `xml_node_to_string` in `qweb2.js`, which is used when extending XML templates, such as this extend of the template `PaymentScreen-Paymentlines` the method `(new XMLSerializer()).serializeToString(node)` magically escapes the double quotes `"` in Internet Explorer and Edge, while this is not the case in other browsers, therefore converting, for instance, `this.removeAttr("class");` to `this.removeAttr("e;class"e;);` whhich made the rendering of the template fails. As this method is quite critical, we do not dare editing it to use an alternative to `XMLSerializer.serializeToString` in a stable release Instead, as a workaround, we just avoid the use of the double quotes. opw-708296 --- addons/pos_mercury/static/src/xml/pos_mercury.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/pos_mercury/static/src/xml/pos_mercury.xml b/addons/pos_mercury/static/src/xml/pos_mercury.xml index 02f25588a3c..acf830e2543 100644 --- a/addons/pos_mercury/static/src/xml/pos_mercury.xml +++ b/addons/pos_mercury/static/src/xml/pos_mercury.xml @@ -25,16 +25,16 @@ - this.removeAttr("class"); - this.attr('t-attf-class', 'paymentline selected #{line.mercury_swipe_pending ? "o_pos_mercury_swipe_pending" : ""}'); + this.removeAttr('class'); + this.attr('t-attf-class', 'paymentline selected #{line.mercury_swipe_pending ? \'o_pos_mercury_swipe_pending\' : \'\'}'); - this.removeAttr("class"); - this.attr('t-attf-class', 'paymentline #{line.mercury_swipe_pending ? "o_pos_mercury_swipe_pending" : ""}'); + this.removeAttr('class'); + this.attr('t-attf-class', 'paymentline #{line.mercury_swipe_pending ? \'o_pos_mercury_swipe_pending\' : \'\'}'); - this.removeAttr("class"); - this.attr('t-attf-class', 'col-tendered edit #{line.mercury_swipe_pending ? "o_pos_mercury_swipe_pending" : ""}'); + this.removeAttr('class'); + this.attr('t-attf-class', 'col-tendered edit #{line.mercury_swipe_pending ? \'o_pos_mercury_swipe_pending\' : \'\'}'); From 2ad0a5a90611e45ba612ab157b328620dc3059dc Mon Sep 17 00:00:00 2001 From: Jeffery CHEN Fan Date: Thu, 9 Mar 2017 16:03:31 +0800 Subject: [PATCH 30/51] [FIX] l10n_cn: correct China accounts Correct the list of accounts using wrong type Better manifest with copyright and english description Fixes #14999 Closes #15021 --- addons/l10n_cn_standard/__init__.py | 6 +- addons/l10n_cn_standard/__manifest__.py | 27 +- .../data/account.account.template.csv | 174 ++++ .../data/account_chart_template_data.xml | 21 + .../data/account_tax_templates.xml | 35 + .../data/l10n_cn_standard_chart_data.xml | 788 +----------------- 6 files changed, 262 insertions(+), 789 deletions(-) create mode 100644 addons/l10n_cn_standard/data/account.account.template.csv create mode 100644 addons/l10n_cn_standard/data/account_chart_template_data.xml create mode 100644 addons/l10n_cn_standard/data/account_tax_templates.xml diff --git a/addons/l10n_cn_standard/__init__.py b/addons/l10n_cn_standard/__init__.py index 7e7e19a411a..8e0bd7042c7 100644 --- a/addons/l10n_cn_standard/__init__.py +++ b/addons/l10n_cn_standard/__init__.py @@ -1,4 +1,8 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -# Copyright (C) 2007-2014 Jeff Wang(). +# Copyright (C) 2008-2008 凯源吕鑫 lvxin@gmail.com +# 维智众源 oldrev@gmail.com +# Copyright (C) 2012-2012 南京盈通 ccdos@intoerp.com +# Copyright (C) 2008-now 开阖软件 jeff@osbzr.com < PM and LTS > +# Copyright (C) 2017-now jeffery9@gmail.com diff --git a/addons/l10n_cn_standard/__manifest__.py b/addons/l10n_cn_standard/__manifest__.py index 465dbaa8da7..0de3fc1529c 100644 --- a/addons/l10n_cn_standard/__manifest__.py +++ b/addons/l10n_cn_standard/__manifest__.py @@ -5,26 +5,35 @@ # 维智众源 oldrev@gmail.com # Copyright (C) 2012-2012 南京盈通 ccdos@intoerp.com # Copyright (C) 2008-now 开阖软件 jeff@osbzr.com < PM and LTS > +# Copyright (C) 2017-now jeffery9@gmail.com { - 'name': '中国会计科目表-企业会计准则', - 'version': '1.8', + 'name': '会计科目表 - 中国企业会计准则', + 'version': '2.0', 'category': 'Localization', - 'author': 'www.openerp-china.org', - 'maintainer': 'jeff@osbzr.com', - 'website': 'http://openerp-china.org', + 'author': ['lvxin@gmail.co', 'oldrev@gmail.co', 'ccdos@intoerp.com', 'jeff@osbzr.com', 'jeffery9@gmail.com'], + + 'website': 'http://shine-it.net', 'description': """ +Including the following data in the Accounting Standards for Business Enterprises +包含企业会计准则以下数据 - 科目类型\会计科目表模板\增值税\辅助核算类别\管理会计凭证簿\财务会计凭证簿 +* Chart of Accounts +* 科目表模板 - 添加中文省份数据 +* Account templates +* 科目模板 - 增加小企业会计科目表 +* Tax templates +* 税金模板 """, 'depends': ['l10n_cn'], 'data': [ - 'data/l10n_cn_standard_chart_data.xml', + 'data/l10n_chart_china_standard_business_chart_data.xml', + 'data/account.account.template.csv', + 'data/account_tax_templates.xml', + 'data/account_chart_template_data.xml', 'data/account_chart_template_data.yml', ], 'license': 'GPL-3', diff --git a/addons/l10n_cn_standard/data/account.account.template.csv b/addons/l10n_cn_standard/data/account.account.template.csv new file mode 100644 index 00000000000..0cc206754be --- /dev/null +++ b/addons/l10n_cn_standard/data/account.account.template.csv @@ -0,0 +1,174 @@ +id,code,name,reconcile,user_type_id/id,chart_template_id/id +account_1011,1011,存放同业,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1012,1012,其他货币资金,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1021,1021,结算备付金,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1031,1031,存出保证金,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1101,1101,交易性金融资产,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1111,1111,买入返售金融资产,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1121,1121,应收票据,TRUE,account.data_account_type_receivable,l10n_chart_china_standard_business +account_1122,1122,应收账款,TRUE,account.data_account_type_receivable,l10n_chart_china_standard_business +account_1123,1123,预付账款,TRUE,account.data_account_type_receivable,l10n_chart_china_standard_business +account_1131,1131,应收股利,TRUE,account.data_account_type_receivable,l10n_chart_china_standard_business +account_1132,1132,应收利息,TRUE,account.data_account_type_receivable,l10n_chart_china_standard_business +account_1201,1201,应收代位追偿款,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1211,1211,应收分保账款,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1212,1212,应收分保合同准备金,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1221,1221,其他应收款,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1231,1231,坏账准备,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1301,1301,贴现资产,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1302,1302,拆出资金,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1303,1303,贷款,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1304,1304,贷款损失准备,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1311,1311,代理兑付证券,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1321,1321,代理业务资产,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1401,1401,材料采购,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1402,1402,在途物资,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1403,1403,原材料,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1404,1404,材料成本差异,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1405,1405,库存商品,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1406,1406,发出商品,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1407,1407,商品进销差价,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1408,1408,委托加工物资,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1411,1411,周转材料,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1421,1421,消耗性生物资产,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1431,1431,贵金属,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1441,1441,抵债资产,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1451,1451,损余物资,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1461,1461,融资租赁资产,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1471,1471,存货跌价准备,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1501,1501,持有至到期投资,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1502,1502,持有至到期投资减值准备,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1503,1503,可供出售金融资产,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1511,1511,长期股权投资,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1512,1512,长期股权投资减值准备,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1521,1521,投资性房地产,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1531,1531,长期应收款,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1532,1532,未实现融资收益,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1541,1541,存出资本保证金,FALSE,account.data_account_type_non_current_assets,l10n_chart_china_standard_business +account_1601,1601,固定资产,FALSE,account.data_account_type_fixed_assets,l10n_chart_china_standard_business +account_1602,1602,累计折旧,FALSE,account.data_account_type_fixed_assets,l10n_chart_china_standard_business +account_1603,1603,固定资产减值准备,FALSE,account.data_account_type_fixed_assets,l10n_chart_china_standard_business +account_1604,1604,在建工程,FALSE,account.data_account_type_fixed_assets,l10n_chart_china_standard_business +account_1605,1605,工程物资,FALSE,account.data_account_type_fixed_assets,l10n_chart_china_standard_business +account_1606,1606,固定资产清理,FALSE,account.data_account_type_fixed_assets,l10n_chart_china_standard_business +account_1611,1611,未担保余值,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1621,1621,生产性生物资产,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1622,1622,生产性生物资产累计折旧,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1623,1623,公益性生物资产,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1631,1631,油气资产,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1632,1632,累计折耗,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1701,1701,无形资产,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1702,1702,累计摊销,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1703,1703,无形资产减值准备,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1711,1711,商誉,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1801,1801,长期待摊费用,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1811,1811,递延所得税资产,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1821,1821,独立账户资产,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_1901,1901,待处理财产损溢,FALSE,account.data_account_type_current_assets,l10n_chart_china_standard_business +account_2001,2001,短期借款,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2002,2002,存入保证金,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2003,2003,拆入资金,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2004,2004,向中央银行借款,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2011,2011,吸收存款,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2012,2012,同业存放,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2021,2021,贴现负债,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2101,2101,交易性金融负债,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2111,2111,卖出回购金融资产款,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2201,2201,应付票据,TRUE,account.data_account_type_payable,l10n_chart_china_standard_business +account_2202,2202,应付账款,TRUE,account.data_account_type_payable,l10n_chart_china_standard_business +account_2203,2203,预收账款,TRUE,account.data_account_type_payable,l10n_chart_china_standard_business +account_2211,2211,应付职工薪酬,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221,2221,应交税费,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_1_1,2221.01.01,进项税额,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_1_2,2221.01.02,已交税金,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_1_3,2221.01.03,转出未交增值税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_1_4,2221.01.04,减免税款,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_1_5,2221.01.05,销项税额,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_1_6,2221.01.06,出口退税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_1_7,2221.01.07,进项税额转出,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_1_8,2221.01.08,出口抵减内销产品应纳税额,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_1_9,2221.01.09,转出多交增值税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_1_10,2221.01.10,未交增值税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_2,2221.02,应交营业税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_3,2221.03,应交消费税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_4,2221.04,应交资源税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_5,2221.05,应交所得税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_6,2221.06,应交土地增值税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_7,2221.07,应交城市维护建设税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_8,2221.08,应交房产税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_9,2221.09,应交土地使用税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_10,2221.10,应交车船使用税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2221_11,2221.11,应交个人所得税,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2231,2231,应付利息,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2232,2232,应付股利,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2241,2241,其他应付款,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2251,2251,应付保单红利,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2261,2261,应付分保账款,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2311,2311,代理买卖证券款,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2312,2312,代理承销证券款,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2313,2313,代理兑付证券款,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2314,2314,代理业务负债,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2401,2401,递延收益,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2501,2501,长期借款,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2502,2502,应付债券,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2601,2601,未到期责任准备金,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2602,2602,保险责任准备金,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2611,2611,保户储金,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2621,2621,独立账户负债,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2701,2701,长期应付款,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2702,2702,未确认融资费用,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2711,2711,专项应付款,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2801,2801,预计负债,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_2901,2901,递延所得税负债,FALSE,account.data_account_type_current_liabilities,l10n_chart_china_standard_business +account_3001,3001,清算资金往来,FALSE,l10n_cn.user_type_all,l10n_chart_china_standard_business +account_3002,3002,货币兑换,FALSE,l10n_cn.user_type_all,l10n_chart_china_standard_business +account_3101,3101,衍生工具,FALSE,l10n_cn.user_type_all,l10n_chart_china_standard_business +account_3201,3201,套期工具,FALSE,l10n_cn.user_type_all,l10n_chart_china_standard_business +account_3202,3202,被套期项目,FALSE,l10n_cn.user_type_all,l10n_chart_china_standard_business +account_4001,4001,实收资本,FALSE,account.data_account_type_equity,l10n_chart_china_standard_business +account_4002,4002,资本公积,FALSE,account.data_account_type_equity,l10n_chart_china_standard_business +account_4101,4101,盈余公积,FALSE,account.data_account_type_equity,l10n_chart_china_standard_business +account_4102,4102,一般风险准备,FALSE,account.data_account_type_equity,l10n_chart_china_standard_business +account_4103,4103,本年利润,FALSE,account.data_account_type_equity,l10n_chart_china_standard_business +account_4104,4104,利润分配,FALSE,account.data_account_type_equity,l10n_chart_china_standard_business +account_4201,4201,库存股,FALSE,account.data_account_type_equity,l10n_chart_china_standard_business +account_5001,5001,生产成本,FALSE,l10n_cn.user_type_all,l10n_chart_china_standard_business +account_5101,5101,制造费用,FALSE,l10n_cn.user_type_all,l10n_chart_china_standard_business +account_5201,5201,劳务成本,FALSE,l10n_cn.user_type_all,l10n_chart_china_standard_business +account_5301,5301,研发支出,FALSE,l10n_cn.user_type_all,l10n_chart_china_standard_business +account_5401,5401,工程施工,FALSE,l10n_cn.user_type_all,l10n_chart_china_standard_business +account_5402,5402,工程结算,FALSE,l10n_cn.user_type_all,l10n_chart_china_standard_business +account_5403,5403,机械作业,FALSE,l10n_cn.user_type_all,l10n_chart_china_standard_business +account_6001,6001,主营业务收入,FALSE,account.data_account_type_revenue,l10n_chart_china_standard_business +account_6011,6011,利息收入,FALSE,account.data_account_type_revenue,l10n_chart_china_standard_business +account_6021,6021,手续费及佣金收入,FALSE,account.data_account_type_revenue,l10n_chart_china_standard_business +account_6031,6031,保费收入,FALSE,account.data_account_type_revenue,l10n_chart_china_standard_business +account_6041,6041,租赁收入,FALSE,account.data_account_type_revenue,l10n_chart_china_standard_business +account_6051,6051,其他业务收入,FALSE,account.data_account_type_revenue,l10n_chart_china_standard_business +account_6061,6061,汇兑损益,FALSE,account.data_account_type_revenue,l10n_chart_china_standard_business +account_6101,6101,公允价值变动损益,FALSE,account.data_account_type_revenue,l10n_chart_china_standard_business +account_6111,6111,投资收益,FALSE,account.data_account_type_revenue,l10n_chart_china_standard_business +account_6201,6201,摊回保险责任准备金,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6202,6202,摊回赔付支出,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6203,6203,摊回分保费用,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6301,6301,营业外收入,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6401,6401,主营业务成本,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6402,6402,其他业务成本,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6403,6403,营业税金及附加,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6411,6411,利息支出,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6421,6421,手续费及佣金支出,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6501,6501,提取未到期责任准备金,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6502,6502,提取保险责任准备金,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6511,6511,赔付支出,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6521,6521,保单红利支出,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6531,6531,退保金,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6541,6541,分出保费,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6542,6542,分保费用,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6601,6601,销售费用,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6602,6602,管理费用,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6603,6603,财务费用,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6604,6604,勘探费用,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6701,6701,资产减值损失,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6711,6711,营业外支出,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6801,6801,所得税费用,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business +account_6901,6901,以前年度损益调整,FALSE,account.data_account_type_expenses,l10n_chart_china_standard_business \ No newline at end of file diff --git a/addons/l10n_cn_standard/data/account_chart_template_data.xml b/addons/l10n_cn_standard/data/account_chart_template_data.xml new file mode 100644 index 00000000000..4302c9f5c5c --- /dev/null +++ b/addons/l10n_cn_standard/data/account_chart_template_data.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + 中国会计科目表 (财会[2006]3号《企业会计准则》) + account.chart.template + default + + + + + diff --git a/addons/l10n_cn_standard/data/account_tax_templates.xml b/addons/l10n_cn_standard/data/account_tax_templates.xml new file mode 100644 index 00000000000..6dc3deef4cc --- /dev/null +++ b/addons/l10n_cn_standard/data/account_tax_templates.xml @@ -0,0 +1,35 @@ + + + + + + + 增值税17%销项税 + taxes + + + 增值税17%进项税 + taxes + + + 增值税17%销项税 - 中国会计科目表-企业会计准则 + percent + + sale + + + + + + + 增值税17%进项税 - 中国会计科目表-企业会计准则 + + purchase + percent + + + + + + + diff --git a/addons/l10n_cn_standard/data/l10n_cn_standard_chart_data.xml b/addons/l10n_cn_standard/data/l10n_cn_standard_chart_data.xml index 79371410418..8fa9fee4a0e 100644 --- a/addons/l10n_cn_standard/data/l10n_cn_standard_chart_data.xml +++ b/addons/l10n_cn_standard/data/l10n_cn_standard_chart_data.xml @@ -1,794 +1,24 @@ - - - - + 转让帐户 1003 - - + + - - 中国会计科目表 (财会[2006]3号《企业会计准则》 - - + 中国会计科目表 (财会[2006]3号《企业会计准则》 + + 1001 1002 - + - - + + - - - - 1015 - 其他货币资金 - - - - - - 1101 - 交易性金融资产 - - - - - - 1121 - 应收票据 - - - - - - 1122 - 应收账款 - - - - - - 1123 - 预付账款 - - - - - - 1131 - 应收股利 - - - - - - 1132 - 应收利息 - - - - - - 1231 - 其他应收款 - - - - - - 1241 - 坏账准备 - - - - - - 1401 - 材料采购 - - - - - - 1402 - 在途物资 - - - - - - 1403 - 原材料 - - - - - - 1404 - 材料成本差异 - - - - - - 1406 - 库存商品 - - - - - - 1407 - 发出商品 - - - - - - 1410 - 商品进销差价 - - - - - - 1411 - 委托加工物资 - - - - - - 1412 - 包装物及低值易耗品 - - - - - - 1461 - 存货跌价准备 - - - - - - 1501 - 待摊费用 - - - - - - 1521 - 持有至到期投资 - - - - - - 1522 - 持有至到期投资减值准备 - - - - - - 1524 - 长期股权投资 - - - - - - 1525 - 长期投资减值准备 - - - - - - 1531 - 长期应收款 - - - - - - 1601 - 固定资产 - - - - - - 1602 - 累计折旧 - - - - - - 1603 - 固定资产减值准备 - - - - - - 1604 - 在建工程 - - - - - - 1605 - 工程物资 - - - - - - 1606 - 固定资产清理 - - - - - - 1701 - 无形资产 - - - - - - 1703 - 无形资产减值准备 - - - - - - 1711 - 商誉 - - - - - - 1801 - 长期待摊费用 - - - - - - 1811 - 递延所得税资产 - - - - - - 1901 - 待处理财产损溢 - - - - - - 2001 - 短期借款 - - - - - - 2101 - 交易性金融负债 - - - - - - 2201 - 应付票据 - - - - - - 2202 - 应付账款 - - - - - - 2205 - 预收账款 - - - - - - 2211 - 应付职工薪酬 - - - - - - 22210101 - 进项税额 - - - - - - 22210102 - 已交税金 - - - - - - 22210103 - 转出未交增值税 - - - - - - 22210104 - 减免税款 - - - - - - 22210105 - 销项税额 - - - - - - 22210106 - 出口退税 - - - - - - 22210107 - 进项税额转出 - - - - - - 22210108 - 出口抵减内销产品应纳税额 - - - - - - 22210109 - 转出多交增值税 - - - - - - 22210110 - 未交增值税 - - - - - - 222102 - 应交营业税 - - - - - - 222103 - 应交消费税 - - - - - - 222104 - 应交资源税 - - - - - - 222105 - 应交所得税 - - - - - - 222106 - 应交土地增值税 - - - - - - 222107 - 应交城市维护建设税 - - - - - - 222108 - 应交房产税 - - - - - - 222109 - 应交土地使用税 - - - - - - 222110 - 应交车船使用税 - - - - - - 222111 - 应交个人所得税 - - - - - - 2231 - 应付股利 - - - - - - 2232 - 应付利息 - - - - - - 2241 - 其他应付款 - - - - - - 2401 - 预提费用 - - - - - - 2601 - 长期借款 - - - - - - 2602 - 长期债券 - - - - - - 2801 - 长期应付款 - - - - - - 2901 - 递延所得税负债 - - - - - - 3101 - 衍生工具 - - - - - - 3102 - 套期工具 - - - - - - 3202 - 被套期项目 - - - - - - 4001 - 实收资本 - - - - - - 4002 - 资本公积 - - - - - - 4101 - 盈余公积 - - - - - - 4103 - 本年利润 - - - - - - 4104 - 利润分配 - - - - - - 4201 - 库存股 - - - - - - 5001 - 生产成本 - - - - - - 5101 - 制造费用 - - - - - - 5201 - 劳务成本 - - - - - - 5301 - 研发支出 - - - - - - 6001 - 主营业务收入 - - - - - - 6051 - 其他业务收入 - - - - - - 6101 - 公允价值变动损益 - - - - - - 6111 - 投资收益 - - - - - - 6301 - 营业外收入 - - - - - - 6401 - 主营业务成本 - - - - - - 6402 - 其他业务支出 - - - - - - 6405 - 营业税金及附加 - - - - - - 6601 - 销售费用 - - - - - - 6602 - 管理费用 - - - - - - 6603 - 财务费用 - - - - - - 6701 - 资产减值损失 - - - - - - 6711 - 营业外支出 - - - - - - 6801 - 所得税 - - - - - - 6901 - 以前年度损益调整 - - - - - - - 7001 - 增益账户 - - - - - - 7002 - 损益表 - - - - - - - - - - - - - - - - - 中国会计科目表 (财会[2006]3号《企业会计准则》) - account.chart.template - default - - - - - - - - 增值税17%销项税 - taxes - - - 增值税17%进项税 - taxes - - - - 增值税17%销项税 - 中国会计科目表-企业会计准则 - percent - - sale - - - - - - - 增值税17%进项税 - 中国会计科目表-企业会计准则 - - purchase - percent - - - - - - From e4a0a300cb974bbcbe599770926efe0a385fee0f Mon Sep 17 00:00:00 2001 From: "Denis Roussel (ACSONE)" Date: Thu, 9 Mar 2017 09:10:23 +0100 Subject: [PATCH 31/51] [FIX] stock_calendar : correctly schedule calendar Bad call to api.multi method. Introduced at 4cb09653 Closes #15763 --- addons/stock_calendar/models/stock.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/stock_calendar/models/stock.py b/addons/stock_calendar/models/stock.py index 01768f43d0d..9ed605cda30 100644 --- a/addons/stock_calendar/models/stock.py +++ b/addons/stock_calendar/models/stock.py @@ -34,7 +34,6 @@ class StockWarehouseOrderpoint(models.Model): """ # TDE FIXME: unused context key 'no_round_hours' removed # Check if orderpoint has last execution date and calculate if we need to calculate again already - Calendar = self.env["resource.calendar"] Attendance = self.env["resource.calendar.attendance"] group = False date = False @@ -46,7 +45,7 @@ class StockWarehouseOrderpoint(models.Model): else: new_date = datetime.utcnow() # TDE note: I bet accessing interval[2] will crash, no ? this code seems very louche - intervals = Calendar._schedule_days(self.purchase_calendar_id.id, 1, new_date, compute_leaves=True) + intervals = self.purchase_calendar_id._schedule_days(1, new_date, compute_leaves=True) for interval in intervals: # If last execution date, interval should start after it in order not to execute the same orderpoint twice # TODO: Make the interval a little bigger From bb0b4cb8f2b61abaa5321ecc7ff4eef95cfcf447 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 9 Mar 2017 10:38:17 +0100 Subject: [PATCH 32/51] [FIX] fleet: return_action_to_open The 'group_by' must be poped from the context in function return_action_to_open because the act_window can call another model. opw:710363 --- addons/fleet/fleet.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/fleet/fleet.py b/addons/fleet/fleet.py index 5367ea1f003..3f5a3729f8a 100644 --- a/addons/fleet/fleet.py +++ b/addons/fleet/fleet.py @@ -196,6 +196,7 @@ class fleet_vehicle(osv.Model): if context is None: context = {} if context.get('xml_id'): + context.pop('group_by', False) res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid ,'fleet', context['xml_id'], context=context) res['context'] = context res['context'].update({'default_vehicle_id': ids[0]}) From 1dea8a53fbe5d064ea6aeae6506df71be00412f5 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Wed, 8 Mar 2017 16:03:54 +0100 Subject: [PATCH 33/51] [FIX] resource: correct also microsecond information A lot of methods are designed to work with pure datetime objects as args. If the value comes from the database it will be rounded at the level of seconds (0 microsecond). If it comes from a call do datetime.now() / datetime.utcnow() the datetime object has a value != 0 for its mircroseconds attribute. Therefore some methods have unpredictable results depending of the origin of the values manipulated since the microsecond argument is missing into all the calls to datetime.replace Closes #15768 --- addons/resource/models/resource.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/addons/resource/models/resource.py b/addons/resource/models/resource.py index 32898e2470e..5551d1c6838 100644 --- a/addons/resource/models/resource.py +++ b/addons/resource/models/resource.py @@ -300,34 +300,34 @@ class ResourceCalendar(models.Model): # Computes start_dt, end_dt (with default values if not set) + off-interval work limits work_limits = [] if start_dt is None and end_dt is not None: - start_dt = end_dt.replace(hour=0, minute=0, second=0) + start_dt = end_dt.replace(hour=0, minute=0, second=0, microsecond=0) elif start_dt is None: - start_dt = datetime.datetime.now().replace(hour=0, minute=0, second=0) + start_dt = datetime.datetime.now().replace(hour=0, minute=0, second=0, microsecond=0) else: - work_limits.append((start_dt.replace(hour=0, minute=0, second=0), start_dt)) + work_limits.append((start_dt.replace(hour=0, minute=0, second=0, microsecond=0), start_dt)) if end_dt is None: - end_dt = start_dt.replace(hour=23, minute=59, second=59) + end_dt = start_dt.replace(hour=23, minute=59, second=59, microsecond=999999) else: - work_limits.append((end_dt, end_dt.replace(hour=23, minute=59, second=59))) + work_limits.append((end_dt, end_dt.replace(hour=23, minute=59, second=59, microsecond=999999))) assert start_dt.date() == end_dt.date(), 'get_working_intervals_of_day is restricted to one day' intervals = [] - work_dt = start_dt.replace(hour=0, minute=0, second=0) + work_dt = start_dt.replace(hour=0, minute=0, second=0, microsecond=0) # no calendar: try to use the default_interval, then return directly if not self: working_interval = [] if default_interval: - working_interval = (start_dt.replace(hour=default_interval[0], minute=0, second=0), - start_dt.replace(hour=default_interval[1], minute=0, second=0)) + working_interval = (start_dt.replace(hour=default_interval[0], minute=0, second=0, microsecond=0), + start_dt.replace(hour=default_interval[1], minute=0, second=0, microsecond=0)) intervals = self.interval_remove_leaves(working_interval, work_limits) return intervals working_intervals = [] tz_info = fields.Datetime.context_timestamp(self, work_dt).tzinfo for calendar_working_day in self.get_attendances_for_weekday(start_dt): - dt_f = work_dt.replace(hour=0, minute=0, second=0) + timedelta(seconds=(calendar_working_day.hour_from * 3600)) - dt_t = work_dt.replace(hour=0, minute=0, second=0) + timedelta(seconds=(calendar_working_day.hour_to * 3600)) + dt_f = work_dt.replace(hour=0, minute=0, second=0, microsecond=0) + timedelta(seconds=(calendar_working_day.hour_from * 3600)) + dt_t = work_dt.replace(hour=0, minute=0, second=0, microsecond=0) + timedelta(seconds=(calendar_working_day.hour_to * 3600)) # adapt tz working_interval = ( @@ -369,12 +369,12 @@ class ResourceCalendar(models.Model): resource_id=None, default_interval=None): hours = 0.0 for day in rrule.rrule(rrule.DAILY, dtstart=start_dt, - until=(end_dt + timedelta(days=1)).replace(hour=0, minute=0, second=0), + until=(end_dt + timedelta(days=1)).replace(hour=0, minute=0, second=0, microsecond=0), byweekday=self.get_weekdays()): - day_start_dt = day.replace(hour=0, minute=0, second=0) + day_start_dt = day.replace(hour=0, minute=0, second=0, microsecond=0) if start_dt and day.date() == start_dt.date(): day_start_dt = start_dt - day_end_dt = day.replace(hour=23, minute=59, second=59) + day_end_dt = day.replace(hour=23, minute=59, second=59, microsecond=999999) if end_dt and day.date() == end_dt.date(): day_end_dt = end_dt hours += self.get_working_hours_of_date( @@ -528,7 +528,7 @@ class ResourceCalendar(models.Model): intervals = [] planned_days = 0 iterations = 0 - current_datetime = day_date.replace(hour=0, minute=0, second=0) + current_datetime = day_date.replace(hour=0, minute=0, second=0, microsecond=0) while planned_days < days and iterations < 100: working_intervals = self.get_working_intervals_of_day( @@ -585,7 +585,7 @@ class ResourceCalendar(models.Model): saas-3, counts leave hours instead of all-day leaves.""" return self.schedule_hours( hours * -1.0, - day_dt=dt_from.replace(minute=0, second=0), + day_dt=dt_from.replace(minute=0, second=0, microsecond=0), compute_leaves=True, resource_id=resource, default_interval=(8, 16) ) From f5722e5076076f2063a6266a746ca67c58449eb3 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 9 Mar 2017 14:20:36 +0100 Subject: [PATCH 34/51] [FIX] l10n_fr: add missing account 649 (CICE) Switch account 120 to 'current year earning' type Closes #15717 --- addons/l10n_fr/data/account_chart_template_data.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/l10n_fr/data/account_chart_template_data.xml b/addons/l10n_fr/data/account_chart_template_data.xml index f797e164605..429e5b3030e 100644 --- a/addons/l10n_fr/data/account_chart_template_data.xml +++ b/addons/l10n_fr/data/account_chart_template_data.xml @@ -239,7 +239,7 @@ Résultat de l'exercice (bénéfice) 120 - + @@ -4032,6 +4032,13 @@ + + Crédit d’Impôt Compétitivité Emploi (CICE) + 649 + + + + Redevances pour concessions brevets, licences, marques, procédés, logiciels 6511 From 1d0d74bd89e0b6b6faecf02eee7fa19bafb8e69c Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 9 Mar 2017 13:50:33 +0100 Subject: [PATCH 35/51] [FIX] payment: transaction form The transaction form has readability issues. It is improved by taking as a example the partner form. opw-711162 --- addons/payment/views/payment_views.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/payment/views/payment_views.xml b/addons/payment/views/payment_views.xml index f005456e79e..1d7aac34edd 100644 --- a/addons/payment/views/payment_views.xml +++ b/addons/payment/views/payment_views.xml @@ -220,22 +220,22 @@