[IMP] Checking only one selected sales channel

This commit is contained in:
Sara Lago
2020-11-30 13:52:51 +01:00
committed by Darío Lodeiros
parent 69b9b8a06c
commit 3d49e1377b
2 changed files with 10 additions and 1 deletions

View File

@@ -683,3 +683,10 @@ class PmsFolio(models.Model):
(line[0].name, line[1]["amount"], line[1]["base"], len(res)) for line in res
]
return res
# Check that only one sale channel is selected
@api.constrains("agency_id", "channel_type_id")
def _check_only_one_channel(self):
for record in self:
if record.agency_id and record.channel_type_id:
raise models.ValidationError(_("There must be only one sale channel"))

View File

@@ -40,7 +40,9 @@
</button>
</xpath>
<xpath expr="//field[@name='name']" position="after">
<field name="is_agency" />
<group>
<field name="is_agency" />
</group>
</xpath>
<xpath expr="//page[@name='internal_notes']" position="after">
<page