[ADD] spreadsheet_dashboard_website_sale,website_sale: add eCommerce dashboard
The `sale.report `field `is_abandoned_cart` is moved from module `website_sale_dashboard` to `website_sale`. This allows to use it in the eCommerce dashboard in the community edition. Task 3222991 closes odoo/odoo#121165 Related: odoo/enterprise#40979 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
@@ -0,0 +1,15 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': "Spreadsheet dashboard for eCommerce",
|
||||
'version': '1.0',
|
||||
'category': 'Hidden',
|
||||
'summary': 'Spreadsheet',
|
||||
'description': 'Spreadsheet',
|
||||
'depends': ['spreadsheet_dashboard', 'website_sale'],
|
||||
'data': [
|
||||
'data/dashboards.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': ['website_sale'],
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="spreadsheet_dashboard_ecommerce" model="spreadsheet.dashboard">
|
||||
<field name="name">eCommerce</field>
|
||||
<field name="spreadsheet_binary_data" type="base64" file="spreadsheet_dashboard_website_sale/data/files/ecommerce_dashboard.json"/>
|
||||
<field name="dashboard_group_id" ref="spreadsheet_dashboard.spreadsheet_dashboard_group_website"/>
|
||||
<field name="group_ids" eval="[Command.link(ref('sales_team.group_sale_manager'))]"/>
|
||||
<field name="sequence">200</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,14 +7,27 @@ class SaleReport(models.Model):
|
||||
_inherit = 'sale.report'
|
||||
|
||||
website_id = fields.Many2one('website', readonly=True)
|
||||
is_abandoned_cart = fields.Boolean(string="Abandoned Cart", readonly=True)
|
||||
|
||||
def _select_additional_fields(self):
|
||||
res = super()._select_additional_fields()
|
||||
res['website_id'] = "s.website_id"
|
||||
res['is_abandoned_cart'] = """
|
||||
s.date_order <= (timezone('utc', now()) - ((COALESCE(w.cart_abandoned_delay, '1.0') || ' hour')::INTERVAL))
|
||||
AND s.website_id IS NOT NULL
|
||||
AND s.state = 'draft'
|
||||
AND s.partner_id != %s""" % self.env.ref('base.public_partner').id
|
||||
return res
|
||||
|
||||
def _from_sale(self):
|
||||
res = super()._from_sale()
|
||||
res += """
|
||||
LEFT JOIN website w ON w.id = s.website_id"""
|
||||
return res
|
||||
|
||||
def _group_by_sale(self):
|
||||
res = super()._group_by_sale()
|
||||
res += """,
|
||||
s.website_id"""
|
||||
s.website_id,
|
||||
w.cart_abandoned_delay"""
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user