[IMP] ensan_website_sale: product item gifting
This commit is contained in:
parent
e9f31e4134
commit
6607a679d1
|
|
@ -12,6 +12,7 @@
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'data/sms_data.xml',
|
'data/sms_data.xml',
|
||||||
'views/sale_order_views.xml',
|
'views/sale_order_views.xml',
|
||||||
'views/product_views.xml'
|
'views/product_views.xml',
|
||||||
|
'views/sale_report.xml',
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
from . import sale_order
|
from . import sale_order
|
||||||
from . import product
|
from . import product
|
||||||
|
from . import sale_report
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,31 @@
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.tools.json import scriptsafe as json_scriptsafe
|
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):
|
class SaleOrder_Inherit(models.Model):
|
||||||
_inherit = 'sale.order'
|
_inherit = 'sale.order'
|
||||||
|
|
||||||
|
|
@ -10,54 +34,44 @@ class SaleOrder_Inherit(models.Model):
|
||||||
order_name = fields.Char("Donor Name")
|
order_name = fields.Char("Donor Name")
|
||||||
sale_order_portal_url = fields.Char("Sale Order Url", compute="get_sale_order_portal_url")
|
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)
|
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):
|
def get_sale_order_portal_url(self):
|
||||||
for sale in 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()
|
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):
|
def _cart_update(self, *args, **kwargs):
|
||||||
res = super(SaleOrder_Inherit, self)._cart_update(*args, **kwargs)
|
res = super(SaleOrder_Inherit, self)._cart_update(*args, **kwargs)
|
||||||
|
|
||||||
order_line = self.env['sale.order.line'].browse(res.get('line_id'))
|
order_line = self.env['sale.order.line'].browse(res.get('line_id'))
|
||||||
qty = kwargs.get('add_qty', False) or kwargs.get('set_qty', False)
|
qty = kwargs.get('add_qty', False) or kwargs.get('set_qty', False)
|
||||||
|
|
||||||
if qty and order_line:
|
if qty and order_line:
|
||||||
self.convert_donation_qty_to_price(order_line, qty)
|
self.convert_donation_qty_to_price(order_line, qty)
|
||||||
|
|
||||||
if 'donators_ids' in kwargs:
|
if 'donators_ids' in kwargs:
|
||||||
order_line = self.env['sale.order.line'].browse(res.get('line_id')).sudo()
|
order_line = self.env['sale.order.line'].browse(res.get('line_id')).sudo()
|
||||||
order_line.extra_donators_ids.sudo().unlink()
|
order_line.extra_donators_ids.sudo().unlink()
|
||||||
extra_donators_ids = []
|
extra_donators_ids = []
|
||||||
|
gift_sender_name = None
|
||||||
|
gift_sender_mobile = None
|
||||||
for i in json_scriptsafe.loads(kwargs.get('donators_ids')):
|
for i in json_scriptsafe.loads(kwargs.get('donators_ids')):
|
||||||
extra_donators_ids.append((0, 0, {
|
extra_donators_ids.append((0, 0, {
|
||||||
'sale_id': order_line.order_id.id,
|
'sale_id': order_line.order_id.id,
|
||||||
'product_id': int(i.get('product_id')),
|
'product_id': int(i.get('product_id')),
|
||||||
'donated_amount': float(i.get('donated_amount')),
|
'donated_amount': float(i.get('donated_amount')),
|
||||||
'donator_name': i.get('donator_name'),
|
'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
|
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
|
return res
|
||||||
|
|
||||||
def convert_donation_qty_to_price(self, order_line, qty):
|
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]
|
sms_numbers=[donator.donator_mobile_number]
|
||||||
)
|
)
|
||||||
return call_super
|
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):
|
class ExtraDonators(models.Model):
|
||||||
|
|
@ -100,16 +137,17 @@ class ExtraDonators(models.Model):
|
||||||
sale_id = fields.Many2one("sale.order", string="Sale Order", ondelete='cascade')
|
sale_id = fields.Many2one("sale.order", string="Sale Order", ondelete='cascade')
|
||||||
product_id = fields.Many2one('product.product', string="Product", ondelete='cascade')
|
product_id = fields.Many2one('product.product', string="Product", ondelete='cascade')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SaleOrderLineInherit(models.Model):
|
class SaleOrderLineInherit(models.Model):
|
||||||
_inherit = 'sale.order.line'
|
_inherit = 'sale.order.line'
|
||||||
|
|
||||||
extra_donators_ids = fields.One2many('sale.order.extra_donators', 'line_id')
|
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()
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
@ -4,26 +4,131 @@
|
||||||
<record id="view_order_form" model="ir.ui.view">
|
<record id="view_order_form" model="ir.ui.view">
|
||||||
<field name="name">extrafield.sale.order.form.view</field>
|
<field name="name">extrafield.sale.order.form.view</field>
|
||||||
<field name="model">sale.order</field>
|
<field name="model">sale.order</field>
|
||||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
<field name="inherit_id" ref="sale.view_order_form" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='partner_id']" position="before">
|
<xpath expr="//field[@name='partner_id']" position="before">
|
||||||
<field name="order_name"/>
|
<field name="order_name" />
|
||||||
<field name="order_mobile_number"/>
|
<field name="order_mobile_number" />
|
||||||
<field name="done_with_quick_donation" readonly="1"/>
|
<field name="done_with_quick_donation" readonly="1" />
|
||||||
|
<field name="is_gift" string="Order Contains Gift?" />
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//notebook" position="inside">
|
<xpath expr="//notebook" position="inside">
|
||||||
<page name="extra_donators" string="Donators">
|
<page name="extra_donators" string="Donators">
|
||||||
<field name="donators_ids">
|
<field name="donators_ids">
|
||||||
<tree string="Donators">
|
<tree string="Donators">
|
||||||
<field name="product_id"/>
|
<field name="product_id" />
|
||||||
<field name="donator_name"/>
|
<field name="donator_name" />
|
||||||
<field name="donated_amount"/>
|
<field name="donated_amount" />
|
||||||
<field name="donator_mobile_number"/>
|
<field name="donator_mobile_number" />
|
||||||
</tree>
|
</tree>
|
||||||
|
<form>
|
||||||
|
<group>
|
||||||
|
<field name="product_id" />
|
||||||
|
<field name="donator_name" />
|
||||||
|
<field name="donated_amount" />
|
||||||
|
<field name="donator_mobile_number" />
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</odoo>
|
<record id="view_sales_order_filter" model="ir.ui.view">
|
||||||
|
<field name="name">sale.order.list.select</field>
|
||||||
|
<field name="model">sale.order</field>
|
||||||
|
<field name="inherit_id" ref="sale.view_sales_order_filter" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='analytic_account_id']" position="after">
|
||||||
|
<field name="first_receiver_number"
|
||||||
|
filter_domain="[('first_receiver_number', 'ilike', self)]" />
|
||||||
|
<field name="first_receiver_name"
|
||||||
|
filter_domain="[('first_receiver_name', 'ilike', self)]" />
|
||||||
|
<field name="order_mobile_number"
|
||||||
|
filter_domain="[('order_mobile_number', 'ilike', self)]" />
|
||||||
|
<field name="order_name" filter_domain="[('order_name', 'ilike', self)]" />
|
||||||
|
<separator />
|
||||||
|
<filter string="Order Contains Gift?" name="is_gift"
|
||||||
|
domain="[('is_gift', '=', True)]" />
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//filter[@name='order_month']" position="after">
|
||||||
|
<separator />
|
||||||
|
<filter string="Receiver Name" name="first_receiver_name" domain="[]"
|
||||||
|
context="{'group_by': 'first_receiver_name'}" />
|
||||||
|
<filter string="Receiver Number" name="first_receiver_number" domain="[]"
|
||||||
|
context="{'group_by': 'first_receiver_number'}" />
|
||||||
|
<separator />
|
||||||
|
<filter string="Sender Name" name="order_name" domain="[]"
|
||||||
|
context="{'group_by': 'order_name'}" />
|
||||||
|
<filter string="Sender Number" name="order_mobile_number" domain="[]"
|
||||||
|
context="{'group_by': 'order_mobile_number'}" />
|
||||||
|
<separator />
|
||||||
|
</xpath>
|
||||||
|
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!--Sales
|
||||||
|
Order:- Custom Group By Gift Filters-->
|
||||||
|
<record id="sale_filter_order_mobile_number" model="ir.filters">
|
||||||
|
<field name="name">Group By Gift Sender Number</field>
|
||||||
|
<field name="model_id">sale.order</field>
|
||||||
|
<field name="domain">[('is_gift', '=', True)]</field>
|
||||||
|
<field name="user_id" eval="False" />
|
||||||
|
<field name="context">{'group_by': ['order_mobile_number']}</field>
|
||||||
|
</record>
|
||||||
|
<record id="sale_filter_order_name" model="ir.filters">
|
||||||
|
<field name="name">Group By Gift Sender Name</field>
|
||||||
|
<field name="model_id">sale.order</field>
|
||||||
|
<field name="domain">[('is_gift', '=', True)]</field>
|
||||||
|
<field name="user_id" eval="False" />
|
||||||
|
<field name="context">{'group_by': ['order_name']}</field>
|
||||||
|
</record>
|
||||||
|
<record id="sale_filter_first_receiver_number" model="ir.filters">
|
||||||
|
<field name="name">Group By Gift Receiver Number</field>
|
||||||
|
<field name="model_id">sale.order</field>
|
||||||
|
<field name="domain">[('is_gift', '=', True)]</field>
|
||||||
|
<field name="user_id" eval="False" />
|
||||||
|
<field name="context">{'group_by': ['first_receiver_number']}</field>
|
||||||
|
</record>
|
||||||
|
<record id="sale_filter_first_receiver_name" model="ir.filters">
|
||||||
|
<field name="name">Group By Gift Receiver Name</field>
|
||||||
|
<field name="model_id">sale.order</field>
|
||||||
|
<field name="domain">[('is_gift', '=', True)]</field>
|
||||||
|
<field name="user_id" eval="False" />
|
||||||
|
<field name="context">{'group_by': ['first_receiver_name']}</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!--Online
|
||||||
|
Sales Report:- Custom Group By Gift Filters-->
|
||||||
|
<record id="sale_report_filter_order_mobile_number" model="ir.filters">
|
||||||
|
<field name="name">Group By Gift Sender Number</field>
|
||||||
|
<field name="model_id">sale.report</field>
|
||||||
|
<field name="domain">[('is_gift', '=', True)]</field>
|
||||||
|
<field name="user_id" eval="False" />
|
||||||
|
<field name="context">{'group_by': ['order_mobile_number']}</field>
|
||||||
|
</record>
|
||||||
|
<record id="sale_report_filter_order_name" model="ir.filters">
|
||||||
|
<field name="name">Group By Gift Sender Name</field>
|
||||||
|
<field name="model_id">sale.report</field>
|
||||||
|
<field name="domain">[('is_gift', '=', True)]</field>
|
||||||
|
<field name="user_id" eval="False" />
|
||||||
|
<field name="context">{'group_by': ['order_name']}</field>
|
||||||
|
</record>
|
||||||
|
<record id="sale_report_filter_first_receiver_number" model="ir.filters">
|
||||||
|
<field name="name">Group By Gift Receiver Number</field>
|
||||||
|
<field name="model_id">sale.report</field>
|
||||||
|
<field name="domain">[('is_gift', '=', True)]</field>
|
||||||
|
<field name="user_id" eval="False" />
|
||||||
|
<field name="context">{'group_by': ['first_receiver_number']}</field>
|
||||||
|
</record>
|
||||||
|
<record id="sale_report_filter_first_receiver_name" model="ir.filters">
|
||||||
|
<field name="name">Group By Gift Receiver Name</field>
|
||||||
|
<field name="model_id">sale.report</field>
|
||||||
|
<field name="domain">[('is_gift', '=', True)]</field>
|
||||||
|
<field name="user_id" eval="False" />
|
||||||
|
<field name="context">{'group_by': ['first_receiver_name']}</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="sale_report_view_search_website" model="ir.ui.view">
|
||||||
|
<field name="name">sale.report.form.view</field>
|
||||||
|
<field name="model">sale.report</field>
|
||||||
|
<field name="inherit_id" ref="website_sale.sale_report_view_search_website"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//filter[@name='confirmed']" position="after">
|
||||||
|
<field name="first_receiver_number" filter_domain="[('first_receiver_number', 'ilike', self)]"/>
|
||||||
|
<field name="first_receiver_name" filter_domain="[('first_receiver_name', 'ilike', self)]"/>
|
||||||
|
<field name="order_mobile_number" filter_domain="[('order_mobile_number', 'ilike', self)]"/>
|
||||||
|
<field name="order_name" filter_domain="[('order_name', 'ilike', self)]"/>
|
||||||
|
<separator/>
|
||||||
|
<filter string="Order Contains Gift?" name="is_gift" domain="[('is_gift', '=', True)]"/>
|
||||||
|
<separator/>
|
||||||
|
<filter string="Receiver Name" name="first_receiver_name" domain="[]"
|
||||||
|
context="{'group_by': 'first_receiver_name'}"/>
|
||||||
|
<filter string="Receiver Number" name="first_receiver_number" domain="[]"
|
||||||
|
context="{'group_by': 'first_receiver_number'}"/>
|
||||||
|
<separator/>
|
||||||
|
<filter string="Sender Name" name="order_name" domain="[]"
|
||||||
|
context="{'group_by': 'order_name'}"/>
|
||||||
|
<filter string="Sender Number" name="order_mobile_number" domain="[]"
|
||||||
|
context="{'group_by': 'order_mobile_number'}"/>
|
||||||
|
<separator/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
from . import controllers
|
from . import controllers
|
||||||
|
from . import models
|
||||||
|
|
|
||||||
|
|
@ -13,28 +13,31 @@ _logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class WebsiteSaleExtended(WebsiteSale):
|
class WebsiteSaleExtended(WebsiteSale):
|
||||||
|
|
||||||
@http.route()
|
# @http.route()
|
||||||
def cart_update(self, product_id, add_qty=1, set_qty=0, **kw):
|
# 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)
|
# res = super(WebsiteSaleExtended, self).cart_update(product_id, add_qty=add_qty, set_qty=set_qty, **kw)
|
||||||
sale_order = request.website.sale_get_order()
|
# sale_order = request.website.sale_get_order()
|
||||||
|
|
||||||
product_custom_attribute_values = None
|
# product_custom_attribute_values = None
|
||||||
if kw.get('product_custom_attribute_values'):
|
# if kw.get('product_custom_attribute_values'):
|
||||||
product_custom_attribute_values = json.loads(kw.pop('product_custom_attribute_values'))
|
# product_custom_attribute_values = json.loads(kw.pop('product_custom_attribute_values'))
|
||||||
|
|
||||||
no_variant_attribute_values = None
|
# no_variant_attribute_values = None
|
||||||
if kw.get('no_variant_attribute_values'):
|
# if kw.get('no_variant_attribute_values'):
|
||||||
no_variant_attribute_values = json.loads(kw.pop('no_variant_attribute_values'))
|
# no_variant_attribute_values = json.loads(kw.pop('no_variant_attribute_values'))
|
||||||
|
|
||||||
sale_order._cart_update(
|
# sale_order._cart_update(
|
||||||
product_id=int(product_id),
|
# product_id=int(product_id),
|
||||||
add_qty=add_qty,
|
# add_qty=0,
|
||||||
set_qty=set_qty,
|
# set_qty=set_qty,
|
||||||
product_custom_attribute_values=product_custom_attribute_values,
|
# product_custom_attribute_values=product_custom_attribute_values,
|
||||||
no_variant_attribute_values=no_variant_attribute_values,
|
# no_variant_attribute_values=no_variant_attribute_values,
|
||||||
**kw
|
# **kw
|
||||||
)
|
# )
|
||||||
return res
|
# 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()
|
@http.route()
|
||||||
def checkout(self, **post):
|
def checkout(self, **post):
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import ir_http
|
||||||
|
|
@ -12,7 +12,7 @@ odoo.define('ensan_website_sale.payment', require => {
|
||||||
},
|
},
|
||||||
checkMobileNumberFormat: function() {
|
checkMobileNumberFormat: function() {
|
||||||
const mobileInput = this.$('#order_mobile_number');
|
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())) {
|
if (mobileRegex.test(mobileInput.val())) {
|
||||||
mobileInput.removeClass('is-invalid').addClass('is-valid');
|
mobileInput.removeClass('is-invalid').addClass('is-valid');
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
odoo.define('p_donation_gift.gift', function (require) {
|
odoo.define('ensan_website_sale.gift', function (require) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
require('web.dom_ready');
|
require('web.dom_ready');
|
||||||
require('p_donation_theme.product-gift-card');
|
|
||||||
var publicWidget = require('web.public.widget');
|
var publicWidget = require('web.public.widget');
|
||||||
const { _t } = require('web.core');
|
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_name: gift_sender_name,
|
||||||
gift_sender_mobile: gift_sender_number
|
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('input[name=gift_redirect]').val('/shop/payment')
|
||||||
gift_form.find('button[type=submit]').click()
|
gift_form.find('button[type=submit]').click()
|
||||||
})
|
})
|
||||||
|
|
@ -5,11 +5,13 @@
|
||||||
<xpath expr="." position="inside">
|
<xpath expr="." position="inside">
|
||||||
<link rel="stylesheet" type="text/scss" href="/ensan_website_sale/static/src/scss/quick_donation.scss"/>
|
<link rel="stylesheet" type="text/scss" href="/ensan_website_sale/static/src/scss/quick_donation.scss"/>
|
||||||
<link rel="stylesheet" type="text/scss" href="/ensan_website_sale/static/src/scss/applepay_checkout.scss"/>
|
<link rel="stylesheet" type="text/scss" href="/ensan_website_sale/static/src/scss/applepay_checkout.scss"/>
|
||||||
|
<link rel="stylesheet" type="text/scss" href="/ensan_website_sale/static/src/scss/gift_popup.scss"/>
|
||||||
<script type="text/javascript" src="/ensan_website_sale/static/src/js/checkout.js"/>
|
<script type="text/javascript" src="/ensan_website_sale/static/src/js/checkout.js"/>
|
||||||
<script type="text/javascript" src="/ensan_website_sale/static/src/js/quick_donation.js"/>
|
<script type="text/javascript" src="/ensan_website_sale/static/src/js/quick_donation.js"/>
|
||||||
<script type="text/javascript" src="/ensan_website_sale/static/src/js/website_sale_tracking.js"/>
|
<script type="text/javascript" src="/ensan_website_sale/static/src/js/website_sale_tracking.js"/>
|
||||||
<script type="text/javascript" src="/ensan_website_sale/static/src/js/product_details_gifts.js"/>
|
<script type="text/javascript" src="/ensan_website_sale/static/src/js/product_details_gifts.js"/>
|
||||||
<script type="text/javascript" src="/ensan_website_sale/static/src/js/website_sale.js"/>
|
<script type="text/javascript" src="/ensan_website_sale/static/src/js/website_sale.js"/>
|
||||||
|
<script type="text/javascript" src="/ensan_website_sale/static/src/js/gift.js"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@
|
||||||
Your Name
|
Your Name
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="order_name" name="order_name"
|
<input type="text" id="order_name" name="order_name"
|
||||||
placeholder="Enter your name" />
|
placeholder="Enter your name"
|
||||||
|
t-att-value="website_sale_order.order_name" />
|
||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex align-items-left mt16">
|
<div class="d-flex align-items-left mt16">
|
||||||
|
|
@ -21,7 +22,7 @@
|
||||||
</label>
|
</label>
|
||||||
<input class="allow-ar-number" id="order_mobile_number"
|
<input class="allow-ar-number" id="order_mobile_number"
|
||||||
name="order_mobile_number" placeholder="05XXXXXXXX" maxlength="10"
|
name="order_mobile_number" placeholder="05XXXXXXXX" maxlength="10"
|
||||||
inputmode="numeric" />
|
inputmode="numeric" t-att-value="website_sale_order.order_mobile_number" />
|
||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -924,7 +925,9 @@
|
||||||
<input name="product-tracking-info" type="hidden"
|
<input name="product-tracking-info" type="hidden"
|
||||||
t-att-value="json.dumps(request.env['product.template'].get_google_analytics_data(combination_info))"
|
t-att-value="json.dumps(request.env['product.template'].get_google_analytics_data(combination_info))"
|
||||||
/> -->
|
/> -->
|
||||||
<input name="product_id" t-att-value="product_variant_id" type="hidden" />
|
<input type="hidden" name="product_id" t-att-value="product_variant_id" />
|
||||||
|
<input type="hidden" name="donate_list" value="" />
|
||||||
|
<input type="hidden" name="gift_redirect" value="" />
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//h6[hasclass('o_wsale_products_item_title')]" position="after">
|
<xpath expr="//h6[hasclass('o_wsale_products_item_title')]" position="after">
|
||||||
<button
|
<button
|
||||||
|
|
@ -1093,16 +1096,16 @@
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function checkDonationAmount(inputField) {
|
function checkDonationAmount(inputField) {
|
||||||
var language = document.documentElement.lang||"en" ;
|
var language = document.documentElement.lang||"en" ;
|
||||||
|
|
||||||
var enteredValue = inputField.value;
|
var enteredValue = inputField.value;
|
||||||
|
|
||||||
if (enteredValue === "0") {
|
if (enteredValue === "0") {
|
||||||
|
|
||||||
if (language === "en-US") {alert("Donation amount cannot be zero"); }
|
if (language === "en-US") {alert("Donation amount cannot be zero"); }
|
||||||
else{ alert("لا يمكن التبرع بقيمة صفر ");}
|
else{ alert("لا يمكن التبرع بقيمة صفر ");}
|
||||||
inputField.value = "";
|
inputField.value = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<span class="input-group-text bg-white border-start-0">
|
<span class="input-group-text bg-white border-start-0">
|
||||||
|
|
@ -1116,6 +1119,13 @@
|
||||||
aria-label="Donate Now">
|
aria-label="Donate Now">
|
||||||
Donate Now
|
Donate Now
|
||||||
</button>
|
</button>
|
||||||
|
<a t-if="product.is_gift" style="margin:5px 0px;" id="gift_product_popup_button"
|
||||||
|
href="#" role="button"
|
||||||
|
class="gift-product-button btn btn-secondary shadow-none rounded-pill"
|
||||||
|
t-att-data-product_id="product_variant_id"
|
||||||
|
t-att-data-product_name="product.name">
|
||||||
|
<i class="fa fa-gift" />
|
||||||
|
</a>
|
||||||
<a style="margin:5px 0px;" id="add_to_cart" href="#" role="button"
|
<a style="margin:5px 0px;" id="add_to_cart" href="#" role="button"
|
||||||
class="a-submit btn btn-secondary shadow-none rounded-pill"
|
class="a-submit btn btn-secondary shadow-none rounded-pill"
|
||||||
aria-label="Add to Cart">
|
aria-label="Add to Cart">
|
||||||
|
|
@ -1133,4 +1143,97 @@
|
||||||
<xpath expr="//div[hasclass('product_price')]" position="replace" />
|
<xpath expr="//div[hasclass('product_price')]" position="replace" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template id="products" inherit_id="website_sale.products">
|
||||||
|
<xpath expr="//div[@id='products_grid']" position="inside">
|
||||||
|
<div class="modal fade" id="action_gift_product_popup" tabindex="-1" role="dialog"
|
||||||
|
aria-labelledby="GiftProductPopup" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered modal-sm" role="document">
|
||||||
|
<div class="modal-content" style="border-radius:10px;">
|
||||||
|
<div class="modal-header">
|
||||||
|
<div id="gift-header">
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<i class="fa fa-gift" style="font-size:2rem;" />
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-9 mt-1" style="padding:0px 10px;">
|
||||||
|
<h5 class="modal-title">Donate on behalf of your family or
|
||||||
|
friends</h5>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1 mt-1">
|
||||||
|
<button id="gift-popup-close" class="btn btn-close"
|
||||||
|
type="button" aria-label="Close" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row"
|
||||||
|
style="border: 1px solid var(--o-color-1);border-radius: 10px !important;margin:1px;padding-bottom:10px">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<label class="col-form-label text-primary-blue font-bold">Sender
|
||||||
|
Name</label>
|
||||||
|
<input type="text"
|
||||||
|
class="form-control"
|
||||||
|
data-checkname="true" name="gift_sender_name" maxlength="25"
|
||||||
|
placeholder="Sender Name" />
|
||||||
|
<!-- <div class="valid-feedback">Valid Name!</div>-->
|
||||||
|
<div class="invalid-feedback">Invalid Name!</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<label class="col-form-label text-primary-blue font-bold"
|
||||||
|
for="gift_sender_number">Sender Mobile</label>
|
||||||
|
<div class="mobile-container"
|
||||||
|
role="group">
|
||||||
|
<input type="text"
|
||||||
|
class="donation-input-amt payment-input form-control only-number-with-paste number-input"
|
||||||
|
inputmode="numeric" pattern="[0-9]*" autocomplete="off"
|
||||||
|
data-val="true" maxlength="10"
|
||||||
|
placeholder="05xxxxxxxx"
|
||||||
|
name="gift_sender_number" id="gift_sender_number" />
|
||||||
|
<!-- <div class="valid-feedback">Valid Number!</div>-->
|
||||||
|
<div class="invalid-feedback">Invalid Number! It Should
|
||||||
|
start with 05 and minimum length 10</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<label class="col-form-label text-primary-blue font-bold">Receiver
|
||||||
|
Name</label>
|
||||||
|
<input type="text"
|
||||||
|
class="form-control"
|
||||||
|
data-checkname="true" name="gift_receiver_name"
|
||||||
|
maxlength="25"
|
||||||
|
placeholder="Receiver Name" />
|
||||||
|
<!-- <div class="valid-feedback">Valid Name!</div>-->
|
||||||
|
<div class="invalid-feedback">Invalid Name!</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<label class="col-form-label text-primary-blue font-bold"
|
||||||
|
for="gift_receiver_mobile">Receiver Mobile</label>
|
||||||
|
<div class="mobile-container"
|
||||||
|
role="group">
|
||||||
|
<input type="text"
|
||||||
|
class="donation-input-amt payment-input form-control only-number-with-paste number-input"
|
||||||
|
inputmode="numeric" pattern="[0-9]*" autocomplete="off"
|
||||||
|
data-val="true" maxlength="10"
|
||||||
|
placeholder="05xxxxxxxx"
|
||||||
|
name="gift_receiver_mobile" id="gift_receiver_mobile" />
|
||||||
|
<!-- <div class="valid-feedback">Valid Number!</div>-->
|
||||||
|
<div class="invalid-feedback">Invalid Number! It Should
|
||||||
|
start with 05 and minimum length 10</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row" id="gift-popup-buttons">
|
||||||
|
<div class="col-sm-12 mt-3 text-center">
|
||||||
|
<a style="margin:5px 1px;" width="100%" href="#" role="button"
|
||||||
|
class="btn btn-primary shadow-none rounded-pill"
|
||||||
|
aria-label="Dedicate Now">Dedicate Now</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</xpath>
|
||||||
|
</template>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
@ -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.
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from . import controllers
|
|
||||||
from . import models
|
|
||||||
|
|
@ -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',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
from . import main
|
|
||||||
|
|
@ -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
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 34 KiB |
|
|
@ -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 "رقم جوال المهدى له"
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from . import sale, product, sale_report, ir_http
|
|
||||||
|
|
@ -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")
|
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -1,149 +0,0 @@
|
||||||
<odoo>
|
|
||||||
<data>
|
|
||||||
|
|
||||||
<record id="product_template_inherit_form" model="ir.ui.view">
|
|
||||||
<field name="name">product.template.form.inherit</field>
|
|
||||||
<field name="model">product.template</field>
|
|
||||||
<field name="inherit_id" ref="p_donation_theme.product_template_inherit_form"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//field[@name='is_quick_donation']" position="before">
|
|
||||||
<field name="is_gift"/>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="view_order_form" model="ir.ui.view">
|
|
||||||
<field name="name">extrafield.sale.order.form.view</field>
|
|
||||||
<field name="model">sale.order</field>
|
|
||||||
<field name="inherit_id" ref="p_donation_theme.view_order_form"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//field[@name='done_with_quick_donation']" position="after">
|
|
||||||
<field name="is_gift" string="Order Contains Gift?"/>
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//field[@name='donators_ids']" position="inside">
|
|
||||||
<form>
|
|
||||||
<group>
|
|
||||||
<field name="product_id"/>
|
|
||||||
<field name="donator_name"/>
|
|
||||||
<field name="donated_amount"/>
|
|
||||||
<field name="donator_mobile_number"/>
|
|
||||||
</group>
|
|
||||||
</form>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="sale_report_view_search_website" model="ir.ui.view">
|
|
||||||
<field name="name">sale.report.form.view</field>
|
|
||||||
<field name="model">sale.report</field>
|
|
||||||
<field name="inherit_id" ref="website_sale.sale_report_view_search_website"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//filter[@name='confirmed']" position="after">
|
|
||||||
<field name="first_receiver_number" filter_domain="[('first_receiver_number', 'ilike', self)]"/>
|
|
||||||
<field name="first_receiver_name" filter_domain="[('first_receiver_name', 'ilike', self)]"/>
|
|
||||||
<field name="order_mobile_number" filter_domain="[('order_mobile_number', 'ilike', self)]"/>
|
|
||||||
<field name="order_name" filter_domain="[('order_name', 'ilike', self)]"/>
|
|
||||||
<separator/>
|
|
||||||
<filter string="Order Contains Gift?" name="is_gift" domain="[('is_gift', '=', True)]"/>
|
|
||||||
<separator/>
|
|
||||||
<filter string="Receiver Name" name="first_receiver_name" domain="[]"
|
|
||||||
context="{'group_by': 'first_receiver_name'}"/>
|
|
||||||
<filter string="Receiver Number" name="first_receiver_number" domain="[]"
|
|
||||||
context="{'group_by': 'first_receiver_number'}"/>
|
|
||||||
<separator/>
|
|
||||||
<filter string="Sender Name" name="order_name" domain="[]"
|
|
||||||
context="{'group_by': 'order_name'}"/>
|
|
||||||
<filter string="Sender Number" name="order_mobile_number" domain="[]"
|
|
||||||
context="{'group_by': 'order_mobile_number'}"/>
|
|
||||||
<separator/>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="view_sales_order_filter" model="ir.ui.view">
|
|
||||||
<field name="name">sale.order.list.select</field>
|
|
||||||
<field name="model">sale.order</field>
|
|
||||||
<field name="inherit_id" ref="sale.view_sales_order_filter"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//field[@name='analytic_account_id']" position="after">
|
|
||||||
<field name="first_receiver_number" filter_domain="[('first_receiver_number', 'ilike', self)]"/>
|
|
||||||
<field name="first_receiver_name" filter_domain="[('first_receiver_name', 'ilike', self)]"/>
|
|
||||||
<field name="order_mobile_number" filter_domain="[('order_mobile_number', 'ilike', self)]"/>
|
|
||||||
<field name="order_name" filter_domain="[('order_name', 'ilike', self)]"/>
|
|
||||||
<separator/>
|
|
||||||
<filter string="Order Contains Gift?" name="is_gift" domain="[('is_gift', '=', True)]"/>
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//filter[@name='order_month']" position="after">
|
|
||||||
<separator/>
|
|
||||||
<filter string="Receiver Name" name="first_receiver_name" domain="[]" context="{'group_by': 'first_receiver_name'}"/>
|
|
||||||
<filter string="Receiver Number" name="first_receiver_number" domain="[]" context="{'group_by': 'first_receiver_number'}"/>
|
|
||||||
<separator/>
|
|
||||||
<filter string="Sender Name" name="order_name" domain="[]" context="{'group_by': 'order_name'}"/>
|
|
||||||
<filter string="Sender Number" name="order_mobile_number" domain="[]" context="{'group_by': 'order_mobile_number'}"/>
|
|
||||||
<separator/>
|
|
||||||
</xpath>
|
|
||||||
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<!--Sales Order:- Custom Group By Gift Filters-->
|
|
||||||
<record id="sale_filter_order_mobile_number" model="ir.filters">
|
|
||||||
<field name="name">Group By Gift Sender Number</field>
|
|
||||||
<field name="model_id">sale.order</field>
|
|
||||||
<field name="domain">[('is_gift', '=', True)]</field>
|
|
||||||
<field name="user_id" eval="False"/>
|
|
||||||
<field name="context">{'group_by': ['order_mobile_number']}</field>
|
|
||||||
</record>
|
|
||||||
<record id="sale_filter_order_name" model="ir.filters">
|
|
||||||
<field name="name">Group By Gift Sender Name</field>
|
|
||||||
<field name="model_id">sale.order</field>
|
|
||||||
<field name="domain">[('is_gift', '=', True)]</field>
|
|
||||||
<field name="user_id" eval="False"/>
|
|
||||||
<field name="context">{'group_by': ['order_name']}</field>
|
|
||||||
</record>
|
|
||||||
<record id="sale_filter_first_receiver_number" model="ir.filters">
|
|
||||||
<field name="name">Group By Gift Receiver Number</field>
|
|
||||||
<field name="model_id">sale.order</field>
|
|
||||||
<field name="domain">[('is_gift', '=', True)]</field>
|
|
||||||
<field name="user_id" eval="False"/>
|
|
||||||
<field name="context">{'group_by': ['first_receiver_number']}</field>
|
|
||||||
</record>
|
|
||||||
<record id="sale_filter_first_receiver_name" model="ir.filters">
|
|
||||||
<field name="name">Group By Gift Receiver Name</field>
|
|
||||||
<field name="model_id">sale.order</field>
|
|
||||||
<field name="domain">[('is_gift', '=', True)]</field>
|
|
||||||
<field name="user_id" eval="False"/>
|
|
||||||
<field name="context">{'group_by': ['first_receiver_name']}</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<!--Online Sales Report:- Custom Group By Gift Filters-->
|
|
||||||
<record id="sale_report_filter_order_mobile_number" model="ir.filters">
|
|
||||||
<field name="name">Group By Gift Sender Number</field>
|
|
||||||
<field name="model_id">sale.report</field>
|
|
||||||
<field name="domain">[('is_gift', '=', True)]</field>
|
|
||||||
<field name="user_id" eval="False"/>
|
|
||||||
<field name="context">{'group_by': ['order_mobile_number']}</field>
|
|
||||||
</record>
|
|
||||||
<record id="sale_report_filter_order_name" model="ir.filters">
|
|
||||||
<field name="name">Group By Gift Sender Name</field>
|
|
||||||
<field name="model_id">sale.report</field>
|
|
||||||
<field name="domain">[('is_gift', '=', True)]</field>
|
|
||||||
<field name="user_id" eval="False"/>
|
|
||||||
<field name="context">{'group_by': ['order_name']}</field>
|
|
||||||
</record>
|
|
||||||
<record id="sale_report_filter_first_receiver_number" model="ir.filters">
|
|
||||||
<field name="name">Group By Gift Receiver Number</field>
|
|
||||||
<field name="model_id">sale.report</field>
|
|
||||||
<field name="domain">[('is_gift', '=', True)]</field>
|
|
||||||
<field name="user_id" eval="False"/>
|
|
||||||
<field name="context">{'group_by': ['first_receiver_number']}</field>
|
|
||||||
</record>
|
|
||||||
<record id="sale_report_filter_first_receiver_name" model="ir.filters">
|
|
||||||
<field name="name">Group By Gift Receiver Name</field>
|
|
||||||
<field name="model_id">sale.report</field>
|
|
||||||
<field name="domain">[('is_gift', '=', True)]</field>
|
|
||||||
<field name="user_id" eval="False"/>
|
|
||||||
<field name="context">{'group_by': ['first_receiver_name']}</field>
|
|
||||||
</record>
|
|
||||||
</data>
|
|
||||||
</odoo>
|
|
||||||
|
|
@ -1,136 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<odoo>
|
|
||||||
|
|
||||||
<record id="product_item_grid_3" model="ir.ui.view">
|
|
||||||
<field name="name">Product Item Grid: Donation Style</field>
|
|
||||||
<field name="type">qweb</field>
|
|
||||||
<field name="inherit_id" ref="p_donation_theme.product_item_grid_3"/>
|
|
||||||
<field name="website_id" eval="1"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//input[@name='csrf_token']" position="after">
|
|
||||||
<input type="hidden" name="donate_list" value=""/>
|
|
||||||
<input type="hidden" name="gift_redirect" value=""/>
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//button[@type='submit']" position="after">
|
|
||||||
<a t-if="product.is_gift" style="margin:5px 0px;" id="gift_product_popup_button" href="#" role="button"
|
|
||||||
class="gift-product-button btn btn-secondary shadow-none rounded-pill"
|
|
||||||
t-att-data-product_id="product_variant_id" t-att-data-product_name="product.name">
|
|
||||||
<i class="fa fa-gift"/>
|
|
||||||
</a>
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//input[hasclass('donation-product-detail-layout')]/.." position="attributes">
|
|
||||||
<attribute name="style"></attribute>
|
|
||||||
<attribute name="t-attf-style">margin:5px 0px; #{'width: 100%;' if product.is_gift else ''}</attribute>
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//input[hasclass('donation-product-detail-layout')]" position="attributes">
|
|
||||||
<attribute name="style"></attribute>
|
|
||||||
<attribute name="t-attf-style">text-align: center !important;
|
|
||||||
#{'width: 90px;' if not product.is_gift else ''}
|
|
||||||
</attribute>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<template id="payment_sale_extra_field" inherit_id="p_donation_theme.payment_sale_extra_field"
|
|
||||||
name="Gift: Order Extra Fields">
|
|
||||||
<xpath expr="//input[@name='order_name']" position="attributes">
|
|
||||||
<attribute name="t-att-value">website_sale_order.order_name</attribute>
|
|
||||||
</xpath>
|
|
||||||
<xpath expr="//input[@name='order_mobile_number']" position="attributes">
|
|
||||||
<attribute name="t-att-value">website_sale_order.order_mobile_number</attribute>
|
|
||||||
</xpath>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<record id="shop_layout" model="ir.ui.view">
|
|
||||||
<field name="name">shop_layout: Donation Style</field>
|
|
||||||
<field name="type">qweb</field>
|
|
||||||
<field name="key">p_donation_gift.shop_layout</field>
|
|
||||||
<field name="inherit_id" search="[('website_id', '=', 1), ('key', '=', 'theme_prime.shop_layout')]"/>
|
|
||||||
<field name="website_id" eval="1"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//div[@id='products_grid']" position="inside">
|
|
||||||
<div class="modal fade" id="action_gift_product_popup" tabindex="-1" role="dialog"
|
|
||||||
aria-labelledby="GiftProductPopup" aria-hidden="true">
|
|
||||||
<div class="modal-dialog modal-dialog-centered modal-sm" role="document">
|
|
||||||
<div class="modal-content" style="border-radius:10px;">
|
|
||||||
<div class="modal-header">
|
|
||||||
<div id="gift-header">
|
|
||||||
<div class="col-sm-2">
|
|
||||||
<i class="fa fa-gift" style="font-size:2rem;"/>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-9 mt-1" style="padding:0px 10px;">
|
|
||||||
<h5 class="modal-title">Donate on behalf of your family or friends</h5>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-1 mt-1">
|
|
||||||
<button id="gift-popup-close" class="btn btn-close" type="button" aria-label="Close"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="row"
|
|
||||||
style="border: 1px solid var(--o-color-1);border-radius: 10px !important;margin:1px;padding-bottom:10px">
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<label class="col-form-label text-primary-blue font-bold">Sender Name</label>
|
|
||||||
<input type="text"
|
|
||||||
class="form-control"
|
|
||||||
data-checkname="true" name="gift_sender_name" maxlength="25"
|
|
||||||
placeholder="Sender Name"/>
|
|
||||||
<!-- <div class="valid-feedback">Valid Name!</div>-->
|
|
||||||
<div class="invalid-feedback">Invalid Name!</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<label class="col-form-label text-primary-blue font-bold"
|
|
||||||
for="gift_sender_number">Sender Mobile</label>
|
|
||||||
<div class="mobile-container"
|
|
||||||
role="group">
|
|
||||||
<input type="text"
|
|
||||||
class="donation-input-amt payment-input form-control only-number-with-paste number-input"
|
|
||||||
inputmode="numeric" pattern="[0-9]*" autocomplete="off"
|
|
||||||
data-val="true" maxlength="10"
|
|
||||||
placeholder="05xxxxxxxx"
|
|
||||||
name="gift_sender_number" id="gift_sender_number"/>
|
|
||||||
<!-- <div class="valid-feedback">Valid Number!</div>-->
|
|
||||||
<div class="invalid-feedback">Invalid Number! It Should start with 05 and minimum length 10</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<label class="col-form-label text-primary-blue font-bold">Receiver Name</label>
|
|
||||||
<input type="text"
|
|
||||||
class="form-control"
|
|
||||||
data-checkname="true" name="gift_receiver_name" maxlength="25"
|
|
||||||
placeholder="Receiver Name"/>
|
|
||||||
<!-- <div class="valid-feedback">Valid Name!</div>-->
|
|
||||||
<div class="invalid-feedback">Invalid Name!</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<label class="col-form-label text-primary-blue font-bold" for="gift_receiver_mobile">Receiver Mobile</label>
|
|
||||||
<div class="mobile-container"
|
|
||||||
role="group">
|
|
||||||
<input type="text"
|
|
||||||
class="donation-input-amt payment-input form-control only-number-with-paste number-input"
|
|
||||||
inputmode="numeric" pattern="[0-9]*" autocomplete="off"
|
|
||||||
data-val="true" maxlength="10"
|
|
||||||
placeholder="05xxxxxxxx"
|
|
||||||
name="gift_receiver_mobile" id="gift_receiver_mobile"/>
|
|
||||||
<!-- <div class="valid-feedback">Valid Number!</div>-->
|
|
||||||
<div class="invalid-feedback">Invalid Number! It Should start with 05 and minimum length 10</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" id="gift-popup-buttons">
|
|
||||||
<div class="col-sm-12 mt-3 text-center">
|
|
||||||
<a style="margin:5px 1px;" width="100%" href="#" role="button"
|
|
||||||
class="btn btn-primary shadow-none rounded-pill"
|
|
||||||
aria-label="Dedicate Now">Dedicate Now</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</odoo>
|
|
||||||
|
|
@ -18,7 +18,6 @@ class Website(models.Model):
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
elif min_amount_type == 'taxed':
|
elif min_amount_type == 'taxed':
|
||||||
taxed_amount = order.amount_total
|
taxed_amount = order.amount_total
|
||||||
if taxed_amount < float(min_checkout_amount):
|
if taxed_amount < float(min_checkout_amount):
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<xpath expr="//div[hasclass('row')]/div" position="after">
|
<xpath expr="//div[hasclass('row')]/div" position="after">
|
||||||
<t t-set="min_amount" t-value="website.check_cart_amount()"/>
|
<t t-set="min_amount" t-value="website.check_cart_amount()"/>
|
||||||
<t t-set="message" t-value="website.info_message()"/>
|
<t t-set="message" t-value="website.info_message()"/>
|
||||||
<div id="message" t-attf-class="col-12 #{'d-none' if min_amount else ''}">
|
<div id="message" t-attf-class="col-12 {{'d-none' if min_amount else ''}}">
|
||||||
<div class="alert alert-warning my-2">
|
<div class="alert alert-warning my-2">
|
||||||
<em>
|
<em>
|
||||||
<i class="fa fa-info-circle"/>
|
<i class="fa fa-info-circle"/>
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<template id="short_cart_summary" inherit_id="website_sale.short_cart_summary">
|
<template id="short_cart_summary" inherit_id="website_sale.short_cart_summary">
|
||||||
<xpath expr="//a" position="attributes">
|
<xpath expr="//a" position="attributes">
|
||||||
<attribute name="t-attf-class">btn btn-secondary float-right d-none d-xl-inline-block checkout_one #{"disabled" if not website.check_cart_amount() else ""}</attribute>
|
<attribute name="t-attf-class">btn btn-secondary float-right d-none d-xl-inline-block checkout_one {{"disabled" if not website.check_cart_amount() else ""}}</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue