17 lines
690 B
Python
17 lines
690 B
Python
# Part of BrowseInfo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import api, fields, models, _
|
|
from odoo.exceptions import UserError
|
|
|
|
class AccountPayment(models.Model):
|
|
_inherit = 'account.payment'
|
|
|
|
branch_id = fields.Many2one('res.branch')
|
|
|
|
@api.onchange('branch_id')
|
|
def _onchange_branch_id(self):
|
|
if self.branch_id:
|
|
user_branch = self.env.user.branch_id
|
|
if user_branch and user_branch.id != self.branch_id.id:
|
|
raise UserError("Please select active branch only. Other may create the Multi branch issue. \n\ne.g: If you wish to add other branch then Switch branch from the header and set that.")
|