ARTICLE DETAIL

资讯详情

深耕郑州网站建设与运营推广的一线实战洞察。

Odoo 怎么接入 Peppol 网络收发 BIS Billing 3.0 格式的发票

Odoo 怎么接入 Peppol 网络收发 BIS Billing 3.0 格式的发票 Odoo 怎么接入 Peppol 网络收发 BIS Billing 3.0 格式的发票【免费下载链接】odooOdoo. Open Source Apps To Grow Your Business.项目地址: https://gitcode.com/GitHub_Trending/od/odoo如果你的公司在 PEPPOL_LIST 列出的欧洲国家奥地利、比利时、瑞士、捷克、德国、丹麦、爱沙尼亚、西班牙、芬兰、法国、爱尔兰、冰岛、立陶宛、卢森堡、拉脱维亚、马耳他、荷兰、挪威、瑞典、斯洛文尼亚等见 addons/account/manifest.py 同级的addons/account/models/company.py中PEPPOL_DEFAULT_COUNTRIES需要向商业伙伴电子发票Odoo 的account_peppol模块可以让发票以 Peppol BIS Billing 3.0UBLEN 16931格式通过 Peppol 网络发送和接收。完成接入后你在 Odoo 中点一次“Send”发票就会以Peppol BIS Billing UBL Invoice V3这类文档标识urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1见 res_company.py 的_peppol_modules_document_types发出对方回传的电子发票会自动落入你配置的采购日记账。安装模块与依赖模块定义见 addons/account_peppol/manifest.py关键事实模块名Peppol摘要为 “This module is used to send/receive documents with PEPPOL”version为1.2依赖account_edi_proxy_client和account_edi_ubl_cii即会计应用及 UBL/CII EDI 模块这两个会随安装自动带上Python 外部依赖为phonenumbers系统包对应python3-phonenumbersapt 名。模块用phonenumbers解析并校验注册时填写的手机号码缺失时注册向导会直接报 “Please install the phonenumbers library.”见 res_company.py 的_check_phonenumbers_importauto_install配置当account_edi_ubl_cii已安装、且数据库中至少有一家公司位于上述国家列表时该模块会自动安装。因此最短准备路径是确认已安装 Odoo 会计accountaccount_edi_ubl_cii在公司设置里把公司所在国家设为支持的国家之一然后安装account_peppol若手动安装先保证phonenumbers库可用。在设置中注册为 Peppol 参与者入口在 Odoo 设置General Settings → Accounting中由该模块提供的 Peppol 区块res_config_settings_views.xml未注册时状态not_registered显示 “Activate Peppol” 按钮点击后打开 “Activate Electronic Invoicing (via Peppol)” 注册向导模型peppol.registration实现见 peppol_registration.py已注册后同一区块显示你的 Peppol IDEAS:endpoint即account_peppol_edi_identification、非生产模式时附带的模式标签DEMO/TEST、Peppol Contact Email以及 “Disconnect Peppol” 按钮。向导中必须填的字段由_ensure_mandatory_fields校验公司已选择国家会计国家联系人邮箱与手机号都必填。手机号需符合国际格式例如3212345678932为区号格式错误会报 “Please enter the mobile number in the correct international format.”Peppol Address EAS电子地址规范代码下拉选择 Endpoint编号只保留字母数字字符。部分 EAS 的编号有格式规则如000710 位瑞典组织号、01848 位丹麦 CVR、01929 位挪威组织号、020810 位、0088EAN不符合会报 “The Peppol endpoint identification number is not correct.”规则表PEPPOL_ENDPOINT_RULES见 res_company.py分支公司不能使用与总公司完全相同的 Peppol ID“Peppol ID should be different from main company.”。向导中的 “Register as a receiver” 选项决定注册角色Odoo 会查询 SMP 目录判断你的公司是否已在 Peppol 网络上有注册——如果尚未注册勾选该项会走 SMP 注册即同时获得接收能力如果已在某 Access Point 注册过接收向导会提示 “Your company is already registered on an Access Point (…) for receiving invoices. We will register you on Odoo as a sender only.”提交后可能弹出一次身份验证如 itsme/generic 登录_create_connection会生成 RSA 密钥对、向 Peppol 代理服务发起连接并创建account_edi_proxy_client.user记录然后按最终状态给出三种成功通知仅发送sender“You can now send electronic invoices via Peppol.”SMP 注册中smp_registration“Your Peppol registration will be activated soon. You can already send invoices.”设置页会提示 “Your registration should be activated within a day.”可收可发receiver“You can now send and receive electronic invoices via Peppol”。状态字段account_peppol_proxy_state的取值是后续所有判断的基础not_registered/sender可发不可收/smp_registration可发接收注册待激活/receiver可发可收/rejected。注册被拒时会收到 “Registration rejected.” 通知设置页也会说明拒绝原因已发送邮件。法国公司属于特例向导会把 EAS 固定为0225但_ensure_pdp_not_sent_through_peppol会拦截通过 Peppol 发送法国发票的路径要求改用 “France - E-Invoicing (Approved Platform)” 模块l10n_fr_pdp通过 PDP 发送。如果你的公司是法国主体这里应走 PDP 模块而不是本文主路径。配置接收入账日记账与 Webhook要接收发票参与角色为 Sending Receiving设置页会要求必填Incoming Accounting Journal必须是采购类型purchase日记账选错会报 “A purchase journal must be used to receive Peppol documents.”res_company.py 的_check_peppol_purchase_journal_id。未指定时系统默认取该公司第一个采购日记账。接收依赖两条链路都在 data/cron.xml 和 controllers/webhooks.py 中定义定时任务PEPPOL: retrieve new documents每 4 小时拉取一次新文档_cron_peppol_get_new_documentsWebhook 路由/peppol/webhook/new-message公开 POST带 token 校验会在 Access Point 推送新消息时立即触发上述任务另有/peppol/webhook/message-state-update与/peppol/webhook/user-state-update分别触发消息状态、参与者状态更新。Webhook 地址由系统基于服务器 Base URL 拼接/peppol/webhook见_get_peppol_webhook_endpoint所以要求 Odoo 实例有公网可达的 Base URL 注册时才会生效没有 Webhook 时4 小时一次的拉取任务仍能兜底收到发票。消息状态更新由PEPPOL: update message status任务每日执行一次。发送一张 BIS Billing 3.0 发票发送路径就在发票表单上account_move_send.py确认商业伙伴的 Peppol 状态。伙伴模型上有peppol_verification_statenot_verified/not_valid/not_valid_format/valid填写或修改伙伴的peppol_easpeppol_endpoint时会自动执行 SMP 目录校验button_account_peppol_check_partner_endpoint。只有valid伙伴在 Peppol 上且能收该格式才能走 Peppol 通道not_valid_format会在发送向导中产生告警 “Customer is on Peppol but did not enable receiving documents.”客户所在国家在PEPPOL_DEFAULT_COUNTRIES内时peppol会默认加入发送方式你在 “Send and Print” / 发送向导中确认即可比利时伙伴EAS0208/9925在一种格式校验失败时会自动尝试另一种 EAS 组合。发送前提由_is_applicable_to_move逐条检查伙伴国家在PEPPOL_LIST、公司account_peppol_proxy_state不是not_registered/rejected且_compute_peppol_can_send为真、伙伴校验状态valid、发票能生成 UBL/CII XML。发送时_get_peppol_document_params组装{receiver: EAS:endpoint, ubl: base64(XML)}文档并调用 Peppol 代理的1/send_document接口。XML 超过约 64 MB 会报 “Invoice … exceeds the size limit of 64 MB to be sent via Peppol.”若公司尚未注册或状态不允许发送点击发送会直接打开上文那个注册向导_do_peppol_pre_send注册完成后可继续发送。验证发送与接收结果发送侧——发票上的PEPPOL status字段peppol_move_state是核对依据取值链路为ready已发布发票且公司可发送、伙伴校验valid时自动置为 Ready to send→to_sendQueued提交时置位→processingPending Reception代理返回消息 UUID 后写入peppol_message_uuid并置位→doneDone失败则进入errorError错误标题记录在发送数据中例如参与者未就绪等错误经get_peppol_error_message转成可读信息状态进入processing后系统会把PEPPOL: update message status定时任务提前到 5 分钟后触发一次ir_cron_peppol_get_message_status的_trigger以尽快把网络回执同步回来。发票一旦peppol_is_sent即状态离开 ready/to_send/error/skipped就不能再取消或退回草稿“Cannot cancel an entry that has already been sent to PEPPOL”草稿态发票可先改回再处理。接收侧——新发票经拉取或 Webhook 触发创建后会计日志标题为 “Peppol invoice received”并携带 “Peppol document UUID: …” 行account_edi_common.py 的_log_import_invoice_ubl_cii。收到来自 Peppol 的发票在约束上更严格客户方与公司方的EndpointID都必须存在PEPPOL-EN16931-R010 / R020见 account_edi_xml_ubl_bis3.py缺失时导入会报对应约束错误。入账位置即上文配置的采购日记账。故障与边界情况设置页有一个专门的失步告警account_is_token_out_of_sync为真时显示“Disconnected from Peppol! Your database is not linked to Peppol anymore. This might be due to a database duplication or restoration.” 此时提供两个按钮Reconnect this database把当前数据库重新绑定到 Peppol 连接_peppol_out_of_sync_reconnect_this_databaseDisconnect this database只断开当前数据库不影响 IAP 侧连接本身不要用它来注销参与者。其余需要留意的限制退出网络用设置页的 “Disconnect Peppol”button_peppol_deregister或 “Re-register” 流程先注销再重新打开注册向导分支公司可借用总公司的连接设置页显示 “You are sending from ”此时 Peppol ID、角色配置随母公司可单独 “Disconnect” 断开借用关系同一公司已存在其他 EDI 代理连接时注册会报 “A connection to already exists.”不能并行两条通道若 Peppol 返回rejected设置页会显示 “You registration has been rejected, the reason has been sent to you via email.”需要联系支持。完成以上步骤后判断接入是否成功的标准就是设置页 Peppol ID 显示且状态为receiver或smp_registration一天内转为可接收、测试发票的 PEPPOL status 走到done、接收的发票出现在采购日记账且日志中带 Peppol 消息 UUID。【免费下载链接】odooOdoo. Open Source Apps To Grow Your Business.项目地址: https://gitcode.com/GitHub_Trending/od/odoo创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表