[FIX] loyalty: make it possible to import coupons etc
TaskId-2991207 closes odoo/odoo#102062 X-original-commit: d4a92b112d0554a2624f7768feb7d54e0484469f Related: odoo/enterprise#32249 Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
This commit is contained in:
@@ -32,7 +32,7 @@ class LoyaltyCard(models.Model):
|
||||
point_name = fields.Char(related='program_id.portal_point_name', readonly=True)
|
||||
points_display = fields.Char(compute='_compute_points_display')
|
||||
|
||||
code = fields.Char(default=lambda self: self._generate_code(), required=True, readonly=True)
|
||||
code = fields.Char(default=lambda self: self._generate_code(), required=True)
|
||||
expiration_date = fields.Date()
|
||||
|
||||
use_count = fields.Integer(compute='_compute_use_count')
|
||||
|
||||
@@ -358,7 +358,6 @@ class LoyaltyProgram(models.Model):
|
||||
action['name'] = self._program_items_name()[self.program_type]
|
||||
action['display_name'] = action['name']
|
||||
action['context'] = {
|
||||
'create': False,
|
||||
'program_type': self.program_type,
|
||||
'program_item_name': self._program_items_name()[self.program_type],
|
||||
'default_program_id': self.id,
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
</t>
|
||||
|
||||
<t t-name="loyalty.LoyaltyCardListView.buttons" owl="1" t-inherit-mode="primary" t-inherit="web.ListView.Buttons">
|
||||
<xpath expr="//button[hasclass('o_list_button_add')]" position="replace"/>
|
||||
<xpath expr="//t[contains(@t-if, 'isExportEnable')]" position="before">
|
||||
<t t-set="supportedProgramTypes" t-value="['coupons', 'gift_card', 'ewallet']"/>
|
||||
<button t-if="supportedProgramTypes.includes(props.context.program_type)" type="button" class="btn btn-primary o_loyalty_card_list_button_generate" t-attf-data-tooltip="Generate {{props.context.program_item_name}}"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="code"/>
|
||||
<field name="code" readonly="1"/>
|
||||
<field name="expiration_date"/>
|
||||
<field name="partner_id"/>
|
||||
<label string="Balance" for="points"/>
|
||||
@@ -30,8 +30,8 @@
|
||||
<field name="name">loyalty.card.view.tree</field>
|
||||
<field name="model">loyalty.card</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Coupons" create="false" edit="false" delete="false" js_class="loyalty_card_list_view">
|
||||
<field name="code"/>
|
||||
<tree string="Coupons" edit="false" delete="false" js_class="loyalty_card_list_view">
|
||||
<field name="code" readonly="1"/>
|
||||
<field name="create_date" optional="hide"/>
|
||||
<field name="points_display" string="Balance"/>
|
||||
<field name="expiration_date"/>
|
||||
|
||||
Reference in New Issue
Block a user