Skip to Content
Menu
This question has been flagged

How to migrate/import hundreds of Gift Cards from another system to Odoo using existing gift cards codes?

Avatar
Discard
Author Best Answer

Since codes for new gift cards are automatically created in a read-only field, the only way to import codes is to 

1) remove the read-only functionality with a customization.

from odoo import models, fields, api

class GiftCard(models.Model):
_inherit = "gift.card"

code = fields.Char(default=lambda x: x._generate_code(), required=True, readonly=False, copy=False)

2) import
Avatar
Discard
Related Posts Replies Views Activity
0
May 25
2262
2
Mar 24
3256
0
Sep 22
4050
0
Sep 22
2009
1
Nov 22
2419