コンテンツへスキップ
Odoo メニュー
  • サインイン
  • 無料で15日試す
  • アプリ
    財務
    • 会計
    • 請求
    • 経費
    • スプレッドシート(BI)
    • ドキュメント管理
    • 署名
    販売
    • CRM
    • 販売
    • POS店舗
    • POSレストラン
    • サブスクリプション
    • レンタル
    ウェブサイト
    • ウェブサイトビルダー
    • eコマース
    • ブログ
    • フォーラム
    • ライブチャット
    • eラーニング
    サプライチェーン
    • 在庫
    • 製造
    • 製品ライフサイクル管理 (PLM)
    • 購買
    • 整備
    • 品質
    人事業務
    • 従業員管理
    • 採用
    • 休暇管理
    • 人事評価
    • リファラル
    • フリート
    マーケティング
    • ソーシャルマーケティング
    • メールマーケティング
    • SMSマーケティング
    • イベント
    • マーケティングオートメーション
    • アンケート調査
    サービス
    • プロジェクト管理
    • タイムシート
    • フィールドサービス
    • ヘルプデスク
    • 計画
    • アポイントメント
    生産性向上ツール
    • ディスカッション
    • 承認
    • IoT
    • VoIP
    • ナレッジ
    • WhatsApp
    サードパーティアプリ Odooスタジオ Odooクラウドプラットホーム
  • インダストリー(業種別ソリューション)
    小売
    • 書店
    • アパレルショップ
    • 家具専門店
    • 食料品店
    • 金物店
    • 玩具店
    飲食・ホスピタリティ業界
    • バー・パブ
    • レストラン
    • ファストフード
    • ゲストハウス
    • 飲料販売代理店
    • ホテル
    不動産
    • 不動産会社
    • 建築事務所
    • 建設
    • 不動産管理
    • 造園
    • 住宅所有者組合
    コンサルティング
    • 会計事務所
    • Odooパートナー
    • マーケティングエージェンシー
    • 法律事務所
    • 人材派遣
    • 監査・認証
    製造
    • テキスタイル
    • 金属
    • 家具
    • 飲食
    • 醸造所
    • コーポレートギフト
    ヘルス & フィットネス
    • スポーツクラブ
    • 眼鏡店
    • フィットネスセンター
    • ウェルネス専門家
    • 薬局
    • ヘアサロン
    業種
    • 便利屋
    • IT ハードウェア・サポート
    • 太陽エネルギーシステム
    • 靴メーカー
    • クリーニングサービス
    • 空調設備サービス
    その他
    • 非営利団体
    • 環境機関
    • ビルボードレンタル
    • 写真
    • 自転車リース
    • ソフトウェアリセラー
    すべての業種を見る
  • コミュニティ
    学ぶ
    • チュートリアル
    • ドキュメンテーション
    • 認定
    • トレーニング
    • ブログ
    • ポッドキャスト
    教育サポート
    • 教育プログラム
    • Scale Up! ビジネスゲーム
    • Odooオフィス訪問
    ソフトを入手
    • ダウンロード
    • エディションを比較
    • リリース
    コラボレーション
    • Github
    • フォーラム
    • イベント
    • 翻訳
    • パートナーになる
    • パートナー様向けサービス
    • 会計事務所を登録
    サービス利用
    • パートナー一覧
    • 会計事務所一覧
    • 今すぐ相談する
    • 導入支援サービス
    • お客様一覧
    • サポート
    • アップグレード
    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
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
ヘルプ

error in migrating module v8 to v11

購読

この投稿に活動があった際に通知を受け取ります

この質問にフラグが付けられました
11
3 返信
4321 ビュー
アバター
NASHMIN YEGANEH

Hello dear members

I'm trying to port a module to v11 from v8 and here is the error log when i try to install it

please tell me if any one know where is the problem and how can i fix it

thanks in advance :)

 
Odoo Server Error

Traceback (most recent call last):
File "/opt/odoo/models.py", line 982, in _validate_fields
check(self)
File "/opt/odoo/addons/base/ir/ir_ui_view.py", line 338, in _check_xml
self.postprocess_and_fields(view.model, view_doc, view.id)
File "/opt/odoo/addons/base/ir/ir_ui_view.py", line 957, in postprocess_and_fields
self.raise_view_error(_('Model not found: %(model)s') % dict(model=model), view_id)
File "/opt/odoo/addons/base/ir/ir_ui_view.py", line 506, in raise_view_error
raise ValueError(message)
ValueError: Model not found: res.letter

Error context:
View `Inbound Letter Tree`
[view_id: 1677, xml_id: n/a, model: res.letter, parent_id: n/a]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/odoo/tools/convert.py", line 741, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "/opt/odoo/tools/convert.py", line 651, in _tag_record
id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)
File "/opt/odoo/addons/base/ir/ir_model.py", line 1469, in _update
record = record.create(values)
File "/opt/odoo/addons/base/ir/ir_ui_view.py", line 401, in create
return super(View, self).create(self._compute_defaults(values))
File "/opt/odoo/models.py", line 3302, in create
self._fields[key].determine_inverse(record)
File "/opt/odoo/fields.py", line 1070, in determine_inverse
getattr(records, self.inverse)()
File "/opt/odoo/addons/base/ir/ir_ui_view.py", line 269, in _inverse_arch
view.write(data)
File "/opt/odoo/addons/base/ir/ir_ui_view.py", line 417, in write
return super(View, self).write(self._compute_defaults(vals))
File "/opt/odoo/models.py", line 3024, in write
self._write(old_vals)
File "/opt/odoo/models.py", line 3177, in _write
self._validate_fields(vals)
File "/opt/odoo/models.py", line 986, in _validate_fields
raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))
odoo.exceptions.ValidationError: ('Error while validating constraint\n\nModel not found: res.letter\n\nError context:\nView `Inbound Letter Tree`\n[view_id: 1677, xml_id: n/a, model: res.letter, parent_id: n/a]', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/odoo/http.py", line 647, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/http.py", line 307, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/opt/odoo/http.py", line 689, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/http.py", line 339, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/http.py", line 332, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo/http.py", line 933, in __call__
return self.method(*args, **kw)
File "/opt/odoo/http.py", line 512, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/addons/web/controllers/main.py", line 934, in call_button
action = self._call_kw(model, method, args, {})
File "/opt/odoo/addons/web/controllers/main.py", line 922, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/api.py", line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/api.py", line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-40>", line 2, in button_immediate_install
File "/opt/odoo/addons/base/module/module.py", line 71, in check_and_log
return method(self, *args, **kwargs)
File "/opt/odoo/addons/base/module/module.py", line 448, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File "/opt/odoo/addons/base/module/module.py", line 541, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/opt/odoo/modules/registry.py", line 85, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo/modules/loading.py", line 343, in load_modules
loaded_modules, update_module)
File "/opt/odoo/modules/loading.py", line 242, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/opt/odoo/modules/loading.py", line 156, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/opt/odoo/modules/loading.py", line 94, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/opt/odoo/tools/convert.py", line 788, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/opt/odoo/tools/convert.py", line 849, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/opt/odoo/tools/convert.py", line 738, in parse
self.parse(rec, mode)
File "/opt/odoo/tools/convert.py", line 748, in parse
exc_info[2]
File "/opt/odoo/tools/pycompat.py", line 86, in reraise
raise value.with_traceback(tb)
File "/opt/odoo/tools/convert.py", line 741, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "/opt/odoo/tools/convert.py", line 651, in _tag_record
id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)
File "/opt/odoo/addons/base/ir/ir_model.py", line 1469, in _update
record = record.create(values)
File "/opt/odoo/addons/base/ir/ir_ui_view.py", line 401, in create
return super(View, self).create(self._compute_defaults(values))
File "/opt/odoo/models.py", line 3302, in create
self._fields[key].determine_inverse(record)
File "/opt/odoo/fields.py", line 1070, in determine_inverse
getattr(records, self.inverse)()
File "/opt/odoo/addons/base/ir/ir_ui_view.py", line 269, in _inverse_arch
view.write(data)
File "/opt/odoo/addons/base/ir/ir_ui_view.py", line 417, in write
return super(View, self).write(self._compute_defaults(vals))
File "/opt/odoo/models.py", line 3024, in write
self._write(old_vals)
File "/opt/odoo/models.py", line 3177, in _write
self._validate_fields(vals)
File "/opt/odoo/models.py", line 986, in _validate_fields
raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))
odoo.tools.convert.ParseError: "Error while validating constraint

