diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-10-31 12:07:15 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-10-31 12:07:15 +0100 |
| commit | a0157f104f7ff94728af20702858b390d771d698 (patch) | |
| tree | 76003492d182a64389a62127701c99457983d874 | |
| parent | a2890c1e76c9c73d80689f78aa2e6665ecdc9f31 (diff) | |
| parent | dcce040a637cafb6129ae483d4e31b64dd2070b3 (diff) | |
[MERGE] forward port branch 10.0 up to dcce040a637
31 files changed, 122 insertions, 51 deletions
diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 6c9ffe49f2c..035ef3ee5c8 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -916,8 +916,7 @@ class AccountInvoice(models.Model): subtype_id=self.env.ref('mail.mt_note').id) return True - @api.multi - def invoice_validate(self): + def _check_invoice_reference(self): for invoice in self.filtered(lambda invoice: invoice.partner_id not in invoice.message_partner_ids): invoice.message_subscribe([invoice.partner_id.id]) @@ -927,6 +926,10 @@ class AccountInvoice(models.Model): if invoice.type in ('in_invoice', 'in_refund') and invoice.reference: if self.search([('type', '=', invoice.type), ('reference', '=', invoice.reference), ('company_id', '=', invoice.company_id.id), ('commercial_partner_id', '=', invoice.commercial_partner_id.id), ('id', '!=', invoice.id)]): raise UserError(_("Duplicated vendor reference detected. You probably encoded twice the same vendor bill/refund.")) + + @api.multi + def invoice_validate(self): + self._check_invoice_reference() return self.write({'state': 'open'}) @api.model diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 41c06eeb559..211bf774f1f 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -41,6 +41,13 @@ def migrate_tags_on_taxes(cr, registry): if len(tax_id.ids) == 1: tax_id.sudo().write({'tag_ids': [(6, 0, tax_template.tag_ids.ids)]}) +def preserve_existing_tags_on_taxes(cr, registry, module): + ''' This is a utility function used to preserve existing previous tags during upgrade of the module.''' + env = api.Environment(cr, SUPERUSER_ID, {}) + xml_records = env['ir.model.data'].search([('model', '=', 'account.account.tag'), ('module', 'like', module)]) + if xml_records: + cr.execute("update ir_model_data set noupdate = 't' where id in %s", [tuple(xml_records.ids)]) + # --------------------------------------------------------------- # Account Templates: Account, Tax, Tax Code and chart. + Wizard # --------------------------------------------------------------- diff --git a/addons/account_asset/models/account_asset.py b/addons/account_asset/models/account_asset.py index d6bc83b9087..78cd786cda8 100644 --- a/addons/account_asset/models/account_asset.py +++ b/addons/account_asset/models/account_asset.py @@ -473,6 +473,8 @@ class AccountAssetDepreciationLine(models.Model): created_moves = self.env['account.move'] prec = self.env['decimal.precision'].precision_get('Account') for line in self: + if line.move_id: + raise UserError(_('This depreciation is already linked to a journal entry! Please post or delete it.')) category_id = line.asset_id.category_id depreciation_date = self.env.context.get('depreciation_date') or line.depreciation_date or fields.Date.context_today(self) company_currency = line.asset_id.company_id.currency_id diff --git a/addons/account_asset/static/src/js/account_asset.js b/addons/account_asset/static/src/js/account_asset.js index 5fe995a98a8..9b3b4d9b3ee 100644 --- a/addons/account_asset/static/src/js/account_asset.js +++ b/addons/account_asset/static/src/js/account_asset.js @@ -25,8 +25,8 @@ var WidgetOnButton = core.list_widget_registry.get('field').extend({ } return $('<div/>').append((this.parent_state === 'open')? $('<button/>', { type: 'button', - title: (this.has_value)? _t('Posted') : _t('Unposted'), - disabled: !!this.has_value, + title: (this.is_posted)? _t('Posted') : _t('Unposted'), + disabled: row_data.move_check.value, 'class': 'btn btn-sm btn-link fa fa-circle o_widgetonbutton ' + class_color, }) : '').html(); }, diff --git a/addons/l10n_fr/__init__.py b/addons/l10n_fr/__init__.py index 4b6eae9a9e4..50d8a515f48 100644 --- a/addons/l10n_fr/__init__.py +++ b/addons/l10n_fr/__init__.py @@ -4,3 +4,8 @@ # Copyright (c) 2008 JAILLET Simon - CrysaLEAD - www.crysalead.fr import models + + +def _preserve_tag_on_taxes(cr, registry): + from odoo.addons.account.models.chart_template import preserve_existing_tags_on_taxes + preserve_existing_tags_on_taxes(cr, registry, 'l10n_fr') diff --git a/addons/l10n_fr/__manifest__.py b/addons/l10n_fr/__manifest__.py index be99c258b1d..dc0436ce456 100644 --- a/addons/l10n_fr/__manifest__.py +++ b/addons/l10n_fr/__manifest__.py @@ -39,4 +39,5 @@ configuration of their taxes and fiscal positions manually. 'data/account_reconcile_model_template.xml', 'data/account_chart_template_data.yml', ], + 'post_init_hook': '_preserve_tag_on_taxes', } diff --git a/addons/l10n_lu/__init__.py b/addons/l10n_lu/__init__.py index 67dee8c60db..4ca483f7aff 100644 --- a/addons/l10n_lu/__init__.py +++ b/addons/l10n_lu/__init__.py @@ -1,2 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. + + +def _preserve_tag_on_taxes(cr, registry): + from odoo.addons.account.models.chart_template import preserve_existing_tags_on_taxes + preserve_existing_tags_on_taxes(cr, registry, 'l10n_lu') diff --git a/addons/l10n_lu/__manifest__.py b/addons/l10n_lu/__manifest__.py index 59025f62596..6123ab2c81b 100644 --- a/addons/l10n_lu/__manifest__.py +++ b/addons/l10n_lu/__manifest__.py @@ -39,4 +39,5 @@ Notes: 'data/account.chart.template.csv', 'data/account_chart_template_data.yml', ], + 'post_init_hook': '_preserve_tag_on_taxes', } diff --git a/addons/l10n_no/__init__.py b/addons/l10n_no/__init__.py index 67dee8c60db..52c150be0f0 100644 --- a/addons/l10n_no/__init__.py +++ b/addons/l10n_no/__init__.py @@ -1,2 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. + + +def _preserve_tag_on_taxes(cr, registry): + from odoo.addons.account.models.chart_template import preserve_existing_tags_on_taxes + preserve_existing_tags_on_taxes(cr, registry, 'l10n_no') diff --git a/addons/l10n_no/__manifest__.py b/addons/l10n_no/__manifest__.py index ca292e63a93..6668e79bacb 100644 --- a/addons/l10n_no/__manifest__.py +++ b/addons/l10n_no/__manifest__.py @@ -15,4 +15,5 @@ Updated for Odoo 9 by Bringsvor Consulting AS <www.bringsvor.com> 'data/account_tax_data.xml', 'data/account_chart_template_data.yml'], "active": False, + 'post_init_hook': '_preserve_tag_on_taxes', } diff --git a/addons/l10n_pl/__init__.py b/addons/l10n_pl/__init__.py index 67dee8c60db..6575c176947 100644 --- a/addons/l10n_pl/__init__.py +++ b/addons/l10n_pl/__init__.py @@ -1,2 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. + + +def _preserve_tag_on_taxes(cr, registry): + from odoo.addons.account.models.chart_template import preserve_existing_tags_on_taxes + preserve_existing_tags_on_taxes(cr, registry, 'l10n_pl') diff --git a/addons/l10n_pl/__manifest__.py b/addons/l10n_pl/__manifest__.py index 8416f87a235..02253500138 100644 --- a/addons/l10n_pl/__manifest__.py +++ b/addons/l10n_pl/__manifest__.py @@ -28,4 +28,5 @@ Wewnętrzny numer wersji OpenGLOBE 1.02 'data/res_country_state_data.xml', 'data/account_chart_template_data.yml' ], + 'post_init_hook': '_preserve_tag_on_taxes', } diff --git a/addons/l10n_sg/__init__.py b/addons/l10n_sg/__init__.py index b286495ed4a..e2f7da260d0 100644 --- a/addons/l10n_sg/__init__.py +++ b/addons/l10n_sg/__init__.py @@ -2,3 +2,8 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. # Copyright (C) 2014 Tech Receptives (<http://techreceptives.com>). + + +def _preserve_tag_on_taxes(cr, registry): + from odoo.addons.account.models.chart_template import preserve_existing_tags_on_taxes + preserve_existing_tags_on_taxes(cr, registry, 'l10n_sg') diff --git a/addons/l10n_sg/__manifest__.py b/addons/l10n_sg/__manifest__.py index 4dea21b3665..d692dc6536d 100644 --- a/addons/l10n_sg/__manifest__.py +++ b/addons/l10n_sg/__manifest__.py @@ -32,4 +32,5 @@ After installing this module, the Configuration wizard for accounting is launche 'data/account_tax_data.xml', 'data/account_chart_template_data.yml', ], + 'post_init_hook': '_preserve_tag_on_taxes', } diff --git a/addons/l10n_th/__init__.py b/addons/l10n_th/__init__.py index 67dee8c60db..1b8d7518cd3 100644 --- a/addons/l10n_th/__init__.py +++ b/addons/l10n_th/__init__.py @@ -1,2 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. + + +def _preserve_tag_on_taxes(cr, registry): + from odoo.addons.account.models.chart_template import preserve_existing_tags_on_taxes + preserve_existing_tags_on_taxes(cr, registry, 'l10n_th') diff --git a/addons/l10n_th/__manifest__.py b/addons/l10n_th/__manifest__.py index e2b62ee77e8..2f1d26a4a49 100644 --- a/addons/l10n_th/__manifest__.py +++ b/addons/l10n_th/__manifest__.py @@ -18,4 +18,5 @@ Thai accounting chart and localization. 'data/l10n_th_chart_data.xml', 'data/account_chart_template_data.yml', ], + 'post_init_hook': '_preserve_tag_on_taxes', } diff --git a/addons/l10n_vn/__init__.py b/addons/l10n_vn/__init__.py index 34293fdfe8d..490754ae534 100644 --- a/addons/l10n_vn/__init__.py +++ b/addons/l10n_vn/__init__.py @@ -2,3 +2,8 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. # This module is Copyright (c) 2009-2013 General Solutions (http://gscom.vn) All Rights Reserved. + + +def _preserve_tag_on_taxes(cr, registry): + from odoo.addons.account.models.chart_template import preserve_existing_tags_on_taxes + preserve_existing_tags_on_taxes(cr, registry, 'l10n_vn') diff --git a/addons/l10n_vn/__manifest__.py b/addons/l10n_vn/__manifest__.py index ba785e72388..1f318b54b8a 100644 --- a/addons/l10n_vn/__manifest__.py +++ b/addons/l10n_vn/__manifest__.py @@ -28,5 +28,6 @@ with Chart of account under Circular No. 200/2014/TT-BTC 'data/l10n_vn_chart_data.xml', 'data/account_tax_data.xml', 'data/account_chart_template_data.yml', - ] + ], + 'post_init_hook': '_preserve_tag_on_taxes', } diff --git a/addons/mrp/report/mrp_production_templates.xml b/addons/mrp/report/mrp_production_templates.xml index 483ef283194..d8a90b371ac 100644 --- a/addons/mrp/report/mrp_production_templates.xml +++ b/addons/mrp/report/mrp_production_templates.xml @@ -23,8 +23,7 @@ </div> <div class="col-xs-3"> <strong>Product:</strong><br/> - <span t-field="o.product_id.code"/> - <span t-field="o.product_id.name"/> + <span t-field="o.product_id"/> </div> <div class="col-xs-3"> <strong>Quantity:</strong><br/> diff --git a/addons/point_of_sale/static/src/js/db.js b/addons/point_of_sale/static/src/js/db.js index ccdd0fb6616..b70b3517bf2 100644 --- a/addons/point_of_sale/static/src/js/db.js +++ b/addons/point_of_sale/static/src/js/db.js @@ -235,10 +235,12 @@ var PosDB = core.Class.extend({ for(var i = 0, len = partners.length; i < len; i++){ partner = partners[i]; - if ( this.partner_write_date && + var local_partner_date = (this.partner_write_date || '').replace(/^(\d{4}-\d{2}-\d{2}) ((\d{2}:?){3})$/, '$1T$2Z'); + var dist_partner_date = (partner.write_date || '').replace(/^(\d{4}-\d{2}-\d{2}) ((\d{2}:?){3})$/, '$1T$2Z'); + if ( this.partner_write_date && this.partner_by_id[partner.id] && - new Date(this.partner_write_date).getTime() + 1000 >= - new Date(partner.write_date).getTime() ) { + new Date(local_partner_date).getTime() + 1000 >= + new Date(dist_partner_date).getTime() ) { // FIXME: The write_date is stored with milisec precision in the database // but the dates we get back are only precise to the second. This means when // you read partners modified strictly after time X, you get back partners that were diff --git a/addons/product/models/product.py b/addons/product/models/product.py index 0d146fcd4e0..60d69a8c927 100644 --- a/addons/product/models/product.py +++ b/addons/product/models/product.py @@ -566,7 +566,7 @@ class ProductProduct(models.Model): history = self.env['product.price.history'].search([ ('company_id', '=', company_id), ('product_id', 'in', self.ids), - ('datetime', '<=', date or fields.Datetime.now())], limit=1) + ('datetime', '<=', date or fields.Datetime.now())], order='datetime desc,id desc', limit=1) return history.cost or 0.0 def _need_procurement(self): diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index 281b9213320..d2e89c59238 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -890,7 +890,7 @@ class ProcurementOrder(models.Model): date=procurement.purchase_line_id.order_id.date_order and procurement.purchase_line_id.order_id.date_order[:10], uom_id=procurement.purchase_line_id.product_uom) - price_unit = self.env['account.tax']._fix_tax_included_price_company(seller.price, procurement.purchase_line_id.product_id.supplier_taxes_id, procurement.purchase_line_id.taxes_id, self.company_id) if seller else 0.0 + price_unit = self.env['account.tax']._fix_tax_included_price_company(seller.price, procurement.purchase_line_id.product_id.supplier_taxes_id, procurement.purchase_line_id.taxes_id, procurement.company_id) if seller else 0.0 if price_unit and seller and procurement.purchase_line_id.order_id.currency_id and seller.currency_id != procurement.purchase_line_id.order_id.currency_id: price_unit = seller.currency_id.compute(price_unit, procurement.purchase_line_id.order_id.currency_id) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 8fece8eb81f..1907c5f1c16 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -700,7 +700,7 @@ class SaleOrderLine(models.Model): def create(self, values): values.update(self._prepare_add_missing_fields(values)) line = super(SaleOrderLine, self).create(values) - if line.state == 'sale': + if line.order_id.state == 'sale': line._action_procurement_create() msg = _("Extra line with %s ") % (line.product_id.display_name,) line.order_id.message_post(body=msg) diff --git a/addons/website_event/views/website_event_templates.xml b/addons/website_event/views/website_event_templates.xml index 80738d60c30..0b5f8122cd9 100644 --- a/addons/website_event/views/website_event_templates.xml +++ b/addons/website_event/views/website_event_templates.xml @@ -241,6 +241,7 @@ <template id="template_location"> <t t-call="website_event.layout"> + <div class="oe_structure"/> <section class="container"> <h1 class="text-center">Event Location</h1> </section> @@ -249,6 +250,7 @@ "widget": "contact", "fields": ["name", "address", "phone", "mobile", "fax"] }'/> + <div class="oe_structure"/> </t> </template> diff --git a/addons/website_event_track/views/website_event_track_templates.xml b/addons/website_event_track/views/website_event_track_templates.xml index 42abb8b1b40..2e289cc92c7 100644 --- a/addons/website_event_track/views/website_event_track_templates.xml +++ b/addons/website_event_track/views/website_event_track_templates.xml @@ -42,6 +42,7 @@ <template id="agenda"> <t t-call="website_event.layout"> + <div class="oe_structure"/> <section class="container"> <h1 class="text-center" t-field="event.name"/> <div class="form-inline pull-right"> @@ -104,12 +105,14 @@ </tr> </table> </section> + <div class="oe_structure"/> </t> </template> <template id="tracks"> <t t-call="website_event.event_details"> + <div class="oe_structure"/> <div id="left_column"> </div> <div class="col-md-9"> @@ -148,6 +151,7 @@ </div> </div> </div> + <div class="oe_structure"/> </t> </template> diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py index 4055e5dd9fe..a8d728396d2 100644 --- a/addons/website_sale/models/sale_order.py +++ b/addons/website_sale/models/sale_order.py @@ -245,12 +245,13 @@ class Website(models.Model): :param bool show_visible: if True, we don't display pricelist where selectable is False (Eg: Code promo) :returns: pricelist recordset """ - website = request and request.website or None + website = request and hasattr(request, 'website') and request.website or None if not website: if self.env.context.get('website_id'): website = self.browse(self.env.context['website_id']) else: - website = self.search([], limit=1) + # In the weird case we are coming from the backend (https://github.com/odoo/odoo/issues/20245) + website = len(self) == 1 and self or self.search([], limit=1) isocountry = request and request.session.geoip and request.session.geoip.get('country_code') or False partner = self.env.user.partner_id order_pl = partner.last_website_so_id and partner.last_website_so_id.state == 'draft' and partner.last_website_so_id.pricelist_id diff --git a/addons/website_slides/view/website_slides_embed.xml b/addons/website_slides/view/website_slides_embed.xml index c3c77fc676d..72614803325 100644 --- a/addons/website_slides/view/website_slides_embed.xml +++ b/addons/website_slides/view/website_slides_embed.xml @@ -59,7 +59,7 @@ <!-- PDF Viewer Body : contains the canvas, the loader, or the image--> <div id="PDFSlideViewer" style="position:relative;" t-attf-data-slideid="#{slide.id}" - t-attf-data-slideurl="/slides/slide/#{slide.id}/pdf_content" + t-attf-data-slideurl="/slides/slide/#{slug(slide)}/pdf_content" t-attf-data-downloadable="#{slide.download_security}" t-att-data-defaultpage="page"> <t t-if="is_embedded"> @@ -133,7 +133,7 @@ <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 text-center"></div> </div> <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pull-right text-right"> - <a t-if="slide.download_security and not is_embedded" target="_top" t-attf-href="/slides/slide/#{slide.id}/download" title="Download" id="download"> + <a t-if="slide.download_security and not is_embedded" target="_top" t-attf-href="/slides/slide/#{slug(slide)}/download" title="Download" id="download"> <i class="fa fa-download fa-2x"></i> </a> <span id="fullscreen" title="View fullscreen"> diff --git a/doc/reference/views.rst b/doc/reference/views.rst index 5d760b611be..35c4a13dee6 100644 --- a/doc/reference/views.rst +++ b/doc/reference/views.rst @@ -277,7 +277,7 @@ Possible children elements of the list view are: filled, and a cross if it is not ``handle`` for ``sequence`` fields, instead of displaying the field's value - just displays a dra&drop icon + just displays a drag&drop icon ``sum``, ``avg`` displays the corresponding aggregate at the bottom of the column. The aggregation is only computed on *currently displayed* records. The @@ -1153,7 +1153,7 @@ Possible children elements of the search view are: fields don't generate domains. .. note:: the domain and context are inclusive and both are generated - if if a ``context`` is specified. To only generate context + if a ``context`` is specified. To only generate context values, set ``filter_domain`` to an empty list: ``filter_domain="[]"`` ``groups`` diff --git a/odoo/addons/base/module/module.py b/odoo/addons/base/module/module.py index 873e012362e..3e2eb4749cb 100644 --- a/odoo/addons/base/module/module.py +++ b/odoo/addons/base/module/module.py @@ -26,6 +26,7 @@ import odoo from odoo import api, fields, models, modules, tools, _ from odoo.exceptions import AccessDenied, UserError from odoo.tools.parse_version import parse_version +from odoo.tools.misc import topological_sort _logger = logging.getLogger(__name__) @@ -763,7 +764,13 @@ class Module(models.Model): filter_lang = [lang.code for lang in langs] elif not isinstance(filter_lang, (list, tuple)): filter_lang = [filter_lang] - mod_names = [mod.name for mod in self if mod.state in ('installed', 'to install', 'to upgrade')] + + update_mods = self.filtered(lambda r: r.state in ('installed', 'to install', 'to upgrade')) + mod_dict = { + mod.name: mod.dependencies_id.mapped('name') + for mod in update_mods + } + mod_names = topological_sort(mod_dict) self.env['ir.translation'].load_module_terms(mod_names, filter_lang) @api.multi diff --git a/odoo/addons/test_impex/tests/test_export.py b/odoo/addons/test_impex/tests/test_export.py index 226ba9943f6..861e7dd1661 100644 --- a/odoo/addons/test_impex/tests/test_export.py +++ b/odoo/addons/test_impex/tests/test_export.py @@ -304,13 +304,12 @@ class test_m2o(CreatorCase): [[False]]) def test_basic(self): - """ Exported value is the name_get of the related object + """ Exported value is empty """ record = self.env['export.integer'].create({'value': 42}) - name = dict(record.name_get())[record.id] self.assertEqual( self.export(record.id), - [[name]]) + [['']]) def test_path(self): """ Can recursively export fields of m2o via path @@ -352,14 +351,13 @@ class test_o2m(CreatorCase): def test_single(self): self.assertEqual( self.export([(0, False, {'value': 42})]), - # name_get result - [[u'export.one2many.child:42']]) + [['']]) def test_single_subfield(self): self.assertEqual( self.export([(0, False, {'value': 42})], fields=['value', 'value/value']), - [[u'export.one2many.child:42', u'42']]) + [['', u'42']]) def test_integrate_one_in_parent(self): self.assertEqual( @@ -381,9 +379,13 @@ class test_o2m(CreatorCase): def test_multiple_records_name(self): self.assertEqual( self.export(self.commands, fields=['const', 'value']), - [[ - u'4', u','.join(self.names) - ]]) + [ + [u'4', ''], + ['', ''], + ['', ''], + ['', ''], + ['', ''], + ]) def test_multiple_records_id(self): export = self.export(self.commands, fields=['const', 'value/.id']) @@ -401,14 +403,18 @@ class test_o2m(CreatorCase): def test_multiple_records_with_name_before(self): self.assertEqual( self.export(self.commands, fields=['const', 'value', 'value/value']), - [[ # exports sub-fields of very first o2m - u'4', u','.join(self.names), u'4' - ]]) + [ + [u'4', '', u'4'], + ['', '', u'42'], + ['', '', u'36'], + ['', '', u'4'], + ['', '', u'13'], + ]) def test_multiple_records_with_name_after(self): self.assertEqual( self.export(self.commands, fields=['const', 'value/value', 'value']), - [ # completely ignores name_get request + [ [u'4', u'4', ''], ['', u'42', ''], ['', u'36', ''], @@ -459,16 +465,16 @@ class test_o2m_multiple(CreatorCase): def test_single_per_side(self): self.assertEqual( self.export(child1=False, child2=[(0, False, {'value': 42})]), - [[False, u'export.one2many.child.2:42']]) + [[False, '']]) self.assertEqual( self.export(child1=[(0, False, {'value': 43})], child2=False), - [[u'export.one2many.child.1:43', False]]) + [['', False]]) self.assertEqual( self.export(child1=[(0, False, {'value': 43})], child2=[(0, False, {'value': 42})]), - [[u'export.one2many.child.1:43', u'export.one2many.child.2:42']]) + [['', '']]) def test_single_integrate_subfield(self): fields = ['const', 'child1/value', 'child2/value'] @@ -555,14 +561,13 @@ class test_m2m(CreatorCase): def test_single(self): self.assertEqual( self.export([(0, False, {'value': 42})]), - # name_get result - [[u'export.many2many.other:42']]) + [['']]) def test_single_subfield(self): self.assertEqual( self.export([(0, False, {'value': 42})], fields=['value', 'value/value']), - [[u'export.many2many.other:42', u'42']]) + [['', u'42']]) def test_integrate_one_in_parent(self): self.assertEqual( @@ -584,10 +589,13 @@ class test_m2m(CreatorCase): def test_multiple_records_name(self): self.assertEqual( self.export(self.commands, fields=['const', 'value']), - [[ # FIXME: hardcoded comma, import uses config.csv_internal_sep - # resolution: remove configurable csv_internal_sep - u'4', u','.join(self.names) - ]]) + [ + [u'4', ''], + ['', ''], + ['', ''], + ['', ''], + ['', ''], + ]) # essentially same as o2m, so boring diff --git a/odoo/models.py b/odoo/models.py index b46e3e255f4..1796f74725e 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -805,14 +805,8 @@ class BaseModel(object): for j, val in enumerate(lines2[0]): if val or isinstance(val, bool): current[j] = val - # check value of current field - if not current[i] and not isinstance(current[i], bool): - # assign xml_ids, and forget about remaining lines - xml_ids = [item[1] for item in value.name_get()] - current[i] = ','.join(xml_ids) - else: - # append the other lines at the end - lines += lines2[1:] + # append the other lines at the end + lines += lines2[1:] else: current[i] = False |
