Files
odoo_source/addons/payment/views/payment_views.xml
T
qsm-odoo 250e716c3a [REF] web, *: restore views design
Since the new views merge, a lot of design elements were broken. This
was particularly impacting the fields in the editable list view; indeed
the editable list view is not using an inline form view anymore so the
fields in the list were not properly styled as the LESS was still
defined assuming the form view environment (for example the invalid
fields were red for o2m fields in form view but not in editable list
view even though they got the right CSS class).

This commit refactor the LESS following these rules:
- No more division of non-layout and layout rules. Dividing LESS rules
  in x_layout.less and x.less was a mistake. Many rules can be
  considered to be layout and not layout at the same time, developers
  always have to switch from one file part to the other, many CSS
  selectors (and rules!) are duplicated for nothing, ...
- Field style is extracted from x_view.less and put in the new
  fields.less file. As before, the fields_extra.less will contain the
  rules specific to community so that the enterprise repo can override
  those by replacing the whole file.
- Many classes have been renamed so that o_form_x_y becomes o_x_y as
  many classes can now be applied outside of form view. These classes
  should not be used in templates anyway.

The commit also changes the DOM of fields so that it is more minimalist
(no useless parent div, etc).

Input elements are not automatically styled anymore, they have to get
the o_input class explicitely. This allows to fix lots of small style
bugs of previous versions (required monetary field had not the proper
style, readonly m2m tags appeared as editable, ...). This also improves
the LESS code.

The editable list view should also completely stop flickering on chrome
and firefox.

The commit also removes the orange outline on list view dirty cells.

The commit also removes deprecated static xml, LESS and other code.

Notice there are still styles to restore/fix and LESS to improve.
2017-05-04 12:07:30 +02:00