Model not found: res.letter

Error context:
View `Inbound Letter Tree`
[view_id: 1677, xml_id: n/a, model: res.letter, parent_id: n/a]
None" while parsing /opt/odoo/addons/lettermgmt/views/res_letter_view.xml:10, near
<record model="ir.ui.view" id="res_letter_in_tree_view">
<field name="name">Inbound Letter Tree</field>
<field name="model">res.letter</field>
<field name="arch" type="xml">
<tree string="Letters">
<field name="name"/>
<field name="number"/>
<field name="move"/>
<field name="type"/>
<field name="class"/>
<field name="date"/>
<field name="recipient_partner_id"/>
<field name="state"/>
<field name="channel_id"/>
</tree>
</field>
</record>
0
アバター
破棄
アバター
Cyril Gaspard (GEM)
最善の回答

Hi,

you must rewrite all your python code with the new api Odoo, see :

https://www.odoo.com/documentation/12.0/howtos/backend.html#

to resume what youhave to do with changes in new api :

1) in your __init__.py file, import your python file like this:

from . import my_python_file_name

2) All types names of fields start with upper:

name = fields.Text(string="My text")

3) You must use decorators for your functions (@api.model, @api.one, @api.multi, @api.onchange, @api.constraint ...), and no need to define cr, uid, context, you can have access to this variable using self._context, self._cr ..., this variables are automatically propgated.


@api.model

def _get_number(self):
        context = self._context or {}
        sequence_pool = self.env['ir.sequence']
        move_type = context.get('move', 'in')
        return sequence_pool.get('%s.letter' % move_type)

4) now context is a frozendict

to redifine context use with_context:

self.with_context({'key': value}).create(vals)

or

self.with_context(key=value}).create(vals)

5) _defaults is now an attribute to define in body field definition

_defaults = {
        'number': _get_number,}

is now:

number = fields.Char('Number', help="Auto Generated Number of letter.", required=True, default=lambda self: self._get_number())

6) Some new attributes to define fields are new like company_dependent=True, ..., see list line 133 her :

https://github.com/odoo/odoo/blob/10.0/odoo/fields.py

7) to browse a model:

self.pool.get('my.model')

is now :

self.env['my.model']

8) function self.search([('field', '=', 10)]) return now a recorset, not a list, same thing for function create ...

9) ....

Good luck, you have some efforts to make to learn new api

Regards

1
アバター
破棄
NASHMIN YEGANEH
著作者

Yes, the __init__.py file content is correct i think, here you can see it here

1) from . import (

letter_class,

letter_folder,

res_letter,

letter_type,

letter_reassignment,

letter_channel,

)

2) some of types names of fields didn't started with upper, i fixed them and for now i got below error log

2018-10-13 20:18:03,402 5311 ERROR ? werkzeug: Error on request:

Traceback (most recent call last):

File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 270, in run_wsgi

execute(self.server.app)

File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 258, in execute

application_iter = app(environ, start_response)

File "/opt/rstco/odoo/service/server.py", line 252, in app

return self.app(e, s)

File "/opt/rstco/odoo/service/wsgi_server.py", line 166, in application

return application_unproxied(environ, start_response)

