diff --git a/odex25_donation/ensan_sale_management/__manifest__.py b/odex25_donation/ensan_sale_management/__manifest__.py index 5044c11d1..feeec54fa 100644 --- a/odex25_donation/ensan_sale_management/__manifest__.py +++ b/odex25_donation/ensan_sale_management/__manifest__.py @@ -12,6 +12,7 @@ 'security/ir.model.access.csv', 'data/sms_data.xml', 'views/sale_order_views.xml', - 'views/product_views.xml' + 'views/product_views.xml', + 'views/sale_report.xml', ], } diff --git a/odex25_donation/ensan_sale_management/models/__init__.py b/odex25_donation/ensan_sale_management/models/__init__.py index bd901bd44..b946b94e4 100644 --- a/odex25_donation/ensan_sale_management/models/__init__.py +++ b/odex25_donation/ensan_sale_management/models/__init__.py @@ -1,2 +1,3 @@ from . import sale_order from . import product +from . import sale_report diff --git a/odex25_donation/ensan_sale_management/models/sale_order.py b/odex25_donation/ensan_sale_management/models/sale_order.py index 6de215165..b9522ed21 100644 --- a/odex25_donation/ensan_sale_management/models/sale_order.py +++ b/odex25_donation/ensan_sale_management/models/sale_order.py @@ -1,7 +1,31 @@ from odoo import models, fields, api from odoo.tools.json import scriptsafe as json_scriptsafe - +def check_mobile_number_validation(phone): + if phone[0] == '+' and phone[1] != '0': + if phone[1:4] == '966': + if len(phone[4:]) >= 8: + return phone + else: + phone = phone[0] + '966' + phone[1:] + elif phone[0] == '+' and phone[1] == '0': + phone = phone[0] + '966' + phone[2:] + elif phone[0] == '0' and phone[1] == '5': + phone = '+966' + phone[1:] + elif phone[0:2] == '00': # 00966555555555 + if phone[2:5] == '966': + phone = '+' + '966' + phone[5:] + elif phone[0] == '0': # 0966555555555 + if phone[1:4] == '966': + phone = '+' + '966' + phone[4:] + else: + if phone[0:3] == '966': + phone = '+' + phone + else: + phone = '+' + '966' + phone + return phone + + class SaleOrder_Inherit(models.Model): _inherit = 'sale.order' @@ -10,54 +34,44 @@ class SaleOrder_Inherit(models.Model): order_name = fields.Char("Donor Name") sale_order_portal_url = fields.Char("Sale Order Url", compute="get_sale_order_portal_url") donators_ids = fields.One2many('sale.order.extra_donators', 'sale_id', string="Donators", store=True, readonly=True) + is_gift = fields.Boolean("Is Gift Product?", store=True, compute="compute_gift_order") + first_receiver_number = fields.Char("Receiver Number", compute="_compute_receiver_details", store=True) + first_receiver_name = fields.Char("Receiver Name", compute="_compute_receiver_details", store=True) def get_sale_order_portal_url(self): for sale in self: sale.sale_order_portal_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') + sale.get_portal_url() - def check_mobile_number_validation(self, phone): - if phone[0] == '+' and phone[1] != '0': - if phone[1:4] == '966': - if len(phone[4:]) >= 8: - return phone - else: - phone = phone[0] + '966' + phone[1:] - elif phone[0] == '+' and phone[1] == '0': - phone = phone[0] + '966' + phone[2:] - elif phone[0] == '0' and phone[1] == '5': - phone = '+966' + phone[1:] - elif phone[0:2] == '00': # 00966555555555 - if phone[2:5] == '966': - phone = '+' + '966' + phone[5:] - elif phone[0] == '0': # 0966555555555 - if phone[1:4] == '966': - phone = '+' + '966' + phone[4:] - else: - if phone[0:3] == '966': - phone = '+' + phone - else: - phone = '+' + '966' + phone - return phone - def _cart_update(self, *args, **kwargs): res = super(SaleOrder_Inherit, self)._cart_update(*args, **kwargs) + order_line = self.env['sale.order.line'].browse(res.get('line_id')) qty = kwargs.get('add_qty', False) or kwargs.get('set_qty', False) + if qty and order_line: self.convert_donation_qty_to_price(order_line, qty) + if 'donators_ids' in kwargs: order_line = self.env['sale.order.line'].browse(res.get('line_id')).sudo() order_line.extra_donators_ids.sudo().unlink() extra_donators_ids = [] + gift_sender_name = None + gift_sender_mobile = None for i in json_scriptsafe.loads(kwargs.get('donators_ids')): extra_donators_ids.append((0, 0, { 'sale_id': order_line.order_id.id, 'product_id': int(i.get('product_id')), 'donated_amount': float(i.get('donated_amount')), 'donator_name': i.get('donator_name'), - 'donator_mobile_number': self.check_mobile_number_validation(i.get('donator_mobile_number')).replace('+', '') + 'donator_mobile_number': check_mobile_number_validation(i.get('donator_mobile_number')).replace('+', '') })) + gift_sender_name = i.get("gift_sender_name") + gift_sender_mobile = i.get("gift_sender_mobile") order_line.extra_donators_ids = extra_donators_ids + if gift_sender_name: + self.order_name = gift_sender_name + if gift_sender_mobile: + self.order_mobile_number = gift_sender_mobile return res def convert_donation_qty_to_price(self, order_line, qty): @@ -86,6 +100,29 @@ class SaleOrder_Inherit(models.Model): sms_numbers=[donator.donator_mobile_number] ) return call_super + + @api.depends('donators_ids') + def _compute_receiver_details(self): + for rec in self: + first_receiver_number = '' + first_receiver_name = '' + if rec.donators_ids: + gift_donators_id = rec.donators_ids.filtered(lambda l:l.product_id.product_tmpl_id.is_gift) + if not gift_donators_id: + gift_donators_id = rec.donators_ids + gift_donators_id = gift_donators_id[0] + first_receiver_number = gift_donators_id.donator_mobile_number + first_receiver_name = gift_donators_id.donator_name + rec.first_receiver_number = first_receiver_number + rec.first_receiver_name = first_receiver_name + + @api.depends('order_line.is_gift') + def compute_gift_order(self): + for rec in self: + if rec.order_line.filtered(lambda l: l.is_gift): + rec.is_gift = True + else: + rec.is_gift = False class ExtraDonators(models.Model): @@ -100,16 +137,17 @@ class ExtraDonators(models.Model): sale_id = fields.Many2one("sale.order", string="Sale Order", ondelete='cascade') product_id = fields.Many2one('product.product', string="Product", ondelete='cascade') - - class SaleOrderLineInherit(models.Model): _inherit = 'sale.order.line' extra_donators_ids = fields.One2many('sale.order.extra_donators', 'line_id') + is_gift = fields.Boolean("Is Gift Product?", store=True) + + @api.model_create_multi + def create(self, vals_list): + call_super = super(SaleOrderLineInherit, self).create(vals_list) + for line in call_super: + if line.product_id: + line.is_gift = line.product_id.is_gift + return call_super - @api.depends('product_id', 'product_uom', 'product_uom_qty') - def _compute_price_unit(self): - for line in self: - if line.product_id and line.product_id.is_donation and line.product_id.donation_type == 'Free Amount': - continue - super(SaleOrderLineInherit, line)._compute_price_unit() diff --git a/odex25_donation/ensan_sale_management/models/sale_report.py b/odex25_donation/ensan_sale_management/models/sale_report.py new file mode 100644 index 000000000..22d8ba215 --- /dev/null +++ b/odex25_donation/ensan_sale_management/models/sale_report.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from odoo import fields, models + + +class SaleReport(models.Model): + _inherit = "sale.report" + + is_gift = fields.Boolean("Order Contains Gift", readonly=True) + first_receiver_number = fields.Char("Receiver Number", readonly=True) + first_receiver_name = fields.Char("Receiver Name", readonly=True) + order_mobile_number = fields.Char("Donor Number", readonly=True) + order_name = fields.Char("Donor Name", readonly=True) + + def _select_additional_fields(self, fields): + fields['is_gift'] = ", s.is_gift" + fields['first_receiver_number'] = ", s.first_receiver_number" + fields['first_receiver_name'] = ", s.first_receiver_name" + fields['order_mobile_number'] = ", s.order_mobile_number" + fields['order_name'] = ", s.order_name" + return super()._select_additional_fields(fields) + + def _group_by_sale(self, groupby=''): + res = super()._group_by_sale(groupby) + res += """, s.is_gift, s.first_receiver_number,s.first_receiver_name,s.order_mobile_number,s.order_name""" + return res + \ No newline at end of file diff --git a/odex25_donation/ensan_sale_management/views/sale_order_views.xml b/odex25_donation/ensan_sale_management/views/sale_order_views.xml index 74e4eee97..b1e35cd0d 100644 --- a/odex25_donation/ensan_sale_management/views/sale_order_views.xml +++ b/odex25_donation/ensan_sale_management/views/sale_order_views.xml @@ -4,26 +4,131 @@ extrafield.sale.order.form.view sale.order - + - - - + + + + - - - - + + + + +
+ + + + + + +
- + + sale.order.list.select + sale.order + + + + + + + + + + + + + + + + + + + + + + + + + + Group By Gift Sender Number + sale.order + [('is_gift', '=', True)] + + {'group_by': ['order_mobile_number']} + + + Group By Gift Sender Name + sale.order + [('is_gift', '=', True)] + + {'group_by': ['order_name']} + + + Group By Gift Receiver Number + sale.order + [('is_gift', '=', True)] + + {'group_by': ['first_receiver_number']} + + + Group By Gift Receiver Name + sale.order + [('is_gift', '=', True)] + + {'group_by': ['first_receiver_name']} + + + + + Group By Gift Sender Number + sale.report + [('is_gift', '=', True)] + + {'group_by': ['order_mobile_number']} + + + Group By Gift Sender Name + sale.report + [('is_gift', '=', True)] + + {'group_by': ['order_name']} + + + Group By Gift Receiver Number + sale.report + [('is_gift', '=', True)] + + {'group_by': ['first_receiver_number']} + + + Group By Gift Receiver Name + sale.report + [('is_gift', '=', True)] + + {'group_by': ['first_receiver_name']} + + + \ No newline at end of file diff --git a/odex25_donation/ensan_sale_management/views/sale_report.xml b/odex25_donation/ensan_sale_management/views/sale_report.xml new file mode 100644 index 000000000..e590947b0 --- /dev/null +++ b/odex25_donation/ensan_sale_management/views/sale_report.xml @@ -0,0 +1,31 @@ + + + + + sale.report.form.view + sale.report + + + + + + + + + + + + + + + + + + + + + diff --git a/odex25_donation/ensan_website_sale/__init__.py b/odex25_donation/ensan_website_sale/__init__.py index e046e49fb..91c5580fe 100644 --- a/odex25_donation/ensan_website_sale/__init__.py +++ b/odex25_donation/ensan_website_sale/__init__.py @@ -1 +1,2 @@ from . import controllers +from . import models diff --git a/odex25_donation/ensan_website_sale/controllers/main.py b/odex25_donation/ensan_website_sale/controllers/main.py index 7175798b2..3a6aca9f2 100644 --- a/odex25_donation/ensan_website_sale/controllers/main.py +++ b/odex25_donation/ensan_website_sale/controllers/main.py @@ -13,28 +13,31 @@ _logger = logging.getLogger(__name__) class WebsiteSaleExtended(WebsiteSale): - @http.route() - def cart_update(self, product_id, add_qty=1, set_qty=0, **kw): - res = super(WebsiteSaleExtended, self).cart_update(product_id, add_qty=add_qty, set_qty=set_qty, **kw) - sale_order = request.website.sale_get_order() + # @http.route() + # def cart_update(self, product_id, add_qty=1, set_qty=0, **kw): + # res = super(WebsiteSaleExtended, self).cart_update(product_id, add_qty=add_qty, set_qty=set_qty, **kw) + # sale_order = request.website.sale_get_order() - product_custom_attribute_values = None - if kw.get('product_custom_attribute_values'): - product_custom_attribute_values = json.loads(kw.pop('product_custom_attribute_values')) + # product_custom_attribute_values = None + # if kw.get('product_custom_attribute_values'): + # product_custom_attribute_values = json.loads(kw.pop('product_custom_attribute_values')) - no_variant_attribute_values = None - if kw.get('no_variant_attribute_values'): - no_variant_attribute_values = json.loads(kw.pop('no_variant_attribute_values')) + # no_variant_attribute_values = None + # if kw.get('no_variant_attribute_values'): + # no_variant_attribute_values = json.loads(kw.pop('no_variant_attribute_values')) - sale_order._cart_update( - product_id=int(product_id), - add_qty=add_qty, - set_qty=set_qty, - product_custom_attribute_values=product_custom_attribute_values, - no_variant_attribute_values=no_variant_attribute_values, - **kw - ) - return res + # sale_order._cart_update( + # product_id=int(product_id), + # add_qty=0, + # set_qty=set_qty, + # product_custom_attribute_values=product_custom_attribute_values, + # no_variant_attribute_values=no_variant_attribute_values, + # **kw + # ) + # gift_redirect = 'gift_redirect' in kw and kw.pop('gift_redirect') or False + # if gift_redirect: + # return request.redirect("/shop/payment") + # return res @http.route() def checkout(self, **post): diff --git a/odex25_donation/ensan_website_sale/models/__init__.py b/odex25_donation/ensan_website_sale/models/__init__.py new file mode 100644 index 000000000..c97c56b7d --- /dev/null +++ b/odex25_donation/ensan_website_sale/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import ir_http \ No newline at end of file diff --git a/odex25_donation/p_donation_gift/models/ir_http.py b/odex25_donation/ensan_website_sale/models/ir_http.py similarity index 100% rename from odex25_donation/p_donation_gift/models/ir_http.py rename to odex25_donation/ensan_website_sale/models/ir_http.py diff --git a/odex25_donation/ensan_website_sale/static/src/js/checkout.js b/odex25_donation/ensan_website_sale/static/src/js/checkout.js index 277ccbbcd..4c4fa3b95 100644 --- a/odex25_donation/ensan_website_sale/static/src/js/checkout.js +++ b/odex25_donation/ensan_website_sale/static/src/js/checkout.js @@ -12,7 +12,7 @@ odoo.define('ensan_website_sale.payment', require => { }, checkMobileNumberFormat: function() { const mobileInput = this.$('#order_mobile_number'); - const mobileRegex = /^(?:(\+966|00966|0)?5[0-9]{8}|5[0-9]{8})$/; + const mobileRegex = /^(?:(\+966|00966|0|966)?5[0-9]{8}|5[0-9]{8})$/; if (mobileRegex.test(mobileInput.val())) { mobileInput.removeClass('is-invalid').addClass('is-valid'); diff --git a/odex25_donation/p_donation_gift/static/src/js/gift.js b/odex25_donation/ensan_website_sale/static/src/js/gift.js similarity index 96% rename from odex25_donation/p_donation_gift/static/src/js/gift.js rename to odex25_donation/ensan_website_sale/static/src/js/gift.js index ad145bb63..cf1f5dad7 100644 --- a/odex25_donation/p_donation_gift/static/src/js/gift.js +++ b/odex25_donation/ensan_website_sale/static/src/js/gift.js @@ -1,8 +1,7 @@ -odoo.define('p_donation_gift.gift', function (require) { +odoo.define('ensan_website_sale.gift', function (require) { "use strict"; require('web.dom_ready'); - require('p_donation_theme.product-gift-card'); var publicWidget = require('web.public.widget'); const { _t } = require('web.core'); @@ -114,7 +113,7 @@ odoo.define('p_donation_gift.gift', function (require) { gift_sender_name: gift_sender_name, gift_sender_mobile: gift_sender_number }) - gift_form.find('input[name=donate_list]').val(JSON.stringify(gift_box_list)) + gift_form.find('input[name=donators_ids]').val(JSON.stringify(gift_box_list)) gift_form.find('input[name=gift_redirect]').val('/shop/payment') gift_form.find('button[type=submit]').click() }) diff --git a/odex25_donation/p_donation_gift/static/src/scss/gift_popup.scss b/odex25_donation/ensan_website_sale/static/src/scss/gift_popup.scss similarity index 100% rename from odex25_donation/p_donation_gift/static/src/scss/gift_popup.scss rename to odex25_donation/ensan_website_sale/static/src/scss/gift_popup.scss diff --git a/odex25_donation/ensan_website_sale/views/assets.xml b/odex25_donation/ensan_website_sale/views/assets.xml index d34bdaef9..cea2b1963 100644 --- a/odex25_donation/ensan_website_sale/views/assets.xml +++ b/odex25_donation/ensan_website_sale/views/assets.xml @@ -5,11 +5,13 @@ + @@ -1116,6 +1119,13 @@ aria-label="Donate Now"> Donate Now + + + @@ -1133,4 +1143,97 @@ + + \ No newline at end of file diff --git a/odex25_donation/p_donation_gift/LICENSE b/odex25_donation/p_donation_gift/LICENSE deleted file mode 100644 index 7a5c68e71..000000000 --- a/odex25_donation/p_donation_gift/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Odoo Proprietary License v1.0 - -This software and associated files (the "Software") may only be used (executed, -modified, executed after modifications) if you have purchased a valid license -from the authors, typically via Odoo Apps, or if you have received a written -agreement from the authors of the Software (see the COPYRIGHT file). - -You may develop Odoo modules that use the Software as a library (typically -by depending on it, importing it and using its resources), but without copying -any source code or material from the Software. You may distribute those -modules under the license of your choice, provided that this license is -compatible with the terms of the Odoo Proprietary License (For example: -LGPL, MIT, or proprietary licenses similar to this one). - -It is forbidden to publish, distribute, sublicense, or sell copies of the Software -or modified copies of the Software. - -The above copyright notice and this permission notice must be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/odex25_donation/p_donation_gift/__init__.py b/odex25_donation/p_donation_gift/__init__.py deleted file mode 100644 index 511a0ca3a..000000000 --- a/odex25_donation/p_donation_gift/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- - -from . import controllers -from . import models \ No newline at end of file diff --git a/odex25_donation/p_donation_gift/__manifest__.py b/odex25_donation/p_donation_gift/__manifest__.py deleted file mode 100644 index 44abab7e7..000000000 --- a/odex25_donation/p_donation_gift/__manifest__.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -{ - 'name': "GIFT Feature on donation platform", - 'summary': 'GIFT Feature on donation platform', - 'description': 'this module adds GIFT Feature in Ensan.sa interface', - 'author': 'Shah Enterprise', - 'maintainer': 'Shah Enterprise', - 'company': 'Shah Enterprise', - 'website': 'https://shahenterprise.co', - 'price': 600, - 'currency': 'USD', - 'license': 'LGPL-3', - 'category': 'Uncategorized', - 'version': '16.0.1', - 'depends': [ - 'base', 'website_sale', 'theme_prime', 'p_donation_theme' - ], - 'data': [ - 'views/website_template.xml', - 'views/sale_view.xml' - ], - 'assets': { - 'web.assets_frontend': [ - 'p_donation_gift/static/src/js/*.js', - 'p_donation_gift/static/src/scss/*.scss', - # 'p_donation_gift/static/src/xml/gift.xml', - ], - } -} diff --git a/odex25_donation/p_donation_gift/controllers/__init__.py b/odex25_donation/p_donation_gift/controllers/__init__.py deleted file mode 100644 index deec4a8b8..000000000 --- a/odex25_donation/p_donation_gift/controllers/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import main \ No newline at end of file diff --git a/odex25_donation/p_donation_gift/controllers/main.py b/odex25_donation/p_donation_gift/controllers/main.py deleted file mode 100644 index 9fcd2eeaa..000000000 --- a/odex25_donation/p_donation_gift/controllers/main.py +++ /dev/null @@ -1,16 +0,0 @@ -from odoo import http, _ -from odoo.addons.website_sale.controllers.main import WebsiteSale -from odoo.http import request - -class WebsiteSale_Cart(WebsiteSale): - - @http.route(['/shop/cart/update'], type='http', auth="public", methods=['POST'], website=True) - def cart_update( - self, product_id, add_qty=1, set_qty=0, - product_custom_attribute_values=None, no_variant_attribute_values=None, - express=False, **kwargs): - gift_redirect = 'gift_redirect' in kwargs and kwargs.pop('gift_redirect') or False - call_super = super(WebsiteSale_Cart, self).cart_update(product_id, add_qty, set_qty, product_custom_attribute_values, no_variant_attribute_values, express, **kwargs) - if gift_redirect: - return request.redirect("/shop/payment") - return call_super \ No newline at end of file diff --git a/odex25_donation/p_donation_gift/description/icon.png b/odex25_donation/p_donation_gift/description/icon.png deleted file mode 100644 index 392838e0c..000000000 Binary files a/odex25_donation/p_donation_gift/description/icon.png and /dev/null differ diff --git a/odex25_donation/p_donation_gift/i18n/ar_001.po b/odex25_donation/p_donation_gift/i18n/ar_001.po deleted file mode 100644 index f8133424f..000000000 --- a/odex25_donation/p_donation_gift/i18n/ar_001.po +++ /dev/null @@ -1,162 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * p_donation_gift -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-28 18:33+0000\n" -"PO-Revision-Date: 2024-05-28 18:33+0000\n" -"Last-Translator: Harshil Shah, 2024\n" -"Language-Team: Arabic\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Language: ar\n" -"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" - -#. module: p_donation_gift -#: model_terms:ir.ui.view,arch_db:p_donation_gift.shop_layout -msgid "05xxxxxxxx" -msgstr "" - -#. module: p_donation_gift -#: model_terms:ir.ui.view,arch_db:p_donation_gift.shop_layout -msgid "Close" -msgstr "" - -#. module: p_donation_gift -#: model_terms:ir.ui.view,arch_db:p_donation_gift.shop_layout -msgid "Dedicate Now" -msgstr "تبرع الان" - -#. module: p_donation_gift -#: model_terms:ir.ui.view,arch_db:p_donation_gift.shop_layout -msgid "Donate on behalf of your family or friends" -msgstr "اهدٍ من احببت اجرًا" - -#. module: p_donation_gift -#: model:ir.model.fields,field_description:p_donation_gift.field_sale_report__order_name -msgid "Donor Name" -msgstr "اسم المهدي" - -#. module: p_donation_gift -#: model:ir.model.fields,field_description:p_donation_gift.field_sale_report__order_mobile_number -msgid "Donor Number" -msgstr "رقم جوال المهدي" - -#. module: p_donation_gift -#: model:ir.model,name:p_donation_gift.model_ir_http -msgid "HTTP Routing" -msgstr "مسار HTTP" - -#. module: p_donation_gift -#: model_terms:ir.ui.view,arch_db:p_donation_gift.shop_layout -msgid "Invalid Name!" -msgstr "الاسم خطأ" - -#. module: p_donation_gift -#: model_terms:ir.ui.view,arch_db:p_donation_gift.shop_layout -msgid "Invalid Number! It Should start with 05 and minimum length 10" -msgstr "رقم الجوال خطأ، الصيغة الصحيحة" - -#. module: p_donation_gift -#: model:ir.model.fields,field_description:p_donation_gift.field_product_product__is_gift -#: model:ir.model.fields,field_description:p_donation_gift.field_product_template__is_gift -#: model:ir.model.fields,field_description:p_donation_gift.field_sale_order__is_gift -#: model:ir.model.fields,field_description:p_donation_gift.field_sale_order_line__is_gift -msgid "Is Gift Product?" -msgstr "" - -#. module: p_donation_gift -#: model:ir.model.fields,field_description:p_donation_gift.field_sale_report__is_gift -msgid "Order Contains Gift" -msgstr "" - -#. module: p_donation_gift -#: model_terms:ir.ui.view,arch_db:p_donation_gift.sale_report_view_search_website -#: model_terms:ir.ui.view,arch_db:p_donation_gift.view_order_form -#: model_terms:ir.ui.view,arch_db:p_donation_gift.view_sales_order_filter -msgid "Order Contains Gift?" -msgstr "" - -#. module: p_donation_gift -#: model:ir.model,name:p_donation_gift.model_product_template -msgid "Product" -msgstr "المنتج" - -#. module: p_donation_gift -#: model:ir.model,name:p_donation_gift.model_product_product -msgid "Product Variant" -msgstr "متغير المنتج " - -#. module: p_donation_gift -#: model:ir.model.fields,field_description:p_donation_gift.field_sale_order__first_receiver_name -#: model:ir.model.fields,field_description:p_donation_gift.field_sale_report__first_receiver_name -#: model_terms:ir.ui.view,arch_db:p_donation_gift.sale_report_view_search_website -#: model_terms:ir.ui.view,arch_db:p_donation_gift.shop_layout -#: model_terms:ir.ui.view,arch_db:p_donation_gift.view_sales_order_filter -msgid "Receiver Name" -msgstr "اسم المهدى له" - -#. module: p_donation_gift -#: model:ir.model.fields,field_description:p_donation_gift.field_sale_order__first_receiver_number -#: model:ir.model.fields,field_description:p_donation_gift.field_sale_report__first_receiver_number -#: model_terms:ir.ui.view,arch_db:p_donation_gift.sale_report_view_search_website -#: model_terms:ir.ui.view,arch_db:p_donation_gift.view_sales_order_filter -msgid "Receiver Number" -msgstr "رقم جوال المهدى له" - -#. module: p_donation_gift -#: model:ir.model,name:p_donation_gift.model_sale_report -msgid "Sales Analysis Report" -msgstr "تقرير المبيعات التحليلي" - -#. module: p_donation_gift -#: model:ir.model,name:p_donation_gift.model_sale_order -msgid "Sales Order" -msgstr "أمر البيع" - -#. module: p_donation_gift -#: model:ir.model,name:p_donation_gift.model_sale_order_line -msgid "Sales Order Line" -msgstr "بند أمر المبيعات" - -#. module: p_donation_gift -#: model_terms:ir.ui.view,arch_db:p_donation_gift.sale_report_view_search_website -#: model_terms:ir.ui.view,arch_db:p_donation_gift.shop_layout -#: model_terms:ir.ui.view,arch_db:p_donation_gift.view_sales_order_filter -msgid "Sender Name" -msgstr "اسم المهدي" - -#. module: p_donation_gift -#: model_terms:ir.ui.view,arch_db:p_donation_gift.sale_report_view_search_website -#: model_terms:ir.ui.view,arch_db:p_donation_gift.view_sales_order_filter -msgid "Sender Number" -msgstr "رقم جوال المهدي" - -#. module: p_donation_gift -#: model_terms:ir.ui.view,arch_db:p_donation_gift.shop_layout -msgid "Valid Name!" -msgstr "الاسم صحيح " - -#. module: p_donation_gift -#: model_terms:ir.ui.view,arch_db:p_donation_gift.shop_layout - -#. module: p_donation_gift -#. odoo-javascript -#: code:addons/p_donation_gift/static/src/js/gift.js:0 -#, python-format -msgid "Please Fill out this field." -msgstr "يرجى ملئ مبلغ التبرع" - -#. module: p_donation_gift -#: model_terms:ir.ui.view,arch_db:p_donation_gift.shop_layout -msgid "Sender Mobile" -msgstr "رقم جوال المهدي" - -#. module: p_donation_gift -#: model_terms:ir.ui.view,arch_db:p_donation_gift.shop_layout -msgid "Receiver Mobile" -msgstr "رقم جوال المهدى له" \ No newline at end of file diff --git a/odex25_donation/p_donation_gift/models/__init__.py b/odex25_donation/p_donation_gift/models/__init__.py deleted file mode 100644 index d879249ac..000000000 --- a/odex25_donation/p_donation_gift/models/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# -*- coding: utf-8 -*- - -from . import sale, product, sale_report, ir_http \ No newline at end of file diff --git a/odex25_donation/p_donation_gift/models/product.py b/odex25_donation/p_donation_gift/models/product.py deleted file mode 100644 index b1ff4e2fe..000000000 --- a/odex25_donation/p_donation_gift/models/product.py +++ /dev/null @@ -1,13 +0,0 @@ -from odoo import models, fields - - -class ProductTemplate_Inherit(models.Model): - _inherit = 'product.template' - - is_gift = fields.Boolean("Is Gift Product?", default=False) - - -class ProductProduct_Inherit(models.Model): - _inherit = 'product.product' - - is_gift = fields.Boolean("Is Gift Product?", related="product_tmpl_id.is_donation") diff --git a/odex25_donation/p_donation_gift/models/sale.py b/odex25_donation/p_donation_gift/models/sale.py deleted file mode 100644 index 55f2425b0..000000000 --- a/odex25_donation/p_donation_gift/models/sale.py +++ /dev/null @@ -1,66 +0,0 @@ -from odoo import models, fields, api -from odoo.tools.json import scriptsafe as json_scriptsafe - - -class SaleOrder_Inherit(models.Model): - _inherit = 'sale.order' - - is_gift = fields.Boolean("Is Gift Product?", store=True, compute="compute_gift_order") - first_receiver_number = fields.Char("Receiver Number", compute="_compute_receiver_details", store=True) - first_receiver_name = fields.Char("Receiver Name", compute="_compute_receiver_details", store=True) - - @api.depends('donators_ids') - def _compute_receiver_details(self): - for rec in self: - first_receiver_number = '' - first_receiver_name = '' - if rec.donators_ids: - gift_donators_id = rec.donators_ids.filtered(lambda l:l.product_id.product_tmpl_id.is_gift) - if not gift_donators_id: - gift_donators_id = rec.donators_ids - gift_donators_id = gift_donators_id[0] - first_receiver_number = gift_donators_id.donator_mobile_number - first_receiver_name = gift_donators_id.donator_name - rec.first_receiver_number = first_receiver_number - rec.first_receiver_name = first_receiver_name - - @api.depends('order_line.is_gift') - def compute_gift_order(self): - for rec in self: - if rec.order_line.filtered(lambda l: l.is_gift): - rec.is_gift = True - else: - rec.is_gift = False - - def _cart_update(self, *args, **kwargs): - donate_list = kwargs.get('donate_list', []) - if donate_list: - donate_list = json_scriptsafe.loads(donate_list) - donate_dict = donate_list[0] - gift_sender_name = donate_dict.get("gift_sender_name") - gift_sender_mobile = donate_dict.get("gift_sender_mobile") - kwargs.pop('donate_list') - kwargs.update({ - 'donators_ids': json_scriptsafe.dumps([donate_dict]) - }) - self.write({ - 'order_mobile_number': gift_sender_mobile, - 'order_name': gift_sender_name - }) - - call_super = super(SaleOrder_Inherit, self)._cart_update(*args, **kwargs) - return call_super - - -class SaleOrderLineInherit(models.Model): - _inherit = 'sale.order.line' - - is_gift = fields.Boolean("Is Gift Product?", store=True) - - @api.model_create_multi - def create(self, vals_list): - call_super = super(SaleOrderLineInherit, self).create(vals_list) - for line in call_super: - if line.product_id: - line.is_gift = line.product_id.is_gift - return call_super diff --git a/odex25_donation/p_donation_gift/models/sale_report.py b/odex25_donation/p_donation_gift/models/sale_report.py deleted file mode 100644 index 021da3f70..000000000 --- a/odex25_donation/p_donation_gift/models/sale_report.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -from odoo import fields, models - - -class SaleReport(models.Model): - _inherit = "sale.report" - - is_gift = fields.Boolean("Order Contains Gift", readonly=True) - first_receiver_number = fields.Char("Receiver Number", readonly=True) - first_receiver_name = fields.Char("Receiver Name", readonly=True) - order_mobile_number = fields.Char("Donor Number", readonly=True) - order_name = fields.Char("Donor Name", readonly=True) - - def _select_additional_fields(self): - res = super()._select_additional_fields() - res['is_gift'] = "s.is_gift" - res['first_receiver_number'] = "s.first_receiver_number" - res['first_receiver_name'] = "s.first_receiver_name" - res['order_mobile_number'] = "s.order_mobile_number" - res['order_name'] = "s.order_name" - return res - - def _group_by_sale(self): - res = super()._group_by_sale() - res += """, - s.is_gift, s.first_receiver_number,s.first_receiver_name,s.order_mobile_number,s.order_name""" - return res diff --git a/odex25_donation/p_donation_gift/views/sale_view.xml b/odex25_donation/p_donation_gift/views/sale_view.xml deleted file mode 100644 index 8dbea2a8f..000000000 --- a/odex25_donation/p_donation_gift/views/sale_view.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - product.template.form.inherit - product.template - - - - - - - - - - extrafield.sale.order.form.view - sale.order - - - - - - -
- - - - - - -
-
-
-
- - - sale.report.form.view - sale.report - - - - - - - - - - - - - - - - - - - - - - sale.order.list.select - sale.order - - - - - - - - - - - - - - - - - - - - - - - - - - Group By Gift Sender Number - sale.order - [('is_gift', '=', True)] - - {'group_by': ['order_mobile_number']} - - - Group By Gift Sender Name - sale.order - [('is_gift', '=', True)] - - {'group_by': ['order_name']} - - - Group By Gift Receiver Number - sale.order - [('is_gift', '=', True)] - - {'group_by': ['first_receiver_number']} - - - Group By Gift Receiver Name - sale.order - [('is_gift', '=', True)] - - {'group_by': ['first_receiver_name']} - - - - - Group By Gift Sender Number - sale.report - [('is_gift', '=', True)] - - {'group_by': ['order_mobile_number']} - - - Group By Gift Sender Name - sale.report - [('is_gift', '=', True)] - - {'group_by': ['order_name']} - - - Group By Gift Receiver Number - sale.report - [('is_gift', '=', True)] - - {'group_by': ['first_receiver_number']} - - - Group By Gift Receiver Name - sale.report - [('is_gift', '=', True)] - - {'group_by': ['first_receiver_name']} - -
-
\ No newline at end of file diff --git a/odex25_donation/p_donation_gift/views/website_template.xml b/odex25_donation/p_donation_gift/views/website_template.xml deleted file mode 100644 index b13f8ed75..000000000 --- a/odex25_donation/p_donation_gift/views/website_template.xml +++ /dev/null @@ -1,136 +0,0 @@ - - - - - Product Item Grid: Donation Style - qweb - - - - - - - - -
- - -
- - - margin:5px 0px; #{'width: 100%;' if product.is_gift else ''} - - - - text-align: center !important; - #{'width: 90px;' if not product.is_gift else ''} - - - - - - - - - shop_layout: Donation Style - qweb - p_donation_gift.shop_layout - - - - - - - - - - diff --git a/odex25_donation/website_sale_checkout_limit/models/models.py b/odex25_donation/website_sale_checkout_limit/models/models.py index 447cfdd7e..ff6269e7e 100644 --- a/odex25_donation/website_sale_checkout_limit/models/models.py +++ b/odex25_donation/website_sale_checkout_limit/models/models.py @@ -18,7 +18,6 @@ class Website(models.Model): return False else: return True - elif min_amount_type == 'taxed': taxed_amount = order.amount_total if taxed_amount < float(min_checkout_amount): diff --git a/odex25_donation/website_sale_checkout_limit/views/templates.xml b/odex25_donation/website_sale_checkout_limit/views/templates.xml index 9d117d06b..0ed34eb1e 100644 --- a/odex25_donation/website_sale_checkout_limit/views/templates.xml +++ b/odex25_donation/website_sale_checkout_limit/views/templates.xml @@ -5,7 +5,7 @@ -
+
@@ -18,7 +18,7 @@