-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] account_ux: added l10n_ar_ux report
closes #541 Related: ingadhoc/odoo-argentina#880 Signed-off-by: rov-adhoc <[email protected]>
- Loading branch information
Showing
6 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
############################################################################## | ||
# For copyright and license notices, see __manifest__.py file in module root | ||
# directory | ||
############################################################################## | ||
from . import invoice_report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<record id="view_account_invoice_line_report_tree" model="ir.ui.view"> | ||
<field name="name">account.invoice.report.tree</field> | ||
<field name="model">account.invoice.report</field> | ||
<field name="inherit_id" ref="account.account_invoice_report_view_tree"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//tree" position="attributes"> | ||
<attribute name="decoration-info">state == 'draft'</attribute> | ||
<attribute name="decoration-muted">state == 'cancel'</attribute> | ||
</xpath> | ||
<field name="quantity" position="after"> | ||
<field name="price_unit"/> | ||
<field name="discount" groups="product.group_discount_per_so_line"/> | ||
<field name="discount_amount" sum="Total" optional="hide" groups="product.group_discount_per_so_line"/> | ||
<field name="price_subtotal_ic" sum="Total" optional="hide"/> | ||
</field> | ||
<field name="price_total" position="after"> | ||
<field name="price_subtotal" position="move"/> | ||
<field name="total_cc" sum="Total"/> | ||
<field name="invoice_currency_id" optional="hide"/> | ||
<field name="company_currency_id" column_invisible="True"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
<record id="view_account_invoice_report_search" model="ir.ui.view"> | ||
<field name="name">account.invoice.report.search</field> | ||
<field name="model">account.invoice.report</field> | ||
<field name="inherit_id" ref="account.view_account_invoice_report_search"/> | ||
<field name="arch" type="xml"> | ||
<filter name='user' position="after"> | ||
<filter string="Journal Entry" name="groupby_move_id" context="{'group_by':'move_id'}"/> | ||
<filter string="Invoice Currency" name="groupby_invoice_currency_id" context="{'group_by':'invoice_currency_id'}"/> | ||
</filter> | ||
</field> | ||
</record> | ||
|
||
<record id="view_account_invoice_report_pivot" model="ir.ui.view"> | ||
<field name="name">account.invoice.report.pivot</field> | ||
<field name="model">account.invoice.report</field> | ||
<field name="inherit_id" ref="account.view_account_invoice_report_pivot"/> | ||
<field name="arch" type="xml"> | ||
<pivot position="attributes"> | ||
<attribute name="disable_linking"></attribute> | ||
</pivot> | ||
</field> | ||
</record> | ||
|
||
<record id="account.action_account_invoice_report_all" model="ir.actions.act_window"> | ||
<field name="res_model">account.invoice.report</field> | ||
<field name="view_mode">tree,graph,pivot</field> | ||
<field name="context">{'search_default_current':1}</field> | ||
<field name="search_view_id" ref="account.view_account_invoice_report_search"/> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
from odoo import models, fields | ||
|
||
|
||
class AccountInvoiceReport(models.Model): | ||
|
||
_inherit = 'account.invoice.report' | ||
|
||
# agregamos widgets monetary, referencia a company currency en string y help | ||
price_subtotal = fields.Monetary( | ||
currency_field='company_currency_id', string="Untaxed Total (CC)", help="Untaxed Total in company currency") | ||
price_total = fields.Monetary(string='Total', currency_field='invoice_currency_id') | ||
price_average = fields.Monetary( | ||
currency_field='company_currency_id', string='Average Price (CC)', help="Average Price in company currency") | ||
# creamos nuevos campos para tener descuentos, vinculos e importes en moneda de compañía | ||
total_cc = fields.Monetary( | ||
string='Total (CC)', readonly=True, help="Untaxed Total in company currency", | ||
currency_field='company_currency_id') | ||
invoice_currency_id = fields.Many2one('res.currency', string='Invoice Currency', readonly=True) | ||
line_id = fields.Many2one('account.move.line', string='Journal Item', readonly=True) | ||
price_subtotal_ic = fields.Monetary('Untaxed Total', readonly=True, currency_field='invoice_currency_id',) | ||
price_unit = fields.Monetary('Unit Price', readonly=True, currency_field='invoice_currency_id',) | ||
discount = fields.Float('Discount (%)', readonly=True) | ||
discount_amount = fields.Monetary( | ||
'Discount Amount', readonly=True, group_operator="sum", currency_field='invoice_currency_id',) | ||
|
||
_depends = {'account.move.line': ['price_unit', 'discount']} | ||
|
||
def _select(self): | ||
return super()._select() + """, | ||
line.price_unit, | ||
line.id as line_id, | ||
move.currency_id as invoice_currency_id, | ||
line.discount, | ||
line.price_unit * line.quantity * line.discount/100 * | ||
(CASE WHEN move | ||
.move_type IN ('in_refund','out_refund','in_receipt') THEN -1 ELSE 1 END) as discount_amount, | ||
-line.balance * (line.price_total / NULLIF(line.price_subtotal, 0.0)) AS total_cc, | ||
line.price_subtotal * (CASE WHEN move.move_type IN ('in_refund', 'out_invoice') THEN 1 ELSE -1 END) as price_subtotal_ic | ||
""" | ||
|
||
def _group_by(self): | ||
return super()._group_by() + ", move.invoice_currency_id" |