Skip to content

Commit

Permalink
[REF] crm_lead_sale_link: fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Osval Reyes committed Sep 27, 2016
1 parent 02cbc27 commit 1a26bf8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion crm_lead_sale_link/README.rst
Expand Up @@ -49,4 +49,4 @@ This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.
To contribute to this module, please visit http://odoo-community.org.
6 changes: 3 additions & 3 deletions crm_lead_sale_link/__openerp__.py
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
Expand All @@ -22,8 +22,8 @@

{
'name': 'CRM Lead Sale Link',
'version': '1.0',
'author': "Savoir-faire Linux,Odoo Community Association (OCA)",
'version': '8.0.1.0.0',
'author': "Savoir-faire Linux,Odoo Community Association (OCA), Vauxoo",
'license': 'AGPL-3',
'category': 'Others',
'summary': 'CRM Lead Sale Link',
Expand Down
20 changes: 10 additions & 10 deletions crm_lead_sale_link/models/crm_lead.py
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
Expand All @@ -23,29 +23,29 @@
from openerp import models, fields, api, _


sales_order_states = [
SALES_ORDER_STATES = [
'progress', 'manual', 'shipping_exept', 'invoice_except', 'done']

quotations_states = ['draft', 'sent', 'waiting_date']
QUOTATIONS_STATES = ['draft', 'sent', 'waiting_date']


class CrmLead(models.Model):
_inherit = 'crm.lead'

def count_sales_order(self):
def _compute_count_sales_order(self):
if not self.partner_id:
return False
self.sales_order_count = self.env['sale.order'].search_count([
('partner_id', '=', self.partner_id.id),
('state', 'in', sales_order_states),
('state', 'in', SALES_ORDER_STATES),
])
self.quotations_count = self.env['sale.order'].search_count([
('partner_id', '=', self.partner_id.id),
('state', 'in', quotations_states),
('state', 'in', QUOTATIONS_STATES),
])

sales_order_count = fields.Integer(compute='count_sales_order')
quotations_count = fields.Integer(compute='count_sales_order')
sales_order_count = fields.Integer(compute='_compute_count_sales_order')
quotations_count = fields.Integer(compute='_compute_count_sales_order')

@api.multi
def get_sale_order_view(self, order_states, view_title):
Expand Down Expand Up @@ -77,8 +77,8 @@ def get_sale_order_view(self, order_states, view_title):

@api.multi
def button_sales_orders(self):
return self.get_sale_order_view(sales_order_states, _('Sales Order'))
return self.get_sale_order_view(SALES_ORDER_STATES, _('Sales Order'))

@api.multi
def button_quotations(self):
return self.get_sale_order_view(quotations_states, _('Quotations'))
return self.get_sale_order_view(QUOTATIONS_STATES, _('Quotations'))
2 changes: 1 addition & 1 deletion crm_lead_sale_link/views/crm_lead_view.xml
Expand Up @@ -33,4 +33,4 @@
</field>
</record>
</data>
</openerp>
</openerp>

0 comments on commit 1a26bf8

Please sign in to comment.