Skip to content

Commit

Permalink
[IMP] hide pencil in tax group edit
Browse files Browse the repository at this point in the history
  • Loading branch information
maq-adhoc committed Sep 13, 2023
1 parent 8f8f734 commit 41542eb
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
5 changes: 5 additions & 0 deletions account_invoice_tax/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
'views/account_move_view.xml',
'security/ir.model.access.csv',
],
'assets': {
'web.assets_backend': [
'account_invoice_tax/static/src/xml/**/*',
],
},
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
Expand Down
4 changes: 2 additions & 2 deletions account_invoice_tax/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ def _compute_tax_totals(self):
Only set on invoices.
"""
for move in self:
super(AccountMove, move.with_context(move_origin = move._origin, tax_total_origin=move._origin.tax_totals))._compute_tax_totals()

super(AccountMove, move.with_context(tax_total_origin=move._origin.tax_totals))._compute_tax_totals()

13 changes: 13 additions & 0 deletions account_invoice_tax/static/src/xml/tax_totals.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<templates>

<t t-name="account.TaxGroupComponent" t-inherit="account.TaxGroupComponent" t-inherit-mode="extension" owl="1">
<xpath expr="//span[hasclass('o_tax_group_edit')]" position="replace">
<span class="o_tax_group_edit">
<span class="o_tax_group_amount_value">
<t t-out="props.taxGroup.formatted_tax_group_amount"/>
</span>
</span>
</xpath>
</t>
</templates>
2 changes: 1 addition & 1 deletion account_invoice_tax/views/account_move_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<field name="arch" type="xml">
<field name="tax_totals" position="after">
<div colspan="2" class="oe_right oe_edit_only" attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('move_type', 'not in', ('in_invoice', 'in_refund', 'in_receipt'))]}">
<button name="%(account_invoice_tax.action_view_account_invoice_tax)d" type="action" string="Add" title="Add Tax" class="oe_link" context="{'move_type': move_type, 'type_operation': 'add'}"/>
<button name="%(account_invoice_tax.action_view_account_invoice_tax)d" type="action" string="Add" title="Add/update Tax" class="oe_link" context="{'move_type': move_type, 'type_operation': 'add'}"/>
<button name="%(account_invoice_tax.action_view_account_invoice_tax)d" type="action" string="Remove" title="Remove Tax" class="oe_link" context="{'move_type': move_type, 'type_operation': 'remove'}"/>
</div>
</field>
Expand Down
8 changes: 7 additions & 1 deletion account_invoice_tax/wizards/account_invoice_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ def onchange_move_id(self):
leaf += [('tax_group_id', '=', self.env.context.get('group_id'))]
return {'domain': {'tax_id': leaf}}

@api.onchange('tax_id')
def onchange_tax_id(self):
tax_line = self.move_id.line_ids.filtered(lambda x: x.tax_line_id and x.tax_line_id.id == self.tax_id.id)
if tax_line:
self.amount = tax_line.balance

def _get_amount_updated_values(self):
debit = credit = 0
if self.move_id.move_type == "in_invoice":
Expand Down Expand Up @@ -74,7 +80,7 @@ def add_tax(self):
'debit': line.debit,
'credit': line.credit,
} for line in move.line_ids.filtered(lambda x: x.tax_repartition_line_id.tax_id.amount_type == 'fixed')}

import pdb; pdb.set_trace()
# al crear la linea de impuesto no queda balanceado porque no recalcula las lineas AP/AR
# por eso pasamos check_move_validity
container = {'records': move}
Expand Down

0 comments on commit 41542eb

Please sign in to comment.