File "/opt/rstco/odoo/service/wsgi_server.py", line 154, in application_unproxied

result = handler(environ, start_response)

File "/opt/rstco/odoo/http.py", line 1303, in __call__

self.load_addons()

File "/opt/rstco/odoo/http.py", line 1325, in load_addons

m = __import__('odoo.addons.' + module)

File "<frozen importlib._bootstrap>", line 971, in _find_and_load

File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked

File "<frozen importlib._bootstrap>", line 656, in _load_unlocked

File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible

File "/opt/rstco/odoo/modules/module.py", line 82, in load_module

exec(open(modfile, 'rb').read(), new_mod.__dict__)

File "<string>", line 23, in <module>

File "/opt/rstco/odoo/addons/lettermgmt/models/__init__.py", line 21, in <module>

from . import (

File "/opt/rstco/odoo/addons/lettermgmt/models/res_letter.py", line 27, in <module>

class res_letter(models.Model):

File "/opt/rstco/odoo/addons/lettermgmt/models/res_letter.py", line 46, in res_letter

('in', _('IN')),

NameError: name '_' is not defined

and now im working on step 3 :)

NASHMIN YEGANEH
著作者

@Cyril Gaspard (GEM)

Do this work for importing modules in __init__.py or i need to put each on per seperated line?

from . import (

letter_class,

letter_folder,

res_letter,

letter_type,

letter_reassignment,

letter_channel,

)

Cyril Gaspard (GEM)

Hi,

personnaly I use one line for each file to import.

For NameError: name '_' is not defined, you must import _ for translation like this

from odoo import models, fields, _

Bye

アバター
Jainesh Shah(Aktiv Software)
最善の回答

Hello Berctain,

Please verify if you have migrated res.letter model or not.

it is showing that the model is not properly migrated.

Thanks.




Email: odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

3
アバター
破棄
アバター
NASHMIN YEGANEH
著作者 最善の回答

Thanks for replies, this is the res_letter.py python file... and what i did until now

from odoo import models, fields


class res_letter(models.Model):
"""A register class to log all movements regarding letters"""
_name = 'res.letter'
_description = "Log of Letter Movements"
_inherit = 'mail.thread'

def _get_number(self, cr, uid, context=None):
if context is None:
context = {}
sequence_pool = self.env.get('ir.sequence')
move_type = context.get('move', 'in')
return sequence_pool.get(
cr, uid, '%s.letter' % move_type, context=context)

name = fields.text('Subject', help='Comment for user explaining forward.')
folder_id = fields.Many2one('letter.folder', 'Folder', help='Folder which contains letter.')
number = fields.char('Number', help="Auto Generated Number of letter.", required=True)
move = fields.Selection(
[
('in', _('IN')),
('out', _('OUT')), help="Incoming or Outgoing Letter."
],
'Move', index=True, readonly=True, default='draft', )
type = fields.Many2one('letter.type', 'Type', help='Type of Letter, Depending upon size.')
class = fields.Many2one('letter.class', 'Class', help='Classification of Document.')
date = fields.datetime('Letter Date', help='The letter\'s date')
snd_rec_date = fields.datetime('Sent / Received Date', help='Created Date of Letter Logging.')
recipient_partner_id = fields.Many2one('res.partner', 'Recipient', track_visibility='onchange')
sender_partner_id = fields.Many2one('res.partner', 'Sender', track_visibility='onchange')
note = fields.text('Note')

