mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] precommit fixed
This commit is contained in:
committed by
Darío Lodeiros
parent
29fc701c52
commit
121bd7c260
@@ -3,7 +3,7 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
import logging
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo import _, api, fields, models
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -24,8 +24,8 @@ class ResPartner(models.Model):
|
||||
sale_channel_id = fields.Many2one(
|
||||
"pms.sale.channel",
|
||||
string="Sale Channel",
|
||||
ondelete = "restrict",
|
||||
domain=[("channel_type","=","indirect")],
|
||||
ondelete="restrict",
|
||||
domain=[("channel_type", "=", "indirect")],
|
||||
)
|
||||
|
||||
# Compute and Search methods
|
||||
@@ -71,10 +71,10 @@ class ResPartner(models.Model):
|
||||
)
|
||||
return res
|
||||
|
||||
@api.constrains("is_agency","sale_channel_id")
|
||||
@api.constrains("is_agency", "sale_channel_id")
|
||||
def _check_is_agency(self):
|
||||
for record in self:
|
||||
if record.is_agency and not record.sale_channel_id:
|
||||
raise models.ValidationError(_("Sale Channel must be entered"))
|
||||
raise models.ValidationError(_("Sale Channel must be entered"))
|
||||
if not record.is_agency and record.sale_channel_id:
|
||||
record.sale_channel_id=None
|
||||
record.sale_channel_id = None
|
||||
|
||||
Reference in New Issue
Block a user