377 lines
20 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Payment menu in settings -->
<menuitem
name='Payments'
id='root_payment_menu'
parent='account.menu_finance_configuration'/>
<!-- Payment acquirers -->
<record id="payment_transaction_action_child" model="ir.actions.act_window">
<field name="name">Payment Transactions</field>
<field name="res_model">payment.transaction</field>
<field name='view_type'>form</field>
<field name='view_mode'>tree,form</field>
<field name='domain'>[('acquirer_id','=',active_id)]</field>
<field name="context">{'default_acquirer_id': active_id}</field>
</record>
<record id="acquirer_form" model="ir.ui.view">
<field name="name">payment.acquirer.form</field>
<field name="model">payment.acquirer</field>
<field name="arch" type="xml">
<form string="Payment Acquirer">
<field name="environment" invisible='1'/>
<field name="fees_implemented" invisible='1'/>
<field name="token_implemented" invisible='1'/>
<sheet>
<field name="module_id" invisible="1"/>
<field name="module_state" invisible="1"/>
<div class="oe_button_box" name="button_box" attrs="{'invisible': ['&amp;', ('module_id', '!=', False), ('module_state', '!=', 'installed')]}">
<button attrs="{'invisible': [('environment', '=', 'test')]}" class="oe_stat_button" name="toggle_enviroment_value" type="object" icon="fa-play">
<div class="o_stat_info o_field_widget">
<span class="text-success">Production</span>
<span class="o_stat_text">Environment</span>
</div>
</button>
<button attrs="{'invisible': [('environment', '=', 'prod')]}" class="oe_stat_button" name="toggle_enviroment_value" type="object" icon="fa-stop">
<div class="o_stat_info o_field_widget">
<span class="o_warning_text">Test</span>
<span class="o_stat_text">Environment</span>
</div>
</button>
<button class="oe_stat_button" name="%(payment_transaction_action_child)d"
type="action" icon="fa-money" string="Payments">
</button>
</div>
<field name="image" widget='image' class="oe_avatar" options='{"preview_image": "image_medium"}'/>
<div class="oe_title">
<h1><field name="name" placeholder="Name"/></h1>
</div>
<div attrs="{'invisible': ['|', ('module_state', '=', 'installed'), ('module_id', '=', False)]}">
<button type="object" class="btn btn-primary" name="button_immediate_install" string="Install"/>
<div class="o_payment_acquirer_desc">
<field name="description"/>
</div>
</div>
<group name="acquirer_base" col="2" attrs="{'invisible': ['&amp;', ('module_id', '!=', False), ('module_state', '!=', 'installed')]}">
<group name="acquirer_left">
<field name="provider" groups="base.group_no_one"/>
<field name="company_id" groups="base.group_multi_company" options='{"no_open":True}'/>
</group>
</group>
<notebook attrs="{'invisible': ['&amp;', ('module_id', '!=', False), ('module_state', '!=', 'installed')]}">
<page string="Credentials">
<group name="acquirer">
</group>
</page>
<page string="Messages">
<group>
<field name="pre_msg"/>
<field name="post_msg"/>
<field name="pending_msg"/>
<field name="done_msg"/>
<field name="cancel_msg"/>
<field name="error_msg"/>
</group>
</page>
<page string="Configuration">
<group name="acquirer_config">
<field name="auto_confirm" widget="radio"/>
<field name="save_token" widget="radio" attrs="{'invisible': [('token_implemented', '=', False)]}"/>
<field name="journal_id" attrs="{'required': [('auto_confirm', '=', 'generate_and_pay_invoice')], 'invisible': [('auto_confirm', '!=', 'generate_and_pay_invoice')]}"/>
<field name="country_ids" widget="many2many_tags"/>
<label for="view_template_id" groups="base.group_no_one"/>
<div groups="base.group_no_one">
<field name="view_template_id" nolabel="1"/>
<div>
This template renders the acquirer button with all necessary values.
It is rendered with qWeb with the following evaluation context:
<ul>
<li>tx_url: transaction URL to post the form</li>
<li>acquirer: payment.acquirer browse record</li>
<li>user: current user browse record</li>
<li>reference: the transaction reference number</li>
<li>currency: the transaction currency browse record</li>
<li>amount: the transaction amount, a float</li>
<li>partner: the buyer partner browse record, not necessarily set</li>
<li>partner_values: specific values about the buyer, for example coming from a shipping form</li>
<li>tx_values: transaction values</li>
<li>context: the current context dictionary</li>
</ul>
</div>
</div>
<field name="registration_view_template_id" groups="base.group_no_one"/>
</group>
<group name="fees_config" attrs="{'invisible': [('fees_implemented', '=', False)]}">
<field name="fees_active"/>
<field name="fees_dom_fixed" attrs="{'invisible': [('fees_active', '=', False)]}"/>
<field name="fees_dom_var" attrs="{'invisible': [('fees_active', '=', False)]}"/>
<field name="fees_int_fixed" attrs="{'invisible': [('fees_active', '=', False)]}"/>
<field name="fees_int_var" attrs="{'invisible': [('fees_active', '=', False)]}"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<!-- Acquirer Kanban View -->
<record id="acquirer_kanban" model="ir.ui.view">
<field name="name">payment.acquirer.kanban</field>
<field name="model">payment.acquirer</field>
<field name="arch" type="xml">
<kanban quick_create="false" create="true" class="o_kanban_payment_acquirer">
<field name="id"/>
<field name="name"/>
<field name="description"/>
<field name="environment"/>
<field name="provider"/>
<field name="module_id"/>
<field name="module_state"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<t t-set="installed" t-value="!record.module_id.value || (record.module_id.value &amp;&amp; record.module_state.raw_value === 'installed')"/>
<div class="o_kanban_image">
<img type="open" t-att-src="kanban_image('payment.acquirer', 'image_small', record.id.value)"/>
</div>
<div class="o_payment_acquirer_desc">
<h3 class="mt4"><t t-esc="record.name.value"/></h3>
<t t-if="record.description.raw_value" t-raw="record.description.raw_value"/>
</div>
<div class="o_payment_acquirer_bottom">
<t t-if="installed">
<field name="environment" widget="label_selection" options="{'classes': {'test': 'warning', 'production': 'success'}}"/>
</t>
<button t-if="!installed" type="object" class="btn btn-default pull-right btn-sm" name="button_immediate_install">Install</button>
<button t-if="installed" type="edit" class="btn btn-primary pull-right btn-sm">Configure</button>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="acquirer_list" model="ir.ui.view">
<field name="name">payment.acquirer.list</field>
<field name="model">payment.acquirer</field>
<field name="arch" type="xml">
<tree string="Payment Acquirers">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="provider"/>
<field name="environment"/>
</tree>
</field>
</record>
<record id="acquirer_search" model="ir.ui.view">
<field name="name">payment.acquirer.search</field>
<field name="model">payment.acquirer</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<field name="provider"/>
<group expand="0" string="Group By">
<filter string="Provider" name="provider" domain="[]" context="{'group_by': 'provider'}"/>
<filter string="Environment" name="environment" domain="[]" context="{'group_by': 'environment'}"/>
</group>
</search>
</field>
</record>
<record id="action_payment_acquirer" model="ir.actions.act_window">
<field name="name">Payment Acquirers</field>
<field name="res_model">payment.acquirer</field>
<field name='view_type'>form</field>
<field name='view_mode'>kanban,tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a payment acquirer.
</p>
</field>
</record>
<menuitem
action='action_payment_acquirer'
id='payment_acquirer_menu'
parent='root_payment_menu'
sequence='10' />
<!-- Payment transactions -->
<record id="transaction_form" model="ir.ui.view">
<field name="name">payment.transaction.form</field>
<field name="model">payment.transaction</field>
<field name="arch" type="xml">
<form string="Payment Transactions">
<header>
<button type="object" name="action_capture" states="authorized" string="Capture Transaction" class="oe_highlight"/>
<button type="object" name="action_void" states="authorized" string="Void Transaction"/>
<field name="state" widget="statusbar" clickable="True"/>
</header>
<sheet>
<group>
<group>
<field name="reference"/>
<label for="amount"/>
<div class="o_row">
<field name="amount"/>
<field name="currency_id" options="{'no_open': True, 'no_create': True}"/>
</div>
<field name="fees"/>
<field name="partner_id"/>
<label for="partner_details" string="Customer Details"/>
<div>
<div name="partner_details" class="o_address_format">
<field name="partner_name" placeholder="Name" attrs="{'readonly': [('partner_id', '!=', False)]}" class="o_address_street"/>
<field name="partner_address" placeholder="Address" attrs="{'readonly': [('partner_id', '!=', False)]}" class="o_address_street"/>
<field name="partner_city" placeholder="City" attrs="{'readonly': [('partner_id', '!=', False)]}" class="o_address_city"/>
<field name="partner_zip" placeholder="ZIP" attrs="{'readonly': [('partner_id', '!=', False)]}" class="o_address_zip"/>
<field name="partner_country_id" placeholder="Country" attrs="{'readonly': [('partner_id', '!=', False)]}" class="o_address_country"/>
<field name="partner_lang" attrs="{'readonly': [('partner_id', '!=', False)]}" class="o_address_street"/>
<field name="partner_email" placeholder="E-mail" attrs="{'readonly': [('partner_id', '!=', False)]}" class="o_address_street"/>
</div>
</div>
</group>
<group>
<field name="acquirer_id"/>
<field name="payment_token_id"/>
<field name="acquirer_reference"/>
<field name="create_date"/>
<field name="date_validate"/>
</group>
</group>
<group string="Message">
<field name="state_message" nolabel="1"/>
</group>
<notebook>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="transaction_list" model="ir.ui.view">
<field name="name">payment.transaction.list</field>
<field name="model">payment.transaction</field>
<field name="arch" type="xml">
<tree string="Payment Transactions">
<field name="reference"/>
<field name="create_date"/>
<field name="acquirer_id"/>
<field name="partner_id"/>
<field name="partner_name"/>
<field name="amount"/>
<field name="fees"/>
<field name="state"/>
</tree>
</field>
</record>
<record id="transaction" model="ir.ui.view">
<field name="name">payment.transaction.search</field>
<field name="model">payment.transaction</field>
<field name="arch" type="xml">
<search>
<field name="reference"/>
<field name="acquirer_id"/>
<field name="partner_id"/>
<field name="partner_name"/>
</search>
</field>
</record>
<record id="action_payment_transaction" model="ir.actions.act_window">
<field name="name">Payment Transactions</field>
<field name="res_model">payment.transaction</field>
<field name='view_type'>form</field>
<field name='view_mode'>tree,form</field>
</record>
<menuitem
action='action_payment_transaction'
id='payment_transaction_menu'
parent='root_payment_menu'
sequence='20' />
<!-- Payment Tokens -->
<record model='ir.ui.view' id='payment_token_tree_view'>
<field name='name'>payment.token.tree</field>
<field name='model'>payment.token</field>
<field name='arch' type='xml'>
<tree string='Payment Tokens'>
<field name="name"/>
<field name="active"/>
<field name='partner_id' />
<field name='acquirer_id' readonly='1'/>
<field name='acquirer_ref' readonly='1'/>
</tree>
</field>
</record>
<record id='payment_token_view_search' model='ir.ui.view'>
<field name='name'>payment.token.search</field>
<field name='model'>payment.token</field>
<field name='arch' type='xml'>
<search string='Payment Tokens'>
<field name='partner_id'/>
</search>
</field>
</record>
<record id="action_payment_tx_ids" model="ir.actions.act_window">
<field name="name">Payment Transactions</field>
<field name="res_model">payment.transaction</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('payment_token_id','=', active_id)]</field>
<field name="context">{'create': False}</field>
</record>
<record model='ir.ui.view' id='payment_token_form_view'>
<field name='name'>payment.token.form</field>
<field name='model'>payment.token</field>
<field name='arch' type='xml'>
<form string='Payment Tokens' create='false' editable='bottom'>
<sheet>
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button" name="%(action_payment_tx_ids)d"
type="action" icon="fa-money" string="Payments">
</button>
</div>
<group>
<field name="name"/>
<field name='partner_id' />
</group>
<group>
<field name="active"/>
<field name='acquirer_id'/>
<field name='acquirer_ref'/>
</group>
</sheet>
</form>
</field>
</record>
<record model='ir.actions.act_window' id='payment_token_action'>
<field name='name'>Saved Payment Data</field>
<field name='res_model'>payment.token</field>
<field name='view_type'>form</field>
<field name='view_mode'>tree,form</field>
</record>
<menuitem
action='payment_token_action'
id='payment_token_menu'
parent='root_payment_menu'
groups='base.group_no_one'/>
</data>
</odoo>