[MOV] account_voucher: reorganize files according to guidelines

This commit is contained in:
fwi-odoo
2016-08-03 11:18:49 +02:00
committed by Thibault Delavallée
parent 1293509ad9
commit 9999e784a4
7 changed files with 175 additions and 177 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import account_voucher
import models
+2 -3
View File
@@ -30,10 +30,9 @@ This module manages:
'demo' : [],
'data' : [
'security/ir.model.access.csv',
'account_voucher_view.xml',
'voucher_sales_purchase_view.xml',
'views/account_voucher_views.xml',
'security/account_voucher_security.xml',
'account_voucher_data.xml',
'data/account_voucher_data.xml',
],
'test' : [
'test/account_voucher_users.yml',
@@ -1,173 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_voucher_tree">
<field name="name">account.voucher.tree</field>
<field name="model">account.voucher</field>
<field name="arch" type="xml">
<tree decoration-info="state == 'draft'" decoration-muted="state == 'cancel'" string="Voucher Entries">
<field name="date"/>
<field name="number"/>
<field name="partner_id" string="Customer"/>
<field name="voucher_type" invisible="context.get('visible', True)"/>
<field name="amount" sum="Total Amount"/>
<field name="currency_id" invisible="1"/>
<field name="state"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_voucher_tree_purchase">
<field name="name">account.voucher.tree.supplier</field>
<field name="model">account.voucher</field>
<field name="arch" type="xml">
<tree decoration-info="state == 'draft'" decoration-muted="state == 'cancel'" string="Voucher Entries" create="0" edit="0">
<field name="date"/>
<field name="number"/>
<field name="reference"/>
<field name="partner_id" string="Vendor"/>
<field name="voucher_type" invisible="context.get('visible', True)"/>
<field name="amount" sum="Total Amount"/>
<field name="currency_id" invisible="1"/>
<field name="state"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_voucher_kanban">
<field name="name">account.voucher.kanban</field>
<field name="model">account.voucher</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile">
<field name="number"/>
<field name="partner_id"/>
<field name="amount"/>
<field name="date"/>
<field name="state"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_global_click">
<div class="row">
<div class="col-xs-6">
<strong><span><t t-esc="record.partner_id.value"/></span></strong>
</div>
<div class="col-xs-6">
<strong><span class="pull-right text-right"><t t-esc="record.amount.value"/></span></strong>
</div>
</div>
<div class="row">
<div class="col-xs-6 text-muted">
<span><t t-esc="record.number.value"/> <t t-esc="record.date.value"/></span>
</div>
<div class="col-xs-6">
<span class="pull-right text-right">
<field name="state" widget="kanban_label_selection" options="{'classes': {'draft': 'default', 'cancel': 'default', 'none': 'danger', 'proforma': 'warning',
'posted': 'success'}}"/>
</span>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record model="ir.ui.view" id="view_voucher_line_form">
<field name="name">account.voucher.line.form</field>
<field name="model">account.voucher.line</field>
<field name="arch" type="xml">
<form string="Voucher Lines">
<group>
<group>
<field name="product_id"/>
<field name="quantity" class="oe_inline"/>
<field name="price_unit"/>
<field name="price_subtotal"/>
<field name="currency_id" invisible="1"/>
</group>
<group>
<field name="account_id"/>
<field name="tax_ids" widget="many2many_tags"/>
<field name="account_analytic_id" domain="[('company_id', '=', company_id)]" groups="analytic.group_analytic_accounting"/>
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
</group>
</group>
<label for="name"/>
<field name="name"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_voucher_line_tree">
<field name="name">account.voucher.line.tree</field>
<field name="model">account.voucher.line</field>
<field name="arch" type="xml">
<tree string="Voucher Lines" editable="bottom">
<field name="product_id"
on_change="product_id_change(product_id, parent.partner_id, price_unit, company_id, parent.currency_id, parent.voucher_type)" />
<field name="name"/>
<field name="account_id"/>
<field name="account_analytic_id" domain="[('company_id', '=', company_id)]" groups="analytic.group_analytic_accounting"/>
<field name="quantity"/>
<field name="price_unit"/>
<field name="tax_ids" widget="many2many_tags"/>
<field name="price_subtotal"/>
<field name="currency_id" invisible="1"/>
<field name="company_id" invisible="1"/>
</tree>
</field>
</record>
<record id="view_voucher_filter" model="ir.ui.view">
<field name="name">account.voucher.select</field>
<field name="model">account.voucher</field>
<field name="priority">1</field>
<field name="arch" type="xml">
<search string="Search Vouchers">
<field name="number" string="Voucher"/>
<field name="date"/>
<filter string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
<filter string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
<separator/>
<filter string="To Review" domain="[('state','=','posted')]" help="To Review"/>
<field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" /> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
<group expand="0" string="Group By">
<filter string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Journal" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Date" domain="[]" context="{'group_by':'date','visible':True}"/>
<filter string="Status" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
<record id="account_cash_statement_graph" model="ir.ui.view">
<field name="name">account.voucher.graph</field>
<field name="model">account.voucher</field>
<field name="arch" type="xml">
<graph string="Voucher Statistics" type="bar">
<field name="date"/>
<field name="amount" operator="+"/>
</graph>
</field>
</record>
<act_window
id="act_journal_voucher_open"
name="Voucher Entries"
context="{'search_default_journal_id': active_id, 'default_journal_id': active_id}"
res_model="account.voucher"
src_model="account.journal"/>
<record model="ir.actions.act_window" id="action_review_voucher_list">
<field name="name">Vouchers Entries</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('state','=','posted')]</field>
<field name="context">{'state':'posted', 'voucher_type': voucher_type}</field>
<field name="search_view_id" ref="view_voucher_filter"/>
</record>
</data>
</openerp>
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import account_voucher
@@ -1,6 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_voucher_tree">
<field name="name">account.voucher.tree</field>
<field name="model">account.voucher</field>
<field name="arch" type="xml">
<tree decoration-info="state == 'draft'" decoration-muted="state == 'cancel'" string="Voucher Entries">
<field name="date"/>
<field name="number"/>
<field name="partner_id" string="Customer"/>
<field name="voucher_type" invisible="context.get('visible', True)"/>
<field name="amount" sum="Total Amount"/>
<field name="currency_id" invisible="1"/>
<field name="state"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_voucher_tree_purchase">
<field name="name">account.voucher.tree.supplier</field>
<field name="model">account.voucher</field>
<field name="arch" type="xml">
<tree decoration-info="state == 'draft'" decoration-muted="state == 'cancel'" string="Voucher Entries" create="0" edit="0">
<field name="date"/>
<field name="number"/>
<field name="reference"/>
<field name="partner_id" string="Vendor"/>
<field name="voucher_type" invisible="context.get('visible', True)"/>
<field name="amount" sum="Total Amount"/>
<field name="currency_id" invisible="1"/>
<field name="state"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_voucher_kanban">
<field name="name">account.voucher.kanban</field>
<field name="model">account.voucher</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile">
<field name="number"/>
<field name="partner_id"/>
<field name="amount"/>
<field name="date"/>
<field name="state"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_global_click">
<div class="row">
<div class="col-xs-6">
<strong><span><t t-esc="record.partner_id.value"/></span></strong>
</div>
<div class="col-xs-6">
<strong><span class="pull-right text-right"><t t-esc="record.amount.value"/></span></strong>
</div>
</div>
<div class="row">
<div class="col-xs-6 text-muted">
<span><t t-esc="record.number.value"/> <t t-esc="record.date.value"/></span>
</div>
<div class="col-xs-6">
<span class="pull-right text-right">
<field name="state" widget="kanban_label_selection" options="{'classes': {'draft': 'default', 'cancel': 'default', 'none': 'danger', 'proforma': 'warning',
'posted': 'success'}}"/>
</span>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record model="ir.ui.view" id="view_voucher_line_form">
<field name="name">account.voucher.line.form</field>
<field name="model">account.voucher.line</field>
<field name="arch" type="xml">
<form string="Voucher Lines">
<group>
<group>
<field name="product_id"/>
<field name="quantity" class="oe_inline"/>
<field name="price_unit"/>
<field name="price_subtotal"/>
<field name="currency_id" invisible="1"/>
</group>
<group>
<field name="account_id"/>
<field name="tax_ids" widget="many2many_tags"/>
<field name="account_analytic_id" domain="[('company_id', '=', company_id)]" groups="analytic.group_analytic_accounting"/>
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
</group>
</group>
<label for="name"/>
<field name="name"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_voucher_line_tree">
<field name="name">account.voucher.line.tree</field>
<field name="model">account.voucher.line</field>
<field name="arch" type="xml">
<tree string="Voucher Lines" editable="bottom">
<field name="product_id"
on_change="product_id_change(product_id, parent.partner_id, price_unit, company_id, parent.currency_id, parent.voucher_type)" />
<field name="name"/>
<field name="account_id"/>
<field name="account_analytic_id" domain="[('company_id', '=', company_id)]" groups="analytic.group_analytic_accounting"/>
<field name="quantity"/>
<field name="price_unit"/>
<field name="tax_ids" widget="many2many_tags"/>
<field name="price_subtotal"/>
<field name="currency_id" invisible="1"/>
<field name="company_id" invisible="1"/>
</tree>
</field>
</record>
<record id="view_voucher_filter" model="ir.ui.view">
<field name="name">account.voucher.select</field>
<field name="model">account.voucher</field>
<field name="priority">1</field>
<field name="arch" type="xml">
<search string="Search Vouchers">
<field name="number" string="Voucher"/>
<field name="date"/>
<filter string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
<filter string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
<separator/>
<filter string="To Review" domain="[('state','=','posted')]" help="To Review"/>
<field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" /> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
<group expand="0" string="Group By">
<filter string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Journal" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Date" domain="[]" context="{'group_by':'date','visible':True}"/>
<filter string="Status" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
<record id="account_cash_statement_graph" model="ir.ui.view">
<field name="name">account.voucher.graph</field>
<field name="model">account.voucher</field>
<field name="arch" type="xml">
<graph string="Voucher Statistics" type="bar">
<field name="date"/>
<field name="amount" operator="+"/>
</graph>
</field>
</record>
<act_window
id="act_journal_voucher_open"
name="Voucher Entries"
context="{'search_default_journal_id': active_id, 'default_journal_id': active_id}"
res_model="account.voucher"
src_model="account.journal"/>
<record model="ir.actions.act_window" id="action_review_voucher_list">
<field name="name">Vouchers Entries</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('state','=','posted')]</field>
<field name="context">{'state':'posted', 'voucher_type': voucher_type}</field>
<field name="search_view_id" ref="view_voucher_filter"/>
</record>
<record id="view_voucher_filter_vendor" model="ir.ui.view">
<field name="name">account.voucher.purchase.select</field>
<field name="model">account.voucher</field>