30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import fields, models, api
|
|
|
|
class PosOrderLine(models.Model):
|
|
_inherit = 'pos.order.line'
|
|
|
|
is_reward_line = fields.Boolean(
|
|
help="Whether this line is part of a reward or not.")
|
|
reward_id = fields.Many2one(
|
|
'loyalty.reward', "Reward", ondelete='restrict',
|
|
help="The reward associated with this line.", index='btree_not_null')
|
|
coupon_id = fields.Many2one(
|
|
'loyalty.card', "Coupon", ondelete='restrict',
|
|
help="The coupon used to claim that reward.")
|
|
reward_identifier_code = fields.Char(help="""
|
|
Technical field used to link multiple reward lines from the same reward together.
|
|
""")
|
|
points_cost = fields.Float(help="How many point this reward cost on the coupon.")
|
|
|
|
def _is_not_sellable_line(self):
|
|
return super().is_not_sellable_line() or self.reward_id
|
|
|
|
@api.model
|
|
def _load_pos_data_fields(self, config_id):
|
|
params = super()._load_pos_data_fields(config_id)
|
|
params += ['is_reward_line', 'reward_id', 'reward_identifier_code', 'points_cost', 'coupon_id']
|
|
return params
|