Browse Source

[FIX] Correct pylint in all partner_sector repo

pull/615/head
mreficent 6 years ago
parent
commit
7d56c21acc
  1. 2
      partner_changeset/README.rst
  2. 15
      partner_changeset/models/res_partner.py
  3. 40
      partner_changeset/models/res_partner_changeset.py
  4. 5
      partner_contact_height/README.rst
  5. 5
      partner_contact_nutrition/README.rst
  6. 5
      partner_contact_weight/README.rst
  7. 2
      partner_identification/README.rst
  8. 8
      partner_identification/__openerp__.py

2
partner_changeset/README.rst

@ -136,7 +136,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues Bugs are tracked on `GitHub Issues
<https://github.com/OCA/partner-contact/issues>`_. In case of trouble, please <https://github.com/OCA/partner-contact/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first, check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed `feedback
help us smash it by providing detailed and welcomed feedback.
Credits Credits
======= =======

15
partner_changeset/models/res_partner.py

@ -14,16 +14,16 @@ class ResPartner(models.Model):
readonly=True) readonly=True)
count_pending_changesets = fields.Integer( count_pending_changesets = fields.Integer(
string='Changes', string='Changes',
compute='_count_pending_changesets',
compute='_compute_count_pending_changesets',
search='_search_count_pending_changesets') search='_search_count_pending_changesets')
@api.one
@api.depends('changeset_ids', 'changeset_ids.state') @api.depends('changeset_ids', 'changeset_ids.state')
def _count_pending_changesets(self):
changesets = self.changeset_ids.filtered(
lambda rev: rev.state == 'draft' and rev.partner_id == self
)
self.count_pending_changesets = len(changesets)
def _compute_count_pending_changesets(self):
for res in self:
changesets = res.changeset_ids.filtered(
lambda rev: rev.state == 'draft' and rev.partner_id == res
)
res.count_pending_changesets = len(changesets)
@api.multi @api.multi
def write(self, values): def write(self, values):
@ -39,6 +39,7 @@ class ResPartner(models.Model):
def _search_count_pending_changesets(self, operator, value): def _search_count_pending_changesets(self, operator, value):
if operator not in ('=', '!=', '<', '<=', '>', '>=', 'in', 'not in'): if operator not in ('=', '!=', '<', '<=', '>', '>=', 'in', 'not in'):
return [] return []
# pylint: disable=sql-injection
query = ("SELECT p.id " query = ("SELECT p.id "
"FROM res_partner p " "FROM res_partner p "
"INNER JOIN res_partner_changeset r ON r.partner_id = p.id " "INNER JOIN res_partner_changeset r ON r.partner_id = p.id "

40
partner_changeset/models/res_partner_changeset.py

@ -52,14 +52,14 @@ class ResPartnerChangeset(models.Model):
models = self.env['ir.model'].search([]) models = self.env['ir.model'].search([])
return [(model.model, model.name) for model in models] return [(model.model, model.name) for model in models]
@api.one
@api.depends('change_ids', 'change_ids.state') @api.depends('change_ids', 'change_ids.state')
def _compute_state(self): def _compute_state(self):
if all(change.state in ('done', 'cancel') for change
in self.mapped('change_ids')):
self.state = 'done'
else:
self.state = 'draft'
for res in self:
if all(change.state in ('done', 'cancel') for change
in res.mapped('change_ids')):
res.state = 'done'
else:
res.state = 'draft'
@api.multi @api.multi
def apply(self): def apply(self):
@ -306,25 +306,25 @@ class ResPartnerChangesetChange(models.Model):
_old_value_fields + _old_value_fields +
_new_value_fields) _new_value_fields)
@api.one
@api.depends('changeset_id.partner_id') @api.depends('changeset_id.partner_id')
def _compute_origin_values(self): def _compute_origin_values(self):
field_name = self.get_field_for_type(self.field_id, 'origin')
if self.state == 'draft':
value = self.changeset_id.partner_id[self.field_id.name]
else:
old_field = self.get_field_for_type(self.field_id, 'old')
value = self[old_field]
setattr(self, field_name, value)
for res in self:
field_name = res.get_field_for_type(res.field_id, 'origin')
if res.state == 'draft':
value = res.changeset_id.partner_id[res.field_id.name]
else:
old_field = res.get_field_for_type(res.field_id, 'old')
value = res[old_field]
setattr(res, field_name, value)
@api.one
@api.depends(lambda self: self._value_fields) @api.depends(lambda self: self._value_fields)
def _compute_value_display(self): def _compute_value_display(self):
for prefix in ('origin', 'new'):
value = getattr(self, 'get_%s_value' % prefix)()
if self.field_id.ttype == 'many2one' and value:
value = value.display_name
setattr(self, '%s_value_display' % prefix, value)
for res in self:
for prefix in ('origin', 'new'):
value = getattr(res, 'get_%s_value' % prefix)()
if res.field_id.ttype == 'many2one' and value:
value = value.display_name
setattr(res, '%s_value_display' % prefix, value)
@api.model @api.model
def get_field_for_type(self, field, prefix): def get_field_for_type(self, field, prefix):

5
partner_contact_height/README.rst

@ -21,11 +21,6 @@ To use this module, you need to:
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/134/9.0 :target: https://runbot.odoo-community.org/runbot/134/9.0
Known issues / Roadmap
======================
* ...
Bug Tracker Bug Tracker
=========== ===========

5
partner_contact_nutrition/README.rst

@ -26,11 +26,6 @@ To use this module, you need to:
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/134/9.0 :target: https://runbot.odoo-community.org/runbot/134/9.0
Known issues / Roadmap
======================
* ...
Bug Tracker Bug Tracker
=========== ===========

5
partner_contact_weight/README.rst

@ -21,11 +21,6 @@ To use this module, you need to:
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/134/9.0 :target: https://runbot.odoo-community.org/runbot/134/9.0
Known issues / Roadmap
======================
* ...
Bug Tracker Bug Tracker
=========== ===========

2
partner_identification/README.rst

@ -15,7 +15,7 @@ and vary from country to country.
* Fiscal ID's * Fiscal ID's
* Membership numbers * Membership numbers
* Driver license * Driver license
* ...
*
Installation Installation

8
partner_identification/__openerp__.py

@ -19,10 +19,10 @@
'security/ir.model.access.csv', 'security/ir.model.access.csv',
], ],
'author': 'ChriCar Beteiligungs- und Beratungs- GmbH, ' 'author': 'ChriCar Beteiligungs- und Beratungs- GmbH, '
'Antiun Ingeniería S.L.',
'Camptocamp,'
'ACSONE SA/NV,'
'Odoo Community Association (OCA)'
'Antiun Ingeniería S.L., '
'Camptocamp, '
'ACSONE SA/NV, '
'Odoo Community Association (OCA)',
'website': 'https://odoo-community.org/', 'website': 'https://odoo-community.org/',
'license': 'AGPL-3', 'license': 'AGPL-3',
'installable': True, 'installable': True,

Loading…
Cancel
Save