Skip to Content
Odoo Меню
  • Увійти
  • Спробуйте це безкоштовно
  • Додатки
    Фінанси
    • Бухоблік
    • Виставлення рахунку
    • Витрати
    • Електронні таблиці (BI)
    • Документи
    • Підпис
    Продажі
    • CRM
    • Продажі
    • POS Магазин
    • POS Ресторан
    • Підписки
    • Оренда
    Веб-сайти
    • Конструктор веб-сайту
    • Електронна комерція
    • Блог
    • Форум
    • Живий чат
    • Електронне навчання
    Ланцюг поставок
    • Склад
    • Виробництво
    • PLM
    • Купівлі
    • Технічне обслуговування
    • Якість
    Кадри
    • Співробітники
    • Рекрутинг
    • Відпустки
    • Оцінювання
    • Рекомендації
    • Автотранспорт
    Маркетинг
    • Маркетинг соцмереж
    • Email-маркетинг
    • SMS-маркетинг
    • Події
    • Автом. маркетингу
    • Опитування
    Послуги
    • Проект
    • Табелі
    • Виїзне обслуговування
    • Служба підтримки
    • Планування
    • Призначення
    Продуктивність
    • Обговорення
    • Схвалення
    • IoT
    • IP-телефонія
    • База знань
    • WhatsApp
    Сторонні модулі Odoo Studio Платформа Odoo Cloud
  • Сфери
    Роздрібна торгівля
    • Книжковий магазин
    • Магазин одягу
    • Магазин меблів
    • Продуктовий магазин
    • Магазин будівельних матеріалів
    • Магазин іграшок
    Food & Hospitality
    • Бар та паб
    • Ресторан
    • Фастфуд
    • Guest House
    • Дистриб'ютор напоїв
    • Hotel
    Нерухомість
    • Real Estate Agency
    • Архітектурна фірма
    • Будівництво
    • Управління нерухомістю
    • Садівництво
    • Асоціація власників нерухомості
    Консалтинг
    • Бухгалтерська компанія
    • Партнер Odoo
    • Агенція маркетингу
    • Юридична фірма
    • Придбання Талантів
    • Аудит та сертифікація
    Виробництво
    • Textile
    • Metal
    • Меблі
    • Їжа
    • Brewery
    • Корпоративні подарунки
    Здоров'я & Фітнес
    • Спортивний клуб
    • Оптика
    • Фітнес-центр
    • Практики здоров'я
    • Аптека
    • Салон краси
    Trades
    • Ремонтник
    • IT-обладнання та Підтримка
    • Системи сонячної енергії
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Інші
    • Nonprofit Organization
    • Екологічна агенція
    • Оренда білбордів
    • Фотографія
    • Лізинг велосипедів
    • Реселлер програмного забезпечення
    Browse all Industries
  • Спільнота
    Навчання
    • Навчальний посібник
    • Документація
    • Сертифікації
    • Тренування
    • Блог
    • Подкаст
    Сприяйте Освіті
    • Програма навчання
    • Бізнес гра Scale Up!
    • Відвідайте Odoo
    Отримайте програмне забезпечення
    • Завантаження
    • Порівняйте версії
    • Релізи
    Співпрацюйте
    • Github
    • Форум
    • Події
    • Переклади
    • Стати партнером
    • Services for Partners
    • Зареєструйте вашу бухгалтерську фірму
    Отримайте послуги
    • Знайдіть партнера
    • Знайдіть бухгалтера
    • Зустріньтеся з консультантом
    • Послуги з впровадження
    • Референси клієнтів
    • Підтримка
    • Оновлення
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Отримати демо
  • Ціни
  • Допомога

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Бухоблік
  • Склад
  • PoS
  • Проект
  • MRP
All apps
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Допомога

AssertionError: Element openerp has extra content: data, line 3

Підписатися

Отримуйте сповіщення про активність щодо цієї публікації

Це запитання позначене
productetreeconvertproduct.productassertionerror
3 Відповіді
10683 Переглядів
Аватар
Seguridad y Halogenados

I get the following error while trying to install product_price_currency addon module on odoo 9.0, what should I do to fix this?


