[REM] sale_crm: long-dead code

odoo/odoo#42015 removed code supporting the sales/CRM dashboards which
hadn't been a thing for two years at that point.

This is doubly dead code as it's an override for the dead code which
has already been removed for a feature which hasn't existed since
2017.

Issue 2285940

closes odoo/odoo#53891

X-original-commit: 1d73a1a7c52fcc3a3ab29446b9ca3b6e4d95b451
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
Xavier Morel
2020-07-01 07:02:59 +00:00
parent 7fd7422647
commit 3e39dcba52
-30
View File
@@ -32,36 +32,6 @@ class CrmLead(models.Model):
lead.quotation_count = quotation_cnt
lead.sale_order_count = sale_order_cnt
@api.model
def retrieve_sales_dashboard(self):
res = super(CrmLead, self).retrieve_sales_dashboard()
date_today = fields.Date.from_string(fields.Date.context_today(self))
res['invoiced'] = {
'this_month': 0,
'last_month': 0,
}
account_invoice_domain = [
('state', '=', 'posted'),
('invoice_user_id', '=', self.env.uid),
('invoice_date', '>=', date_today.replace(day=1) - relativedelta(months=+1)),
('move_type', 'in', ['out_invoice', 'out_refund'])
]
invoice_data = self.env['account.move'].search_read(account_invoice_domain, ['invoice_date', 'amount_untaxed', 'move_type'])
for invoice in invoice_data:
if invoice['invoice_date']:
invoice_date = fields.Date.from_string(invoice['invoice_date'])
sign = 1 if invoice['move_type'] == 'out_invoice' else -1
if invoice_date <= date_today and invoice_date >= date_today.replace(day=1):
res['invoiced']['this_month'] += sign * invoice['amount_untaxed']
elif invoice_date < date_today.replace(day=1) and invoice_date >= date_today.replace(day=1) - relativedelta(months=+1):
res['invoiced']['last_month'] += sign * invoice['amount_untaxed']
res['invoiced']['target'] = self.env.user.target_sales_invoiced
return res
def action_sale_quotations_new(self):
if not self.partner_id:
return self.env.ref("sale_crm.crm_quotation_partner_action").read()[0]