콘텐츠로 건너뛰기
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
게시판 정보
도움말

account move line display_type field not working

구독

이 게시물에 활동이 있으면 알림 받기

신고된 질문입니다
odooNiyasCybrosysodoo16features
7722 화면
아바타
Muhammad Fayyaz

I have my Migrated database in v16 where I have retrieved all records successfully but there is a display_type field in account move line model which is not working for account move model page="Invoice Lines" as odoo16 default functionality shows cogs items inside Journal Items and also set display_type as cogs but in migration cogs items are being shown in Invoice Lines and i think  it is happening just because of display_type as this is keep assigning display_type as product which is causing to show cogs items in Invoice Lines so anyone who knows about it whether it is happening just because of Migration script or some other reasons.

My migration script for account module is below:

post-migration code:

from openupgradelib import openupgrade

_translations_to_delete = [
"email_template_edi_credit_note",
"email_template_edi_invoice",
"mail_template_data_payment_receipt",
]


_deleted_xml_records = [
"account.data_account_off_sheet",
"account.data_account_type_credit_card",
"account.data_account_type_current_assets",
"account.data_account_type_current_liabilities",
"account.data_account_type_depreciation",
"account.data_account_type_direct_costs",
"account.data_account_type_equity",
"account.data_account_type_expenses",
"account.data_account_type_fixed_assets",
"account.data_account_type_liquidity",
"account.data_account_type_non_current_assets",
"account.data_account_type_non_current_liabilities",
"account.data_account_type_other_income",
"account.data_account_type_payable",
"account.data_account_type_prepayments",
"account.data_account_type_receivable",
"account.data_account_type_revenue",
"account.data_unaffected_earnings",
"account.account_tax_carryover_line_comp_rule",
"account.analytic_default_comp_rule",
]


@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(env.cr, "account", "16.0.1.2/noupdate_changes.xml")
openupgrade.delete_record_translations(env.cr, "account", _translations_to_delete)
openupgrade.delete_records_safely_by_xml_id(
env,
_deleted_xml_records,
)

and pre-migration code:

from openupgradelib import openupgrade

_xmlids_renames = [
(
"sale.group_delivery_invoice_address",
"account.group_delivery_invoice_address",
),
]

_fields_renames = [
(
"account.analytic.line",
"account_analytic_line",
"move_id",
"move_line_id",
),
(
"account.payment.term.line",
"account_payment_term_line",
"day_of_the_month",
"days_after",
),
(
"account.tax.repartition.line.template",
"account_tax_repartition_line_template",
"minus_report_line_ids",
"minus_report_expression_ids",
),
(
"account.tax.repartition.line.template",
"account_tax_repartition_line_template",
"plus_report_line_ids",
"plus_report_expression_ids",
),
]
_models_renames = [
("account.tax.report", "account.report"),
("account.tax.carryover.line", "account.report.external.value"),
("account.tax.report.line", "account.report.line"),
]
_tables_renames = [
("account_tax_report", "account_report"),
("account_tax_carryover_line", "account_report_external_value"),
("account_tax_report_line", "account_report_line"),
]


def _fast_fill_account_account_type(env, model, table):
if not openupgrade.column_exists(env.cr, table, "account_type"):
openupgrade.add_fields(
env,
[
(
"account_type",
model,
table,
"selection",
False,
"account",
)
],
)
openupgrade.logged_query(
env.cr,
f"""
WITH account_type_map AS (
SELECT
res_id AS user_type_id,
CASE
WHEN name = 'data_account_type_receivable' THEN 'asset_receivable'
WHEN name = 'data_account_type_payable' THEN 'liability_payable'
WHEN name = 'data_account_type_liquidity' THEN 'asset_cash'
WHEN name = 'data_account_type_credit_card' THEN 'liability_credit_card'
WHEN name = 'data_account_type_current_assets' THEN 'asset_current'
WHEN name = 'data_account_type_non_current_assets' THEN 'asset_non_current'
WHEN name = 'data_account_type_prepayments' THEN 'asset_prepayments'
WHEN name = 'data_account_type_fixed_assets' THEN 'asset_fixed'
WHEN name = 'data_account_type_current_liabilities'
THEN 'liability_current'
WHEN name = 'data_account_type_non_current_liabilities'
THEN 'liability_non_current'
WHEN name = 'data_account_type_equity' THEN 'equity'
WHEN name = 'data_unaffected_earnings' THEN 'equity_unaffected'
WHEN name = 'data_account_type_revenue' THEN 'income'
WHEN name = 'data_account_type_other_income' THEN 'income_other'
WHEN name = 'data_account_type_expenses' THEN 'expense'
WHEN name = 'data_account_type_depreciation' THEN 'expense_depreciation'
WHEN name = 'data_account_type_direct_costs' THEN 'expense_direct_cost'
WHEN name = 'data_account_off_sheet' THEN 'off_balance'
END AS account_type
FROM ir_model_data
WHERE module='account' AND name IN (
'data_account_type_receivable',
'data_account_type_payable',
'data_account_type_liquidity',
'data_account_type_credit_card',
'data_account_type_current_assets',
'data_account_type_non_current_assets',
'data_account_type_prepayments',
'data_account_type_fixed_assets',
'data_account_type_current_liabilities',
'data_account_type_non_current_liabilities',
'data_account_type_equity',
'data_unaffected_earnings',
'data_account_type_revenue',
'data_account_type_other_income',
'data_account_type_expenses',
'data_account_type_depreciation',
'data_account_type_direct_costs',
'data_account_off_sheet'
)
)
UPDATE {table} aa
SET account_type = atm.account_type
FROM account_type_map atm
WHERE atm.user_type_id = aa.user_type_id
""",
)


