Skip to content

Commit

Permalink
[IMP] sale_ux: update taxes when position fiscal change
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasperalta1 committed Apr 19, 2023
1 parent edf3e3d commit be11f6c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions sale_ux/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Several Improvements to sales:
#. Add filter to be able to select an analytic account on sale orders with the same partner/commercial partner as the sale order.
#. Add tracking to payment terms on sale orders.
#. Add the field "Internal Notes" in the sales order form and the setting to allow propagating the "Internal Notes" to invoices.
#. Automatically refresh taxes when changing fiscal position

Installation
============
Expand Down
11 changes: 11 additions & 0 deletions sale_ux/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ def _onchange_pricelist_id_show_update_prices(self):
'show_update_pricelist': False,
})

@api.onchange('fiscal_position_id')
def _onchange_fiscal_position_id(self):
"""
No utilizamos el método action_update_taxes() directamente porque no funciona
el message_post sin que se encuentre guardado el registro.
"""
self.ensure_one()
lines_to_recompute = self.order_line.filtered(lambda line: not line.display_type)
lines_to_recompute._compute_tax_id()
self.show_update_fpos = False

def action_cancel(self):
invoices = self.mapped('invoice_ids').filtered(
lambda x: x.state not in ['cancel', 'draft'])
Expand Down

0 comments on commit be11f6c

Please sign in to comment.