summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-08-09 15:29:16 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-08-09 15:29:16 +0700
commit7b4f47e43d6485bb7822f1eb21497e68ab782ab1 (patch)
tree2d404e4f0d9cae575772ac64e7390afd4c736f0d /indoteknik_custom/models
parent82368e58dbc4d1ee8f6ff842ebb349172256d449 (diff)
Add field other carts, mail template, and cron on website user cart
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/website_user_cart.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/indoteknik_custom/models/website_user_cart.py b/indoteknik_custom/models/website_user_cart.py
index 9b82aa93..13bad358 100644
--- a/indoteknik_custom/models/website_user_cart.py
+++ b/indoteknik_custom/models/website_user_cart.py
@@ -14,6 +14,12 @@ class WebsiteUserCart(models.Model):
('add_to_cart', 'Add To Cart'),
('buy', 'Buy')
], 'Source', default='add_to_cart')
+ other_carts = fields.One2many('website.user.cart', 'id', 'Other Products', compute='_compute_other_carts')
+
+ def _compute_other_carts(self):
+ for record in self:
+ others = self.search([('user_id', '=', record.user_id.id)])
+ record.other_carts = others
def get_product(self):
user_data = {
@@ -84,4 +90,8 @@ class WebsiteUserCart(models.Model):
'has_product_without_weight': any(not product.get('weight') or product.get('weight') == 0 for product in products),
'products': products
}
- return result \ No newline at end of file
+ return result
+
+ def action_mail_reminder_to_checkout(self, id):
+ template = self.env.ref('indoteknik_custom.mail_template_user_cart_reminder_to_checkout')
+ template.send_mail(int(id), force_send=True) \ No newline at end of file