def _account_account_fast_fill_include_initial_balance(env):
if not openupgrade.column_exists(
env.cr, "account_account", "include_initial_balance"
):
openupgrade.add_fields(
env,
[
(
"include_initial_balance",
"account.account",
"account_account",
"boolean",
False,
"account",
),
],
)
openupgrade.logged_query(
env.cr,
"""
UPDATE account_account
SET include_initial_balance = true
WHERE account_type NOT IN
('income', 'income_other', 'expense',
'expense_depreciation', 'expense_direct_cost', 'off_balance')
""",
)


def _delete_sql_constraints(env):
# Delete constraints to recreate it
openupgrade.delete_sql_constraint_safely(
env, "account", "account_journal", "code_company_uniq"
)
openupgrade.delete_sql_constraint_safely(
env, "account", "account_move_line", "check_accountable_required_fields"
)
openupgrade.delete_sql_constraint_safely(
env, "account", "account_move_line", "check_amount_currency_balance_sign"
)
openupgrade.delete_sql_constraint_safely(
env, "account", "account_move_line", "check_credit_debit"
)


def _account_analytic_line_fast_fill_journal_id(env):
if not openupgrade.column_exists(env.cr, "account_analytic_line", "journal_id"):
openupgrade.add_fields(
env,
[
(
"journal_id",
"account.analytic.line",
"account_analytic_line",
"many2one",
False,
"account",
)
],
)
openupgrade.logged_query(
env.cr,
"""
UPDATE account_analytic_line aal
SET journal_id = aml.journal_id
FROM account_move_line aml
WHERE aml.id = aal.move_line_id
""",
)


def _account_bank_statement_line_fast_fill_internal_index(env):
if not openupgrade.column_exists(
env.cr, "account_bank_statement_line", "internal_index"
):
openupgrade.add_fields(
env,
[
(
"internal_index",
"account.bank.statement.line",
"account_bank_statement_line",
"char",
False,
"account",
)
],
)
openupgrade.logged_query(
env.cr,
"""
UPDATE account_bank_statement_line stmt
SET internal_index = concat(
to_char(am.date, 'YYYYMMDD'),
lpad((2147483647 - stmt.sequence)::text, 10, '0'),
lpad(am.id::text, 10, '0')
)
FROM account_move am
WHERE stmt.move_id = am.id;
""",
)


def _account_payment_fast_fill_amount_company_currency_signed(env):
if not openupgrade.column_exists(
env.cr, "account_payment", "amount_company_currency_signed"
):
openupgrade.add_fields(
env,
[
(
"amount_company_currency_signed",
"account.payment",
"account_payment",
"monetary",
False,
"account",
)
],
)


def _account_move_fast_fill_display_type(env):
"""
Respectively Fill display type is Null AND
Case 1: with am is not invoice
set display type is 'product'
Case 2: with am is invoice AND aml line tax
set display type is 'tax'
Case 3: with am is invoice AND aml line receivable or payable,
set display type is 'payment_term'
Case 4: with am is invoice
set display type is 'product'
Case 5: with aml is an accounting transaction occurring
set display type is 'product'
"""
openupgrade.logged_query(
env.cr,
"""
WITH sub AS (
SELECT
aml.id,
CASE
WHEN am.move_type NOT IN
('out_invoice', 'out_refund', 'in_invoice', 'in_refund')
THEN 'product'
WHEN aml.tax_line_id IS NOT NULL THEN 'tax'
WHEN aa.account_type IN
('asset_receivable', 'liability_payable') THEN 'payment_term'
ELSE 'product'
END AS display_type
FROM account_move_line AS aml
LEFT JOIN account_move AS am ON am.id = aml.move_id
LEFT JOIN account_account AS aa ON aa.id = aml.account_id
WHERE aml.display_type IS NULL AND am.id = aml.move_id
)
UPDATE account_move_line AS aml
SET display_type = sub.display_type
FROM sub
WHERE aml.id = sub.id;
""",
)


