Coverage for ingadhoc-odoo-saas-adhoc / saas_provider_upgrade / models / saas_upgrade_upload_changes.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-09 18:15 +0000

1from odoo import _, api, fields, models 

2from odoo.exceptions import ValidationError 

3 

4 

5class SaasUpgradeUploadChanges(models.Model): 

6 _name = "saas.upgrade.upload.changes" 

7 _description = "Upload Changes for Upgrade" 

8 

9 name = fields.Char( 

10 required=True, 

11 ) 

12 change_type = fields.Selection( 

13 selection=[ 

14 ("code", "Code"), 

15 ("attachment", "Attachment"), 

16 ], 

17 ) 

18 ticket_id = fields.Many2one( 

19 "helpdesk.ticket", 

20 ondelete="cascade", 

21 ) 

22 record_id = fields.Integer( 

23 string="ID in client DB", 

24 help="Record ID in client database", 

25 ) 

26 file_data = fields.Binary( 

27 string="File", 

28 ) 

29 code = fields.Text() 

30 

31 @api.constrains("record_id") 

32 def _check_record_id(self): 

33 for rec in self: 

34 if rec.record_id <= 0: 

35 raise ValidationError(_("The 'Record ID' field cannot be less than or equal to zero."))