콘텐츠로 건너뛰기
Odoo 메뉴
  • 로그인
  • 무료 체험하기
  • 앱
    재무 관리
    • 회계
    • 청구서 관리
    • 비용 관리
    • 스프레드시트 (BI)
    • 문서
    • 전자 서명
    판매
    • CRM
    • 판매
    • POS 스토어
    • POS 레스토랑
    • 구독
    • 렌탈
    웹사이트
    • 웹사이트 빌더
    • 이커머스
    • 블로그
    • 포럼
    • 실시간 채팅
    • 온라인 학습 관리
    공급망
    • 재고 관리
    • 제조 관리
    • 제품 수명주기 관리 (PLM)
    • 매입
    • 유지관리
    • 품질
    인적자원 관리
    • 직원
    • 채용
    • 휴가 관리
    • 인사 평가
    • 인재 추천
    • 차량 관리
    마케팅
    • 소셜 마케팅
    • 이메일 마케팅
    • SMS 마케팅
    • 행사
    • 마케팅 자동화
    • 설문 조사
    서비스
    • 프로젝트
    • 작업 기록
    • 현장 서비스
    • 헬프데스크
    • 일정 관리
    • 일정 예약
    생산성
    • 메일 및 채팅
    • 전자 결재
    • IoT
    • VoIP
    • 지식 센터
    • WhatsApp
    타사 앱 Odoo 스튜디오 Odoo 클라우드 플랫폼
  • 인더스트리
    리테일
    • 서점
    • 의류 매장
    • 가구점
    • 식료품점
    • 철물점
    • 장난감 가게
    식음료 & 숙박업
    • 바 & 펍
    • 레스토랑
    • 패스트푸드
    • 게스트 하우스
    • 음료 유통업체
    • 호텔
    부동산
    • 부동산 중개업체
    • 건축 회사
    • 건설
    • 부동산 관리
    • 가드닝
    • 부동산 소유자 협회
    컨설팅
    • 회계 법인
    • Odoo 파트너
    • 마케팅 대행사
    • 법률 사무소
    • 인재 영입
    • 감사 및 인증
    제조 관리
    • 텍스타일
    • 메탈
    • 가구
    • 푸드
    • 양조장
    • 기업용 선물
    건강 & 피트니스
    • 스포츠 클럽
    • 안경점
    • 피트니스 센터
    • 웰니스 전문가
    • 약국
    • 미용실
    사업
    • 핸디맨
    • IT 하드웨어 및 지원 서비스
    • 태양 에너지 시스템
    • 제화업체
    • 클리닝 서비스
    • HVAC 서비스
    기타
    • 비영리 단체
    • 환경 에이전시
    • 광고판 임대
    • 사진
    • 자전거 임대
    • 소프트웨어 리셀러
    전체 인더스트리 찾아보기
  • 커뮤니티
    학습
    • 튜토리얼
    • 문서
    • 인증
    • 훈련
    • 블로그
    • 팟캐스트
    교육 역량 강화
    • 교육 프로그램
    • Scale-Up! 경영관리 게임
    • Odoo에 방문해보세요
    소프트웨어 신청
    • 다운로드
    • 버전 살펴보기
    • 릴리즈 내역
    협업
    • Github
    • 포럼
    • 행사
    • 번역
    • 파트너 등록
    • 파트너 대상 서비스
    • 회계 법인 정보 등록
    서비스 신청
    • 파트너 검색
    • 회계사 검색
    • 전문 상담 예약
    • 구현 서비스
    • 고객 정보
    • 고객 지원
    • 업그레이드
    Github 유튜브 트위터 링크드인 인스타그램 페이스북 스포티파이
    +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 답글
4371 화면
아바타
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
14003
Onchange function not loading values on form
11
아바타
아바타
2
10월 18
3536
Is Odoo a stateless web application?
11
아바타
아바타
1
3월 18
5165
[11.0] invoicing of timesheet for multiple salesorders
11
아바타
0
11월 17
3258
how to eliminate the "Create/edit" option at the quotation 해결 완료
odoo 11
아바타
아바타
아바타
2
4월 23
12922
커뮤니티
  • 튜토리얼
  • 문서
  • 포럼
오픈 소스
  • 다운로드
  • 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, 이커머스, 회계, 재고, POS, 프로젝트 관리 등 기업의 모든 요구 사항을 충족하도록 설계된 오픈 소스 기반의 통합 비즈니스 앱 제품군입니다.

Odoo의 간편한 UI와 완벽하게 통합된 기능을 직접 확인해 보세요.

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