[FIX] loyalty: fix test day bugs
- Make content helper more generic for programs - Add search fields for loyalty.card - Fix creation emails for gift cards in pos not being sent properly - Fix validity date check on loyalty rules being inverted. TaskId-3002190 closes odoo/odoo#102160 X-original-commit: f893fda1a40127b7510e861c96f4d4cf9d10f79d Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
.o_kanban_record {
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
width: 100%;
|
||||
|
||||
.o_field_many2many_tags .o_tag span {
|
||||
// Remove the small ball before the tags
|
||||
|
||||
@@ -47,6 +47,10 @@
|
||||
<field name="model">loyalty.card</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="code"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="program_id"/>
|
||||
<separator/>
|
||||
<filter name="active" string="Active" domain="['&', ('points', '>', 0), '|', ('expiration_date', '>=', context_today().strftime('%Y-%m-%d 00:00:00')), ('expiration_date', '=', False)]"/>
|
||||
<filter name="inactive" string="Inactive" domain="['|', ('points', '<=', 0), ('expiration_date', '<', context_today().strftime('%Y-%m-%d 23:59:59'))]"/>
|
||||
</search>
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
<field name="domain">[('program_type', 'not in', ('gift_card', 'ewallet'))]</field>
|
||||
<field name="help" type="html">
|
||||
<div class="o_loyalty_not_found container mt64">
|
||||
<h1>No loyalty program found.</h1>
|
||||
<h1>No program found.</h1>
|
||||
<p class="lead">Create one from scratch, or use a templates below:</p>
|
||||
</div>
|
||||
</field>
|
||||
|
||||
@@ -74,7 +74,7 @@ class PosOrder(models.Model):
|
||||
} for p in coupons_to_create.values()]
|
||||
|
||||
# Pos users don't have the create permission
|
||||
new_coupons = self.env['loyalty.card'].sudo().create(coupon_create_vals)
|
||||
new_coupons = self.env['loyalty.card'].with_context(action_no_send_mail=True).sudo().create(coupon_create_vals)
|
||||
|
||||
# We update the gift card that we sold when the gift_card_settings = 'scan_use'.
|
||||
gift_cards_to_update = [v for v in coupon_data.values() if v.get('giftCardId')]
|
||||
@@ -104,6 +104,8 @@ class PosOrder(models.Model):
|
||||
coupon.points += coupon_data[coupon_new_id_map[coupon.id]]['points']
|
||||
for reward_code in coupon_data[coupon_new_id_map[coupon.id]].get('line_codes', []):
|
||||
lines_per_reward_code[reward_code].coupon_id = coupon
|
||||
# Send creation email
|
||||
new_coupons.with_context(action_no_send_mail=False)._send_creation_communication()
|
||||
# Reports per program
|
||||
report_per_program = {}
|
||||
coupon_per_report = defaultdict(list)
|
||||
|
||||
@@ -360,7 +360,7 @@ class SaleOrder(models.Model):
|
||||
self.ensure_one()
|
||||
return [('active', '=', True), ('program_id.sale_ok', '=', True),
|
||||
('company_id', 'in', (self.company_id.id, False)),
|
||||
'|', ('program_id.date_to', '=', False), ('program_id.date_to', '<=', fields.Date.context_today(self))]
|
||||
'|', ('program_id.date_to', '=', False), ('program_id.date_to', '>=', fields.Date.context_today(self))]
|
||||
|
||||
def _get_applicable_program_points(self, domain=None):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user