[FIX] point_of_sale: delete pos.config

Since the ir.sequence records linked to pos.config records are on
delete restrict, it is necessary to delete the pos.config records first
before deleting the ir.sequence's linked to them.

closes odoo/odoo#38775

X-original-commit: cdfa415829fa06f2860d65054fd8534180c8526a
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
Joseph Caburnay
2019-10-15 09:17:12 +00:00
committed by fw-bot
parent 38711e9f9c
commit cb68960d49
+5 -4
View File
@@ -443,10 +443,11 @@ class PosConfig(models.Model):
return result
def unlink(self):
for pos_config in self.filtered(lambda pos_config: pos_config.sequence_id or pos_config.sequence_line_id):
pos_config.sequence_id.unlink()
pos_config.sequence_line_id.unlink()
return super(PosConfig, self).unlink()
# Delete the pos.config records first then delete the sequences linked to them
sequences_to_delete = self.sequence_id | self.sequence_line_id
res = super(PosConfig, self).unlink()
sequences_to_delete.unlink()
return res
def _set_fiscal_position(self):
for config in self: