[IMP] Checking only one selected sales channel

This commit is contained in:
Sara Lago
2020-11-30 13:52:51 +01:00
parent 5a5b2a8b55
commit 23fa6d9621
2 changed files with 10 additions and 1 deletions

View File

@@ -674,3 +674,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