Skip to content

Commit

Permalink
[FIX] account_move
Browse files Browse the repository at this point in the history
    Addded inherited method _onchange_partner_id to avoid losing invoice narration field when changing companies inside the record
  • Loading branch information
nmadhoc committed Jan 20, 2021
1 parent 412ddb9 commit c6a0a11
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions sale_multic_fix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from . import models
from . import wizards
5 changes: 5 additions & 0 deletions sale_multic_fix/models/__init__.py
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 account_move
20 changes: 20 additions & 0 deletions sale_multic_fix/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import api, fields, models, _


class AccountMove(models.Model):
_inherit = 'account.move'

@api.onchange('partner_id')
def _onchange_partner_id(self):
""" when changing company, we prefer to keep original terms just in case they where modified manually on SO / or invoice"""
import ipdb; ipdb.set_trace()
original_narration = self._origin.narration
super(AccountMove, self)._onchange_partner_id()
if original_narration and original_narration != self.narration:
self.narration = original_narration

def write(self):
import ipdb; ipdb.set_trace()

0 comments on commit c6a0a11

Please sign in to comment.