Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
125
account_global_discount/views/account_invoice_views.xml
Normal file
125
account_global_discount/views/account_invoice_views.xml
Normal file
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Copyright 2019 Tecnativa - David Vidal
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
<record id="view_move_form" model="ir.ui.view">
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='invoice_payment_term_id']/.." position="after">
|
||||
<field
|
||||
name="global_discount_ids"
|
||||
widget="many2many_tags"
|
||||
placeholder="Discounts..."
|
||||
readonly="state != 'draft'"
|
||||
groups="base_global_discount.group_global_discount"
|
||||
/>
|
||||
<field
|
||||
string="Invoice Global Discounts"
|
||||
name="global_discount_ids_readonly"
|
||||
widget="many2many_tags"
|
||||
readonly="1"
|
||||
groups="!base_global_discount.group_global_discount"
|
||||
/>
|
||||
</xpath>
|
||||
<field name="tax_totals" position="before">
|
||||
<field
|
||||
name="amount_untaxed_before_global_discounts"
|
||||
string="Untaxed Amount Before Disc."
|
||||
invisible="not global_discount_ids or not invoice_global_discount_ids"
|
||||
groups="base_global_discount.group_global_discount"
|
||||
/>
|
||||
<field
|
||||
name="amount_untaxed_before_global_discounts"
|
||||
string="Untaxed Amount Before Disc."
|
||||
invisible="not global_discount_ids_readonly or not invoice_global_discount_ids"
|
||||
groups="!base_global_discount.group_global_discount"
|
||||
/>
|
||||
<field
|
||||
name="amount_global_discount"
|
||||
string="Global Discounts"
|
||||
invisible="not global_discount_ids or not invoice_global_discount_ids"
|
||||
groups="base_global_discount.group_global_discount"
|
||||
/>
|
||||
<field
|
||||
name="amount_global_discount"
|
||||
string="Global Discounts"
|
||||
invisible="not global_discount_ids_readonly or not invoice_global_discount_ids"
|
||||
groups="!base_global_discount.group_global_discount"
|
||||
/>
|
||||
</field>
|
||||
<field name="tax_totals" position="attributes">
|
||||
<attribute
|
||||
name="class"
|
||||
add="oe_subtotal_footer_separator"
|
||||
separator=" "
|
||||
/>
|
||||
</field>
|
||||
<page id="other_tab" position="inside">
|
||||
<separator string="Global Discounts" />
|
||||
<field
|
||||
name="invoice_global_discount_ids"
|
||||
nolabel="1"
|
||||
readonly="1"
|
||||
invisible="not global_discount_ids"
|
||||
force_save="1"
|
||||
groups="base_global_discount.group_global_discount"
|
||||
>
|
||||
<list create="0" delete="0">
|
||||
<field name="name" />
|
||||
<field
|
||||
name="base"
|
||||
widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"
|
||||
/>
|
||||
<field name="discount_display" />
|
||||
<field name="discount_amount" />
|
||||
<field
|
||||
name="base_discounted"
|
||||
widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"
|
||||
/>
|
||||
<field name="account_id" />
|
||||
<field name="tax_ids" widget="many2many_tags" />
|
||||
<field
|
||||
domain="[('company_id', '=', company_id)]"
|
||||
name="account_analytic_id"
|
||||
groups="analytic.group_analytic_accounting"
|
||||
/>
|
||||
</list>
|
||||
</field>
|
||||
<field
|
||||
name="invoice_global_discount_ids"
|
||||
nolabel="1"
|
||||
readonly="1"
|
||||
invisible="not global_discount_ids_readonly"
|
||||
force_save="1"
|
||||
groups="!base_global_discount.group_global_discount"
|
||||
>
|
||||
<list create="0" delete="0">
|
||||
<field name="name" />
|
||||
<field
|
||||
name="base"
|
||||
widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"
|
||||
/>
|
||||
<field name="discount_display" />
|
||||
<field name="discount_amount" />
|
||||
<field
|
||||
name="base_discounted"
|
||||
widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"
|
||||
/>
|
||||
<field name="account_id" />
|
||||
<field name="tax_ids" widget="many2many_tags" />
|
||||
<field
|
||||
domain="[('company_id', '=', company_id)]"
|
||||
name="account_analytic_id"
|
||||
groups="analytic.group_analytic_accounting"
|
||||
/>
|
||||
</list>
|
||||
</field>
|
||||
</page>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
48
account_global_discount/views/global_discount_views.xml
Normal file
48
account_global_discount/views/global_discount_views.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Copyright 2019 Tecnativa - David Vidal
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
<record id="global_discount_view_tree" model="ir.ui.view">
|
||||
<field name="model">global.discount</field>
|
||||
<field name="inherit_id" ref="base_global_discount.global_discount_view_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="company_id" position="before">
|
||||
<field
|
||||
name="account_id"
|
||||
required="1"
|
||||
domain="[('company_ids', 'in', [company_id])]"
|
||||
/>
|
||||
<field
|
||||
domain="['|', ('company_id', '=', company_id), ('company_id', '=', False)]"
|
||||
name="account_analytic_id"
|
||||
groups="analytic.group_analytic_accounting"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
<record id="global_discount_view_form" model="ir.ui.view">
|
||||
<field name="model">global.discount</field>
|
||||
<field name="inherit_id" ref="base_global_discount.global_discount_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="company_id" position="before">
|
||||
<field
|
||||
name="account_id"
|
||||
required="1"
|
||||
domain="[('company_ids', 'in', [company_id])]"
|
||||
/>
|
||||
<field
|
||||
domain="['|', ('company_id', '=', company_id), ('company_id', '=', False)]"
|
||||
name="account_analytic_id"
|
||||
groups="analytic.group_analytic_accounting"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
<menuitem
|
||||
id="menu_account_global_discount"
|
||||
action="base_global_discount.action_global_discount_tree"
|
||||
name="Global Discounts"
|
||||
groups="base_global_discount.group_global_discount"
|
||||
parent="account.account_management_menu"
|
||||
/>
|
||||
</odoo>
|
||||
35
account_global_discount/views/report_account_invoice.xml
Normal file
35
account_global_discount/views/report_account_invoice.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
|
||||
<xpath expr="//t[@t-call='account.document_tax_totals']" position="before">
|
||||
<t t-if="o.global_discount_ids">
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Subtotal w/o disc.</strong>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<span
|
||||
t-field="o.amount_untaxed_before_global_discounts"
|
||||
t-options='{"widget": "monetary", "display_currency": o.currency_id}'
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="border-bottom:1px solid #dddddd;">
|
||||
<td>
|
||||
<strong>Global Discounts</strong>
|
||||
<br />
|
||||
<t
|
||||
t-esc="'→'.join(['{:.2f}%'.format(x.discount) for x in o.global_discount_ids])"
|
||||
/>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<span
|
||||
t-field="o.amount_global_discount"
|
||||
t-options='{"widget": "monetary", "display_currency": o.currency_id}'
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user