Skip to content

Commit

Permalink
[11.0][BKP]
Browse files Browse the repository at this point in the history
[MOD] account_invoice
    Addded inherited method _onchange_delivery_address to avoid losing invoice comment field when changing companies inside the record
  • Loading branch information
nmadhoc committed Jan 20, 2021
1 parent f86a675 commit bc69eb3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sale_multic_fix/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ def _onchange_partner_shipping_id(self):
self.partner_id.id, self.partner_shipping_id.id)
if fiscal_position:
self.fiscal_position_id = fiscal_position

@api.onchange('partner_id', 'company_id')
def _onchange_delivery_address(self):
""" when changing company, we prefer to keep original terms just in case
they where modified manually on SO / or invoice"""
original_comment = self._origin.comment
super(AccountInvoice,self)._onchange_delivery_address()
if original_comment and original_comment != self.comment:
self.comment = original_comment

0 comments on commit bc69eb3

Please sign in to comment.