OCA/l10n-italy

View on GitHub
l10n_it_withholding_tax/views/withholding_tax.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="utf-8"?>
<openerp>

    <data>

        <menuitem id="of_wt_main"
                  name="Withholding tax"
                  parent="account.menu_finance"
                  sequence="5" />

        <!--
        WITHHOLDING TAX
         -->
        <record id="view_withholding_tax_tree" model="ir.ui.view">
            <field name="name">view.withholding.tax.tree</field>
            <field name="model">withholding.tax</field>
            <field name="arch" type="xml">
                <tree string="Withholding Tax">
                    <field name="name"/>
                    <field name="code"/>
                    <field name="tax"/>
                    <field name="base"/>
                    <field name="certification"/>
                    <field name="active"/>
                    <field name="comment"/>
                </tree>
            </field>
        </record>

        <record id="view_withholding_tax_form" model="ir.ui.view">
            <field name="name">view.withholding.tax.form</field>
            <field name="model">withholding.tax</field>
            <field name="arch" type="xml">
                <form string="Withholding Tax">
                    <sheet>
                        <group>
                            <group>
                                <field name="name"/>
                                <field name="code"/>
                                <field name="journal_id"/>
                                <field name="account_receivable_id"/>
                                <field name="account_payable_id"/>
                                <field name="payment_term"/>
                                <field name="use_daticassaprev" attrs="{'invisible': [('wt_types', 'in', ('ritenuta', 'other'))]}"/>
                                <field name="daticassprev_tax_id" domain="[('amount', '=', 0.0)]" attrs="{'invisible': [('use_daticassaprev', '=', False)]}"/>
                                <field name="wt_types" widget='radio'/>
                            </group>
                            <group>
                                <field name="certification"/>
                                <field name="active"/>
                                <field name="company_id"/>
                            </group>
                        </group>
                        <field name="comment"/>
                        <newline/>
                        <group string="Rates">
                            <field name="rate_ids" nolabel="1">
                                <tree>
                                    <field name="base"/>
                                    <field name="tax"/>
                                    <field name="date_start"/>
                                    <field name="date_stop"/>
                                </tree>
                                <form>
                                    <group>
                                        <group>
                                            <field name="tax"/>
                                        </group>
                                        <group>
                                            <field name="base"/>
                                        </group>
                                        <newline/>
                                        <group>
                                            <field name="date_start"/>
                                            <field name="date_stop"/>
                                        </group>
                                    </group>
                                </form>
                            </field>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>

        <record id="withholding_tax_search_view" model="ir.ui.view">
            <field name="name">withholding.tax.search.view</field>
            <field name="model">withholding.tax</field>
            <field name="arch" type="xml">
                <search string="Withholding Tax">
                    <field name="code" />
                    <field name="name" />
                    <field name="payment_term" />
                    <field name="account_payable_id" />
                    <field name="account_receivable_id" />
                    <field name="company_id" />

                    <filter string="Certificated" domain="[('certification','=',True)]" name="certification_true"/>
                    <filter string="Not Certificated" domain="[('certification','=',False)]" name="certification_false"/>
                    <separator/>

                    <group string="Group By...">
                        <filter string="Partners" context="{'group_by':'partner_id'}" name="group_by_partner_id"/>
                        <!--<filter string="Journal" context="{'group_by':'journal_id'}" name="group_by_journal_id"/>-->
                        <filter string="Company" context="{'group_by':'company_id'}" name="group_by_company_id"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="action_withholding_tax" model="ir.actions.act_window">
            <field name="name">Withholding Tax</field>
            <field name="res_model">withholding.tax</field>
            <field name="view_id" ref="view_withholding_tax_tree"/>
        </record>

        <menuitem id="menu_withholding_tax"
                  name="Withholding Tax"
                  action="action_withholding_tax"
                  parent="account.menu_finance_configuration"
                  sequence="45"/>


        <!--
        WITHHOLDING TAX STATEMENT
         -->
        <record id="view_withholding_statement_tree" model="ir.ui.view">
            <field name="name">view.withholding.tax.statement.tree</field>
            <field name="model">withholding.tax.statement</field>
            <field name="arch" type="xml">
                <tree string="Withholding Tax statement" version="7.0">
                    <field name="partner_id"/>
                    <field name="date"/>
                    <field name="move_id"/>
                    <field name="invoice_id"/>
                    <field name="withholding_tax_id"/>
                    <field name="base" sum="Tot Base"/>
                    <field name="tax"/>
                    <field name="amount" sum="Tot Amount"/>
                    <field name="amount_paid" sum="Tot Amount Paid"/>
                </tree>
            </field>
        </record>

        <record id="view_withholding_statement_form" model="ir.ui.view">
            <field name="name">view.withholding.tax.statement.form</field>
            <field name="model">withholding.tax.statement</field>
            <field name="arch" type="xml">
                <form string="Withholding Tax statement" version="7.0">
                    <group>
                        <group>
                            <field name="partner_id"/>
                            <field name="withholding_tax_id"/>
                            <field name="base"/>
                            <field name="tax"/>
                        </group>
                        <group>
                            <field name="date"/>
                            <field name="move_id"/>
                            <field name="invoice_id"/>
                        </group>
                    </group>
                    <newline/>
                    <group>
                        <field name="move_ids" nolabel="1">
                            <tree>
                                <field name="date"/>
                                <field name="withholding_tax_id"/>
                                <field name="date_maturity"/>
                                <field name="amount"/>
                                <field name="state"/>
                            </tree>
                        </field>
                    </group>
                </form>
            </field>
        </record>

        <record id="view_withholding_tax_statement_search" model="ir.ui.view">
            <field name="name">view.withholding.tax.statement.search</field>
            <field name="model">withholding.tax.statement</field>
            <field name="arch" type="xml">
                <search string="Withholding Tax Statement">
                    <field name="partner_id" filter_domain="[('partner_id','ilike',self)]"/>
                    <field name="withholding_tax_id" filter_domain="[('withholding_tax_id','ilike',self)]"/>
                    <group expand="0" string="Group By...">
                        <filter string="Partners" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
                        <filter string="Withholding Tax" icon="terp-personal" domain="[]" context="{'group_by':'withholding_tax_id'}"/>
                        <filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="action_withholding_tax_statement" model="ir.actions.act_window">
            <field name="name">Withholding Tax Statement</field>
            <field name="res_model">withholding.tax.statement</field>
            <field name="view_id" ref="view_withholding_statement_tree"/>
            <field name="search_view_id" ref="view_withholding_tax_statement_search" />
        </record>

        <menuitem id="menu_withholding_tax_statement" name="WT Statements"
            action="action_withholding_tax_statement" parent="of_wt_main" sequence="5"/>

        <!--
        WITHHOLDING TAX MOVE
        -->
        <record id="view_withholding_move_tree" model="ir.ui.view">
            <field name="name">view.withholding.tax.move.tree</field>
            <field name="model">withholding.tax.move</field>
            <field name="arch" type="xml">
                <tree string="Withholding Tax Move" version="7.0">
                    <field name="partner_id"/>
                    <field name="date"/>
                    <field name="withholding_tax_id"/>
                    <field name="date_maturity"/>
                    <field name="amount" sum="Tot"/>
                    <field name="account_move_id"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>

        <record id="view_withholding_move_form" model="ir.ui.view">
            <field name="name">view.withholding.tax.move.form</field>
            <field name="model">withholding.tax.move</field>
            <field name="arch" type="xml">
                <form string="Withholding Tax Move" version="7.0">
                    <header>
                        <button name="action_set_to_draft" states="paid" string="Set to Draft" type="object" />
                        <button name="action_paid" states="due" string="Paid" type="object" />
                        <field name="state" widget="statusbar" statusbar_visible="due,paid"/>
                    </header>
                    <sheet string="Withholding Tax Move">
                        <group>
                            <group>
                                <field name="partner_id"/>
                                <field name="date"/>
                                <field name="date_maturity"/>
                            </group>
                        </group>
                        <newline/>
                        <group>
                            <group>
                                <field name="withholding_tax_id"/>
                                <field name="amount"/>
                            </group>
                            <group>
                                <field name="account_move_id"/>
                            </group>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>

        <record id="view_withholding_move_search" model="ir.ui.view">
            <field name="name">view.withholding.tax.move.search</field>
            <field name="model">withholding.tax.move</field>
            <field name="arch" type="xml">
                <search string="Withholding Tax Move">
                    <filter name="due" string="Due" domain="[('state','=','due')]" help="Due"/>
                    <filter name="paid" string="Paid" domain="[('state','=','paid')]" help="Paid"/>
                    <field name="partner_id" filter_domain="[('partner_id','ilike',self)]"/>
                    <field name="withholding_tax_id" filter_domain="[('withholding_tax_id','ilike',self)]"/>
                    <group expand="0" string="Group By...">
                        <filter string="Partners" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
                        <filter string="Withholding Tax" icon="terp-personal" domain="[]" context="{'group_by':'withholding_tax_id'}"/>
                        <filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
                        <filter string="Date Maturity" icon="terp-go-month" domain="[]" context="{'group_by':'date_maturity'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="action_withholding_tax_move" model="ir.actions.act_window">
            <field name="name">Withholding Tax Move</field>
            <field name="res_model">withholding.tax.move</field>
            <field name="view_id" ref="view_withholding_move_tree"/>
            <field name="search_view_id" ref="view_withholding_move_search" />
        </record>

        <menuitem id="menu_withholding_tax_move"
                  name="WT Moves"
                  action="action_withholding_tax_move"
                  parent="of_wt_main"
                  sequence="10"/>
    </data>
</openerp>