Odoo Server Error

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 605, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 642, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 316, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 309, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 893, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 471, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 896, in call_button
    action = self._call_kw(model, method, args, {})
  File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 884, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper
    return old_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/addons/base/module/module.py", line 459, in button_immediate_install
    return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper
    return old_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/addons/base/module/module.py", line 533, in _button_immediate_function
    registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 385, in new
    openerp.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 338, in load_modules
    loaded_modules, update_module)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 237, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 156, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='data')
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 98, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 852, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
  File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 926, in convert_xml_import
    relaxng.assert_(doc)
  File "lxml.etree.pyx", line 3373, in lxml.etree._Validator.assert_ (src/lxml/lxml.etree.c:166758)
AssertionError: Element openerp has extra content: data, line 3



0
Аватар
Відмінити
Jignesh Mehta

If product_price_currency is custom module then post your code here which is in xml file.

Seguridad y Halogenados
Автор

Hello Jignesh, thanks for your reply, I will explain myself more, I need to use a module developed by Adhoc and can be found in apps store, is called product_price_currency, for odoo 8 it works great, for odoo 9 it doesn´t works When I installed it I got the following error: Odoo Server Error Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 605, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 642, in dispatch result = self._call_function(**self.params) File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 316, in _call_function return checked_call(self.db, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 118, in wrapper return f(dbname, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 309, in checked_call result = self.endpoint(*a, **kw) File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 893, in __call__ return self.method(*args, **kw) File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 471, in response_wrap response = f(*args, **kw) File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 896, in call_button action = self._call_kw(model, method, args, {}) File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 884, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper return old_api(self, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/addons/base/module/module.py", line 459, in button_immediate_install return self._button_immediate_function(cr, uid, ids, self.button_install, context=context) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper return old_api(self, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/addons/base/module/module.py", line 533, in _button_immediate_function registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True) File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 385, in new openerp.modules.load_modules(registry._db, force_demo, status, update_module) File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 338, in load_modules loaded_modules, update_module) File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 237, in load_marked_modules loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks) File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 156, in load_module_graph _load_data(cr, module_name, idref, mode, kind='data') File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 98, in _load_data tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report) File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 852, in convert_file convert_xml_import(cr, module, fp, idref, mode, noupdate, report) File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 939, in convert_xml_import obj.parse(doc.getroot(), mode=mode) File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 802, in parse self.parse(rec, mode) File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 805, in parse self._tags[rec.tag](self.cr, rec, de, mode=mode) File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 709, in _tag_record id = self.pool['ir.model.data']._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context ) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper return old_api(self, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/addons/base/ir/ir_model.py", line 1101, in _update res_id = model_obj.create(cr, uid, values, context=context) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper return old_api(self, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/addons/base/ir/ir_ui_view.py", line 351, in create context=context) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper return old_api(self, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 342, in old_api result = method(recs, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 4132, in create record = self.browse(self._create(old_vals)) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper return new_api(self, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 478, in new_api result = method(self._model, cr, uid, *args, **old_kwargs) File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 4323, in _create recs._validate_fields(vals) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper return new_api(self, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 1272, in _validate_fields raise ValidationError('\n'.join(errors)) ParseError: "Invalid view definition Error details: Element '' cannot be located in parent view Error context: View `product_price_currency.search` [view_id: 509, xml_id: n/a, model: product.template, parent_id: 284] None" while parsing /usr/lib/python2.7/dist-packages/openerp/addons/product_price_currency/product_view.xml:62, near product_price_currency.search product.template So first I focused on the following: Element '' cannot be located in parent view parent view is: product.product_template_search_view in Odoo 8 id does include in Odoo 9 it does not, original: Edited (added ): Then I got the following error: Odoo Server Error Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 605, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 642, in dispatch result = self._call_function(**self.params) File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 316, in _call_function return checked_call(self.db, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 118, in wrapper return f(dbname, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 309, in checked_call result = self.endpoint(*a, **kw) File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 893, in __call__ return self.method(*args, **kw) File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 471, in response_wrap response = f(*args, **kw) File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 892, in call_kw return self._call_kw(model, method, args, kwargs) File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 884, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper return old_api(self, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 342, in old_api result = method(recs, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 1327, in default_get defaults[name] = field.default(self) File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper return new_api(self, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/openerp/addons/product_price_currency/product.py", line 15, in get_currency_id price_type_obj = self.env['product.price.type'] File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 746, in __getitem__ return self.registry[model_name]._browse(self, ()) File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 84, in __getitem__ return self.models[model_name] KeyError: 'product.price.type' It turns out that model product.price.type does not exists in odoo 9 Inside the product_price_currency module: product_view.xml product_price_currency.form product.product product_price_currency.tree product.product product_price_currency.kanban product.product

  • product_price_currency.kanban product.template
  • Pricelist Price:
  • product_price_currency.form product.template product_price_currency.search product.template product.template.product.tree product.template product.py # -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in module root # directory ############################################################################## from openerp import fields, models, api import openerp.addons.decimal_precision as dp class product_template(models.Model): _inherit = 'product.template' @api.model def get_currency_id(self): price_type_obj = self.env['product.price.type'] price_type_ids = price_type_obj.search([('field', '=', 'list_price')]) if not price_type_ids.currency_id: return self.env.user.company_id.currency_id return price_type_ids.currency_id sale_price_currency_id = fields.Many2one( 'res.currency', 'Sale Price Currency', required=True, default=get_currency_id, help="Currency used for the Currency List Price." ) cia_currency_list_price = fields.Float( 'Company Currency Sale Price', digits=dp.get_precision('Product Price'), compute='get_cia_currency_list_price', help="Base price on company currency at actual exchange rate", ) @api.multi @api.depends('list_price', 'sale_price_currency_id') def get_cia_currency_list_price(self): company_currency = self.env.user.company_id.currency_id for product in self: if ( product.sale_price_currency_id and product.sale_price_currency_id != company_currency ): cia_currency_list_price = ( product.sale_price_currency_id.compute( product.list_price, company_currency)) else: cia_currency_list_price = product.list_price product.cia_currency_list_price = cia_currency_list_price def _price_get(self, cr, uid, products, ptype='list_price', context=None): if not context: context = {} res = super(product_template, self)._price_get( cr, uid, products, ptype=ptype, context=context) if ptype == 'list_price': pricetype_obj = self.pool.get('product.price.type') price_type_id = pricetype_obj.search( cr, uid, [('field', '=', ptype)])[0] price_type_currency_id = pricetype_obj.browse( cr, uid, price_type_id).currency_id.id for product in products: if product.sale_price_currency_id.id != price_type_currency_id: res[product.id] = self.pool.get('res.currency').compute( cr, uid, product.sale_price_currency_id.id, price_type_currency_id, res[product.id], context=context) return res
    Аватар
    Seguridad y Halogenados
    Автор Найкраща відповідь

    the code again with spaces:


    Odoo Server Error

    Traceback (most recent call last):

    File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 605, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

    File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 642, in dispatch

    result = self._call_function(**self.params)

    File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 316, in _call_function

    return checked_call(self.db, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 118, in wrapper

    return f(dbname, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 309, in checked_call

    result = self.endpoint(*a, **kw)

    File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 893, in __call__

    return self.method(*args, **kw)

    File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 471, in response_wrap

    response = f(*args, **kw)

    File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 896, in call_button

    action = self._call_kw(model, method, args, {})

    File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 884, in _call_kw

    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper

    return old_api(self, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/addons/base/module/module.py", line 459, in button_immediate_install

    return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)

    File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper

    return old_api(self, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/addons/base/module/module.py", line 533, in _button_immediate_function

    registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)

    File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 385, in new

    openerp.modules.load_modules(registry._db, force_demo, status, update_module)

    File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 338, in load_modules

    loaded_modules, update_module)

    File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 237, in load_marked_modules

    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)

    File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 156, in load_module_graph

    _load_data(cr, module_name, idref, mode, kind='data')

    File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 98, in _load_data

    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)

    File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 852, in convert_file

    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)

    File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 939, in convert_xml_import

    obj.parse(doc.getroot(), mode=mode)

    File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 802, in parse

    self.parse(rec, mode)

    File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 805, in parse

    self._tags[rec.tag](self.cr, rec, de, mode=mode)

    File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 709, in _tag_record

    id = self.pool['ir.model.data']._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )

    File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper

    return old_api(self, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/addons/base/ir/ir_model.py", line 1101, in _update

    res_id = model_obj.create(cr, uid, values, context=context)

    File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper

    return old_api(self, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/addons/base/ir/ir_ui_view.py", line 351, in create

    context=context)

    File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper

    return old_api(self, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 342, in old_api

    result = method(recs, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 4132, in create

    record = self.browse(self._create(old_vals))

    File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper

    return new_api(self, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 478, in new_api

    result = method(self._model, cr, uid, *args, **old_kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 4323, in _create

    recs._validate_fields(vals)

    File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper

    return new_api(self, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 1272, in _validate_fields

    raise ValidationError('\n'.join(errors))

    ParseError: "Invalid view definition

    Error details:

    Element '<field name="company_id">' cannot be located in parent view

    Error context:

    View `product_price_currency.search`

    [view_id: 509, xml_id: n/a, model: product.template, parent_id: 284]

    None" while parsing /usr/lib/python2.7/dist-packages/openerp/addons/product_price_currency/product_view.xml:62, near

    <record id="product_template_search_view" model="ir.ui.view">

    <field name="name">product_price_currency.search</field>

    <field name="model">product.template</field>

    <field name="inherit_id" ref="product.product_template_search_view"/>

    <field name="arch" type="xml">

    <field name="company_id" position="after">

    <field name="sale_price_currency_id"/>

    </field>

    </field>

    </record>



    So first I focused on the following:

    Element '<field name="company_id">' cannot be located in parent view

    parent view is: product.product_template_search_view in Odoo 8 id does include <field name="company_id"/>

    in Odoo 9 it does not, original:

    <?xml version="1.0"?>

    <search string="Product">

    <field name="name" string="Product" filter_domain="['|',('default_code','ilike',self),('name','ilike',self)]"/>

    <separator/>

    <filter string="Services" name="services" domain="[('type','=','service')]"/>

    <filter string="Products" name="consumable" domain="[('type','=','consu')]" help="Products your store in the inventory"/>

    <separator/>

    <filter string="Can be Sold" name="filter_to_sell" domain="[('sale_ok','=',1)]"/>

    <separator/>

    <filter string="Archived" name="inactive" domain="[('active','=',False)]"/>

    <field string="Attributes" name="attribute_line_ids"/>

    <field name="pricelist_id" widget="selection" context="{'pricelist': self}" filter_domain="[]" groups="product.group_sale_pricelist"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->

    </search>

    Edited (added <field name="company_id"/> ):

    <?xml version="1.0"?>

    <search string="Product">

    <field name="name" string="Product" filter_domain="['|',('default_code','ilike',self),('name','ilike',self)]"/>

    <separator/>

    <filter string="Services" name="services" domain="[('type','=','service')]"/>

    <filter string="Products" name="consumable" domain="[('type','=','consu')]" help="Products your store in the inventory"/>

    <field name="company_id"/>

    <separator/>

    <filter string="Can be Sold" name="filter_to_sell" domain="[('sale_ok','=',1)]"/>

    <separator/>

    <filter string="Archived" name="inactive" domain="[('active','=',False)]"/>

    <field string="Attributes" name="attribute_line_ids"/>

    <field name="pricelist_id" widget="selection" context="{'pricelist': self}" filter_domain="[]" groups="product.group_sale_pricelist"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->

    </search>

    Then I got the following error:

    Odoo Server Error

    Traceback (most recent call last):

    File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 605, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

    File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 642, in dispatch

    result = self._call_function(**self.params)

    File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 316, in _call_function

    return checked_call(self.db, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 118, in wrapper

    return f(dbname, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 309, in checked_call

    result = self.endpoint(*a, **kw)

    File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 893, in __call__

    return self.method(*args, **kw)

    File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 471, in response_wrap

    response = f(*args, **kw)

    File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 892, in call_kw

    return self._call_kw(model, method, args, kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 884, in _call_kw

    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper

    return old_api(self, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 342, in old_api

    result = method(recs, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 1327, in default_get

    defaults[name] = field.default(self)

    File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper

    return new_api(self, *args, **kwargs)

    File "/usr/lib/python2.7/dist-packages/openerp/addons/product_price_currency/product.py", line 15, in get_currency_id

    price_type_obj = self.env['product.price.type']

    File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 746, in __getitem__

    return self.registry[model_name]._browse(self, ())

    File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 84, in __getitem__

    return self.models[model_name]

    KeyError: 'product.price.type'



    It turns out that model product.price.type does not exists in odoo 9




    Inside the product_price_currency module:


     this is the product_view.xml file


    <?xml version="1.0" encoding="UTF-8"?>

    <openerp>

    <data>

    <!-- Product Product Views -->

    <record id="product_normal_form_view" model="ir.ui.view">

    <field name="name">product_price_currency.form</field>

    <field name="model">product.product</field>

    <field name="inherit_id" ref="product.product_normal_form_view" />

    <field name="arch" type="xml">

    <field name="lst_price" position="after">

    <field name="sale_price_currency_id"/>

    </field>

    </field>

    </record>

    <record id="product_price_currency_tree_view" model="ir.ui.view">

    <field name="name">product_price_currency.tree</field>

    <field name="model">product.product</field>

    <field name="inherit_id" ref="product.product_product_tree_view" />

    <field name="arch" type="xml">

    <field name="lst_price" position="after">

    <field name="sale_price_currency_id" />

    </field>

    </field>

    </record>

    <record id="product_kanban_view" model="ir.ui.view">

    <field name="name">product_price_currency.kanban</field>

    <field name="model">product.product</field>

    <field name="inherit_id" ref="product.product_kanban_view" />

    <field name="arch" type="xml">

    <li position="inside">

    <field name="sale_price_currency_id"/>

    </li>

    </field>

    </record>

    <!-- Product Template Views -->

    <record id="product_template_kanban_view" model="ir.ui.view">

    <field name="name">product_price_currency.kanban</field>

    <field name="model">product.template</field>

    <field name="inherit_id" ref="product.product_template_kanban_view" />

    <field name="arch" type="xml">

    <li position="inside">

    <field name="sale_price_currency_id"/>

    </li>

    <li>

    <!-- <li invisible="not context.get('pricelist',False)"> -->

    <li>Pricelist Price: <field name="price"></field></li>

    </li>

    </field>

    </record>

    <record id="product_template_only_form_view" model="ir.ui.view">

    <field name="name">product_price_currency.form</field>

    <field name="model">product.template</field>

    <field name="inherit_id" ref="product.product_template_only_form_view" />

    <field name="arch" type="xml">

    <field name="list_price" position="after">

    <field name="sale_price_currency_id"/>

    <field name="cia_currency_list_price"/>

    </field>

    </field>

    </record>

    <record id="product_template_search_view" model="ir.ui.view">

    <field name="name">product_price_currency.search</field>

    <field name="model">product.template</field>

    <field name="inherit_id" ref="product.product_template_search_view" />

    <field name="arch" type="xml">

    <field name="company_id" position="after">

    <field name="sale_price_currency_id"/>

    </field>

    </field>

    </record>

    <record id="product_template_tree_view" model="ir.ui.view">

    <field name="name">product.template.product.tree</field>

    <field name="model">product.template</field>

    <field name="inherit_id" ref="product.product_template_tree_view" />

    <field name="arch" type="xml">

    <tree>

    <field name="lst_price"/>

    <field name="sale_price_currency_id" string="Currency"/>

    <field name="price" string="Pricelist Price" invisible="not context.get('pricelist',False)"/>

    </tree>

    </field>

    </record>

    </data>

    </openerp>



    this is product.py file



    # -*- coding: utf-8 -*-

    ##############################################################################

    # For copyright and license notices, see __openerp__.py file in module root

    # directory

    ##############################################################################

    from openerp import fields, models, api

    import openerp.addons.decimal_precision as dp

    class product_template(models.Model):

    _inherit = 'product.template'

    @api.model

    def get_currency_id(self):

    price_type_obj = self.env['product.price.type']

    price_type_ids = price_type_obj.search([('field', '=', 'list_price')])

    if not price_type_ids.currency_id:

    return self.env.user.company_id.currency_id

    return price_type_ids.currency_id

    sale_price_currency_id = fields.Many2one(

    'res.currency', 'Sale Price Currency',

    required=True, default=get_currency_id,

    help="Currency used for the Currency List Price."

    )

    cia_currency_list_price = fields.Float(

    'Company Currency Sale Price',

    digits=dp.get_precision('Product Price'),

    compute='get_cia_currency_list_price',

    help="Base price on company currency at actual exchange rate",

    )

    @api.multi

    @api.depends('list_price', 'sale_price_currency_id')

    def get_cia_currency_list_price(self):

    company_currency = self.env.user.company_id.currency_id

    for product in self:

    if (

    product.sale_price_currency_id and

    product.sale_price_currency_id != company_currency

    ):

    cia_currency_list_price = (

    product.sale_price_currency_id.compute(

    product.list_price, company_currency))

    else:

    cia_currency_list_price = product.list_price

    product.cia_currency_list_price = cia_currency_list_price

    def _price_get(self, cr, uid, products, ptype='list_price', context=None):

    if not context:

    context = {}

    res = super(product_template, self)._price_get(

    cr, uid, products, ptype=ptype, context=context)

    if ptype == 'list_price':

    pricetype_obj = self.pool.get('product.price.type')

    price_type_id = pricetype_obj.search(

    cr, uid, [('field', '=', ptype)])[0]

    price_type_currency_id = pricetype_obj.browse(

    cr, uid, price_type_id).currency_id.id

    for product in products:

    if product.sale_price_currency_id.id != price_type_currency_id:

    res[product.id] = self.pool.get('res.currency').compute(

    cr, uid, product.sale_price_currency_id.id,

    price_type_currency_id, res[product.id],

    context=context)

            return res

    0
    Аватар
    Відмінити
    Enjoying the discussion? Don't just read, join in!

    Create an account today to enjoy exclusive features and engage with our awesome community!

    Реєстрація
    Related Posts Відповіді Переглядів Дія
    Modifying currency_id on product.template Вирішено
    product product.product
    Аватар
    Аватар
    1
    трав. 21
    7450
    How to associate image with product variant?
    product product.product
    Аватар
    Аватар
    1
    бер. 18
    8604
    Configure product wizard in sale product price need to show based on varient
    product product.product Product-variants
    Аватар
    Аватар
    1
    лип. 25
    1048
    How to Inherit View For Specific Group and restrict Create and Edit ?
    product product.product product.template
    Аватар
    Аватар
    1
    лют. 25
    2649
    Customer Article Number
    product product.product product_code
    Аватар
    Аватар
    Аватар
    Аватар
    3
    бер. 24
    7118
    Спільнота
    • Навчальний посібник
    • Документація
    • Форум
    Open Source
    • Завантаження
    • Github
    • Runbot
    • Переклади
    Послуги
    • Хостинг Odoo.sh
    • Підтримка
    • Оновлення
    • Кастомні доробки
    • Навчання
    • Знайдіть бухгалтера
    • Знайдіть партнера
    • Стати партнером
    Про нас
    • Наша компанія
    • Торгові активи
    • Зв'яжіться з нами
    • Вакансії
    • Події
    • Подкаст
    • Блог
    • Клієнти
    • Юридичні документи • Конфіденційність
    • Безпека
    الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

    Odoo - це набір програм для роботи з відкритим кодом, які охоплюють всі ваші потреби компанії: CRM, електронна комерція, бухгалтерський облік, склад, точка продажу, управління проектами тощо.

    Унікальна пропозиція Odoo - це одночасно дуже проста у використанні та повністю інтегрована.

    Website made with

    Odoo Experience on YouTube

    1. Use the live chat to ask your questions.
    2. The operator answers within a few minutes.

    Live support on Youtube
    Watch now