| 1 |
# Part of Odoo. See LICENSE file for full copyright and licensing details. |
| 2 |
|
| 3 |
from odoo import fields, models, api |
| 4 |
|
| 5 |
|
| 6 |
class PosNote(models.Model): |
| 7 |
_name = 'pos.note' |
| 8 |
_description = 'PoS Note' |
| 9 |
_inherit = ['pos.load.mixin'] |
| 10 |
_order = "sequence" |
| 11 |
|
| 12 |
name = fields.Char(required=True) |
| 13 |
sequence = fields.Integer('Sequence', default=1) |
| 14 |
color = fields.Integer(string='Color') |
| 15 |
|
| 16 |
_name_unique = models.Constraint( |
| 17 |
'unique (name)', |
| 18 |
'A note with this name already exists', |
| 19 |
) |
| 20 |
|
| 21 |
@api.model |
| 22 |
def _load_pos_data_domain(self, data, config): |
| 23 |
return [('id', 'in', config.note_ids.ids)] if config.note_ids else [] |
| 24 |
|
| 25 |
@api.model |
| 26 |
def _load_pos_data_fields(self, config): |
| 27 |
return ['name', 'color'] |