def _account_move_auto_post_boolean_to_selection(env):
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE account_move
ALTER COLUMN auto_post type character varying;
""",
)
openupgrade.logged_query(
env.cr,
"""
UPDATE account_move AS am
SET auto_post =
CASE
WHEN auto_post = 'true' THEN 'at_date'
ELSE 'no'
END;
""",
)


def _account_analytic_distribution_model_generate(env):
if not (
openupgrade.column_exists(
env.cr, "account_analytic_distribution_model", "partner_id"
)
and openupgrade.column_exists(
env.cr, "account_analytic_distribution_model", "product_id"
)
and openupgrade.column_exists(
env.cr, "account_analytic_distribution_model", "company_id"
)
and openupgrade.column_exists(
env.cr, "account_analytic_distribution_model", "account_prefix"
)
):
openupgrade.add_fields(
env,
[
(
"partner_id",
"account.analytic.distribution.model",
"account_analytic_distribution_model",
"many2one",
False,
"account",
),
(
"product_id",
"account.analytic.distribution.model",
"account_analytic_distribution_model",
"many2one",
False,
"account",
),
(
"company_id",
"account.analytic.distribution.model",
"account_analytic_distribution_model",
"many2one",
False,
"account",
),
(
"account_prefix",
"account.analytic.distribution.model",
"account_analytic_distribution_model",
"char",
False,
"account",
),
],
)
openupgrade.logged_query(
env.cr,
"""
WITH distribution_data AS (
WITH sub AS (
SELECT
all_line_data.analytic_default_id,
all_line_data.analytic_account_id,
SUM(all_line_data.percentage) AS percentage
FROM (
SELECT
analytic_default.id AS analytic_default_id,
account.id AS analytic_account_id,
100 AS percentage
FROM account_analytic_default analytic_default
JOIN account_analytic_account account
ON account.id = analytic_default.analytic_id
WHERE analytic_default.analytic_id IS NOT NULL
UNION ALL
SELECT
analytic_default.id AS analytic_default_id,
dist.account_id AS analytic_account_id,
dist.percentage AS percentage
FROM account_analytic_default analytic_default
JOIN account_analytic_default_account_analytic_tag_rel tag_rel
ON tag_rel.account_analytic_default_id = analytic_default.id
JOIN account_analytic_distribution dist
ON dist.tag_id = tag_rel.account_analytic_tag_id
) AS all_line_data
GROUP BY all_line_data.analytic_default_id, all_line_data.analytic_account_id
)
SELECT sub.analytic_default_id AS analytic_default_id,
jsonb_object_agg(sub.analytic_account_id::text, sub.percentage)
AS analytic_distribution
FROM sub
GROUP BY sub.analytic_default_id
)
INSERT INTO account_analytic_distribution_model (
account_prefix,
partner_id,
product_id,
company_id,
create_date,
write_date,
create_uid,
write_uid,
analytic_distribution)
SELECT
aa.code,
aad.partner_id,
aad.product_id,
aad.company_id,
aad.create_date,
aad.write_date,
aad.create_uid,
aad.write_uid,
dist.analytic_distribution
FROM
distribution_data dist
JOIN account_analytic_default aad ON aad.id = dist.analytic_default_id
JOIN account_account aa ON aa.id = aad.account_id
""",
)


def _aml_fast_fill_analytic_distribution(env):
"""
take all the move lines, if have an analytic accounting account, it's 100%
combined with the analytic distribution of account analytic tag
then sum them together by analytic account
"""
if not openupgrade.column_exists(
env.cr, "account_move_line", "analytic_distribution"
):
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE account_move_line
ADD COLUMN IF NOT EXISTS analytic_distribution jsonb;
""",
)
openupgrade.logged_query(
env.cr,
"""
WITH distribution_data AS (
WITH sub AS (
SELECT
all_line_data.move_line_id,
all_line_data.analytic_account_id,
SUM(all_line_data.percentage) AS percentage
FROM (
SELECT
move_line.id AS move_line_id,
account.id AS analytic_account_id,
100 AS percentage
FROM account_move_line move_line
JOIN account_analytic_account account
ON account.id = move_line.analytic_account_id
WHERE move_line.analytic_account_id IS NOT NULL

UNION ALL

SELECT
move_line.id AS move_line_id,
dist.account_id AS analytic_account_id,
dist.percentage AS percentage
FROM account_move_line move_line
JOIN account_analytic_tag_account_move_line_rel tag_rel
ON tag_rel.account_move_line_id = move_line.id
JOIN account_analytic_distribution dist
ON dist.tag_id = tag_rel.account_analytic_tag_id
) AS all_line_data
GROUP BY all_line_data.move_line_id, all_line_data.analytic_account_id
)
SELECT sub.move_line_id,
jsonb_object_agg(sub.analytic_account_id::text, sub.percentage)
AS analytic_distribution
FROM sub
GROUP BY sub.move_line_id
)
UPDATE account_move_line move_line
SET analytic_distribution = dist.analytic_distribution
FROM distribution_data dist WHERE move_line.id = dist.move_line_id
""",
)