state = fields.Selection(
[
('draft', _('Draft')),
('created', _('Created')),
('validated', _('Validated')),
('rec', _('Received')),
('sent', _('Sent')),
('rec_bad', _('Received Damage')),
('rec_ret', _('Received But Returned')),
('cancel', _('Cancelled'))],
],
'State', index = True, readonly = True, default = 'draft' track_visibility='onchange' )
parent_id = fields.Many2one('res.letter', 'Parent')
child_line = fields.Many2one('res.letter', 'parent_id', 'Letter Lines')
channel_id = fields.Many2one('letter.channel', 'Sent / Receive Source')
orig_ref = fields.char('Original Reference', help="Reference Number at Origin.")
expeditor_ref = fields.char('Expeditor Reference', help="Reference Number used by Expeditor.")
track_ref = fields.char('Tracking Reference', help="Reference Number used for Tracking.")
reassignment_ids = fields.One2many('letter.reassignment', 'letter_id', 'Reassignment lines', help='Reassignment users and comments')
extern_partner_ids = fields.Many2many('res.partner', 'Recipients')


}

_defaults = {
'number': _get_number,
'snd_rec_date': fields.datetime.now,
'move': lambda self, cr, uid, context: context.get('move', 'in'),
'state': 'draft',
}

def action_received(self, cr, uid, ids, context=None):
"""Put the state of the letter into Received"""
for letter in self.browse(cr, uid, ids, context=context):
self.write(cr, uid, [letter.id], {'state': 'rec'}, context=context)
return True

def action_cancel(self, cr, uid, ids, context=None):
"""Put the state of the letter into Cancelled"""
for letter in self.browse(cr, uid, ids, context=context):
self.write(
cr, uid, [letter.id], {'state': 'cancel'}, context=context)
return True

def action_create(self, cr, uid, ids, context=None):
"""Put the state of the letter into Crated"""
for letter in self.browse(cr, uid, ids, context=context):
self.write(
cr, uid, [letter.id], {'state': 'created'}, context=context)
return True

def action_validate(self, cr, uid, ids, context=None):
"""Put the state of the letter into Validated"""
for letter in self.browse(cr, uid, ids, context=context):
self.write(
cr, uid, [letter.id], {'state': 'validated'}, context=context)
return True

def action_send(self, cr, uid, ids, context=None):
"""Put the state of the letter into sent"""
for letter in self.browse(cr, uid, ids, context=context):
self.write(
cr, uid, [letter.id],
{
'state': 'sent',
'snd_rec_date': letter.snd_rec_date or
fields.datetime.now()
},
context=context)
return True

def action_rec_ret(self, cr, uid, ids, context=None):
"""Put the state of the letter into Received but Returned"""
for letter in self.browse(cr, uid, ids, context=context):
self.write(
cr, uid, [letter.id], {'state': 'rec_ret'}, context=context)
return True

def action_rec_bad(self, cr, uid, ids, context=None):
"""Put the state of the letter into Received but Damaged"""
for letter in self.browse(cr, uid, ids, context=context):
self.write(
cr, uid, [letter.id], {'state': 'rec_bad'}, context=context)
return True

def action_set_draft(self, cr, uid, ids, context=None):
"""Put the state of the letter into draft"""
for letter in self.browse(cr, uid, ids, context=context):
self.write(
cr, uid, [letter.id], {'state': 'draft'}, context=context)
return True
0
アバター
破棄
ディスカッションを楽しんでいますか?読むだけでなく、参加しましょう!

今すぐアカウントを作成して、限定機能を利用したり、素晴らしいコミュニティと交流しましょう!

登録
関連投稿 返信 ビュー 活動
How to Disable edit option in form when the state is done 解決済
11
アバター
アバター
アバター
2
2月 24
13905
Onchange function not loading values on form
11
アバター
アバター
2
10月 18
3504
Is Odoo a stateless web application?
11
アバター
アバター
1
3月 18
5111
[11.0] invoicing of timesheet for multiple salesorders
11
アバター
0
11月 17
3165
how to eliminate the "Create/edit" option at the quotation 解決済
odoo 11
アバター
アバター
アバター
2
4月 23
12795
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • 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、eコマース、会計、在庫管理、POS、プロジェクト管理など、企業のさまざまな業務を一つのシステムで管理できる、ベルギー発のオープンソースのERPソフトウェアです。

高機能で使いやすく、完全に統合されたERPとして、ユニークな価値を提供しています。

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