Files
odoo_source/addons/account_peppol/views/res_config_settings_views.xml
T
Daniel Kosky (dako) 78192c45c0 [IMP] account_peppol: demo mode
This commit implements a demo mode in which a user can register to
peppol. The demo user performs no communication with the proxy server,
instead making and receiving only mocked calls and responses.

The @handle_demo decorator is added and utilised in order to avoid
adding the specific (and mostly irrelevant) branches of this of demo
functionality to the body of the code. When the edi_user has the
edi_mode 'demo' this decorator diverts the execution of the
function (excepting when running tests, whenupon it is ignored).

Specific logic is added to the res config settings in order to specify
which modes are availble to the current user based on the
"account_peppol.mode_constraint" config param, and the
"saas_trail.confirmation_token" config param. This allows us to default
users using runbot/demo-data/saas-trial databases to "demo" mode
registration.

task-id: 3497466
         3497725

closes odoo/odoo#136909

Signed-off-by: Laurent Smet (las) <las@odoo.com>
2023-10-17 00:35:05 +00:00

185 lines
13 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.proxy.user</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<div id="account_peppol" position="replace">
<field name="has_peppol_participant" invisible="1"/>
<div id="account_peppol" class="mt-3">
<div class="col-12 col-lg-12 o_setting_box">
<field name="account_peppol_proxy_state" invisible="1"/>
<div class="o_setting_left_pane">
<field name="is_account_peppol_participant"
invisible="account_peppol_proxy_state != 'not_registered'"/>
</div>
<div class="o_setting_right_pane border-0">
<div invisible="account_peppol_proxy_state != 'not_registered'">
<label for="is_account_peppol_participant" string="Use PEPPOL Invoicing"/>
<span class="fa fa-lg fa-building-o" title="Values set here are company-specific."/>
<div class="text-muted">
Start sending and receiving documents via Peppol as soon as your registration is complete.
</div>
<div class="alert alert-warning mt-3"
role="alert"
invisible="not is_account_peppol_participant or not account_peppol_endpoint_warning">
<field name="account_peppol_endpoint_warning"/>
</div>
<div class="pt-3"
invisible="not is_account_peppol_participant">
<div class="row">
<label string="Peppol EAS"
for="account_peppol_eas"
class="col-lg-3 o_light_label"/>
<field name="account_peppol_eas"/>
</div>
<div class="row">
<label string="Peppol Endpoint"
for="account_peppol_eas"
class="col-lg-3 o_light_label"/>
<field name="account_peppol_endpoint"/>
</div>
</div>
</div>
<div class="row"
invisible="not is_account_peppol_participant or account_peppol_proxy_state not in ('not_registered', 'not_verified')">
<label string="Phone Number"
for="account_peppol_phone_number"
class="col-lg-3 o_light_label"/>
<field name="account_peppol_phone_number"
required="is_account_peppol_participant and account_peppol_proxy_state in ('not_registered', 'not_verified')"/>
</div>
<div class="row"
invisible="not is_account_peppol_participant or account_peppol_proxy_state in ('rejected', 'canceled', 'sent_verification')">
<label string="Primary contact email"
for="account_peppol_contact_email"
class="col-lg-3 o_light_label"/>
<field name="account_peppol_contact_email"
required="is_account_peppol_participant"/>
</div>
<div class="content-group pt-3"
invisible="account_peppol_proxy_state != 'not_registered' or not is_account_peppol_participant">
<span>
I want to migrate my Peppol connection to Odoo (optional):
</span>
<div class="row mt-3">
<label string="Migration key"
for="account_peppol_migration_key"
class="col-lg-3 o_light_label"/>
<field name="account_peppol_migration_key"/>
</div>
</div>
<div class="row mb-3"
invisible="not is_account_peppol_participant">
<div class="content-group mt-3"
invisible="account_peppol_proxy_state in ('rejected', 'not_registered', 'canceled', 'not_verified', 'sent_verification')">
<div class="row">
<label string="Incoming Invoices Journal"
for="account_peppol_purchase_journal_id"
class="col-lg-3 o_light_label"/>
<field name="account_peppol_purchase_journal_id"
required="is_account_peppol_participant and account_peppol_proxy_state not in ('rejected', 'not_registered', 'canceled', 'not_verified', 'sent_verification')"/>
</div>
</div>
<div class="content-group mt-3"
invisible="account_peppol_proxy_state != 'sent_verification'">
<span class="text-muted">
We sent a verification code to
<field name="account_peppol_phone_number"
nolabel="1"
readonly="is_account_peppol_participant and account_peppol_proxy_state == 'sent_verification'"/>.
</span>
<div class="row mt-1 ps-3">
<field name="account_peppol_verification_code" widget="verification_code"/>
</div>
</div>
<div class="pt-3 pb-3"
invisible="account_peppol_proxy_state == 'not_registered'">
Application status:
<b>
<field name="account_peppol_proxy_state"
class="oe_inline"
readonly="1"
decoration-danger="account_peppol_proxy_state == 'rejected'"
decoration-info="account_peppol_proxy_state == 'active'"/>
<span class="text-info" invisible="not account_peppol_edi_mode == 'demo'"> (Demo)</span>
<span class="text-info" invisible="not account_peppol_edi_mode == 'test'"> (Test)</span>
</b>
</div>
<div invisible="account_peppol_proxy_state != 'rejected'">
<p>
The rejection reason has been sent to you via email.
</p>
<p>
Please do not hesitate to contact our support if you need further assistance.
</p>
</div>
<div invisible="account_peppol_proxy_state != 'active' or not account_peppol_migration_key">
Your migration key is:
<field name="account_peppol_migration_key"
nolabel="1"
readonly="account_peppol_proxy_state == 'active' and account_peppol_migration_key"/>
</div>
<div invisible="account_peppol_proxy_state != 'active'">
Your Peppol identification is:
<field name="account_peppol_edi_identification"
nolabel="1"/>
</div>
<div class="mt-4" invisible="account_peppol_proxy_state != 'not_registered'">
<field name="account_peppol_mode_constraint" invisible="1"/>
<field name="account_peppol_edi_mode"
widget="account_peppol_radio_field"
class="o_field_radio"
readonly_items="account_peppol_mode_constraint != 'prod' and ['prod'] or []"
hidden_items="account_peppol_mode_constraint != 'test' and ['test'] or []"
options="{'horizontal': true }"/>
<div class="mb-3" invisible="not account_peppol_edi_mode == 'prod'">
By clicking the button below I accept that Odoo may process my e-invoices.
</div>
<div class="mb-3" invisible="not account_peppol_edi_mode == 'test'">
Test mode allows registration of the user on the test Peppol network.
By clicking the button below I accept that Odoo may process my e-invoices.
</div>
<div class="mb-3" invisible="not account_peppol_edi_mode == 'demo'">
In demo mode sending and receiving invoices is simulated. There will be no communication with the Peppol network.
</div>
</div>
<div class="d-flex gap-1 action_buttons" colspan="3">
<div class="mt-3"
invisible="account_peppol_proxy_state != 'not_verified'">
<button name="button_send_peppol_verification_code"
type="object"
string="Verify phone number"
class="btn btn-primary"/>
</div>
<widget name="peppol_settings_buttons"
invisible="account_peppol_proxy_state not in ('not_registered', 'sent_verification', 'pending', 'manually_approved', 'active')"/>
<div class="mt-3"
invisible="account_peppol_proxy_state in ('not_registered', 'active', 'rejected', 'canceled')">
<button name="button_cancel_peppol_registration"
type="object"
string="Cancel registration"
class="btn btn-secondary"/>
</div>
<div class="mt-3"
invisible="account_peppol_proxy_state != 'canceled' or account_peppol_migration_key">
<button name="button_reopen_peppol_registration"
type="object"
string="Retry registration"
class="btn btn-secondary"/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<field name="module_account_peppol" position="attributes">
<!-- When any company has Peppol enabled, we prevent users from accidentally uninstalling the module -->
<attribute name="readonly">has_peppol_participant</attribute>
</field>
</field>
</record>
</odoo>