def _arml_fast_fill_analytic_distribution(env):
"""
We handle exactly the same as account.move.line
"""
if not openupgrade.column_exists(
env.cr, "account_reconcile_model_line", "analytic_distribution"
):
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE account_reconcile_model_line
ADD COLUMN IF NOT EXISTS analytic_distribution jsonb;
""",
)
openupgrade.logged_query(
env.cr,
"""
WITH distribution_data AS (
WITH sub AS (
SELECT
all_line_data.model_line_id,
all_line_data.analytic_account_id,
SUM(all_line_data.percentage) AS percentage
FROM (
SELECT
model_line.id AS model_line_id,
account.id AS analytic_account_id,
100 AS percentage
FROM account_reconcile_model_line model_line
JOIN account_analytic_account account
ON account.id = model_line.analytic_account_id
WHERE model_line.analytic_account_id IS NOT NULL

UNION ALL

SELECT
model_line.id AS model_line_id,
dist.account_id AS analytic_account_id,
dist.percentage AS percentage
FROM account_reconcile_model_line model_line
JOIN account_reconcile_model_analytic_tag_rel tag_rel
ON tag_rel.account_reconcile_model_line_id = model_line.id
JOIN account_analytic_distribution dist
ON dist.tag_id = tag_rel.account_analytic_tag_id
) AS all_line_data
GROUP BY all_line_data.model_line_id, all_line_data.analytic_account_id
)
SELECT sub.model_line_id,
jsonb_object_agg(sub.analytic_account_id::text, sub.percentage)
AS analytic_distribution
FROM sub
GROUP BY sub.model_line_id
)
UPDATE account_reconcile_model_line model_line
SET analytic_distribution = dist.analytic_distribution
FROM distribution_data dist WHERE model_line.id = dist.model_line_id
""",
)


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_fields(env, _fields_renames)
openupgrade.rename_models(env.cr, _models_renames)
openupgrade.rename_tables(env.cr, _tables_renames)
_fast_fill_account_account_type(env, "account.account", "account_account")
_fast_fill_account_account_type(
env, "account.account.template", "account_account_template"
)
_account_account_fast_fill_include_initial_balance(env)
_delete_sql_constraints(env)
_account_analytic_line_fast_fill_journal_id(env)
_account_bank_statement_line_fast_fill_internal_index(env)
_account_move_fast_fill_display_type(env)
_account_move_auto_post_boolean_to_selection(env)
_account_payment_fast_fill_amount_company_currency_signed(env)
_account_analytic_distribution_model_generate(env)
_aml_fast_fill_analytic_distribution(env)
_arml_fast_fill_analytic_distribution(env)


0
아바타
취소
토론이 재미있으신가요? 직접 참여해보세요!

지금 바로 가입하여 독점 서비스를 이용해보고 특별한 커뮤니티와 소통하세요!

가입
관련 게시물 답글 화면 활동
Unlink my Subscription from odoo online and link to odoo.sh
odoo Niyas Cybrosys odoo16features
아바타
아바타
1
10월 24
4622
allow portal user to view custom model backend view using sharing via odoo 16 portal
odoo Niyas Cybrosys odoo16features
아바타
0
12월 23
2324
account.move.line data is not showing 해결 완료
odoo Niyas Cybrosys odoo16features
아바타
아바타
2
10월 23
3398
add search panel in graph and pivot view in odoo 16
Niyas Cybrosys odoo16features
아바타
아바타
1
12월 23
1916
how to hide delete button in form view and tree view with a condition in odoo 16
odoo Niyas Cybrosys
아바타
0
9월 23
2766
커뮤니티
  • 튜토리얼
  • 문서
  • 포럼
오픈 소스
  • 다운로드
  • 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