Commit 7bfade61 by Odoo

Prevent gone and associated status to be lost where _compute_cooperative_state is called

parent b00fcdad
......@@ -6,7 +6,7 @@
{
'name': 'Coop - Membership',
'version': '9.0.2.0.0',
'version': '9.0.2.0.1',
'category': 'Custom',
'summary': 'Custom settings for membership',
'author': 'La Louve',
......
......@@ -16,7 +16,6 @@ from openerp import SUPERUSER_ID
from lxml import etree
from openerp.osv.orm import setup_modifiers
EXTRA_COOPERATIVE_STATE_SELECTION = [
('not_concerned', 'Not Concerned'),
('unsubscribed', 'Unsubscribed'),
......@@ -28,13 +27,15 @@ EXTRA_COOPERATIVE_STATE_SELECTION = [
('delay', 'Delay'),
('blocked', 'Blocked'),
('unpayed', 'Unpayed'),
('gone', 'Gone'), # Used by LaCagette and followers
('associated', 'Associated') # Used by LaCagette and followers
]
class ResPartner(models.Model):
_inherit = 'res.partner'
COOPERATIVE_STATE_CUSTOMER = ['up_to_date', 'alert', 'delay', 'exempted']
COOPERATIVE_STATE_CUSTOMER = ['up_to_date', 'alert', 'delay', 'exempted', 'gone', 'associated']
SEX_SELECTION = [
('m', 'male'),
......@@ -328,7 +329,9 @@ class ResPartner(models.Model):
@api.multi
def _compute_cooperative_state(self):
for partner in self:
if partner.is_associated_people:
if partner.working_state in ['gone', 'associated']:
partner.cooperative_state = partner.working_state
elif partner.is_associated_people:
# Associated People
partner.cooperative_state = partner.parent_id.cooperative_state
elif partner.is_worker_member:
......
......@@ -21,6 +21,8 @@ On Partners, it creates a new state 'working_state' with the following value:
('suspended', 'Suspended'),
('delay', 'Delay'),
('blocked', 'Blocked'),
('gone', 'Gone'),
('associated', 'Associated')
Configuration
=============
......
......@@ -7,7 +7,7 @@
{
'name': 'Coop Shift',
'version': '9.0.7.0.0',
'version': '9.0.7.0.1',
'category': 'Tools',
'author': 'Julien WESTE, Sylvain LE GAL, Cyril Gaspard, La Louve',
'website': 'http://www.lalouve.net',
......
......@@ -30,7 +30,6 @@ from openerp.exceptions import ValidationError
from .date_tools import conflict_period
class ResPartner(models.Model):
_inherit = 'res.partner'
......@@ -48,6 +47,8 @@ class ResPartner(models.Model):
('suspended', 'Suspended'),
('delay', 'Delay'),
('blocked', 'Blocked'),
('gone', 'Gone'), # Used by La Cagette and followers
('associated', 'Associated') # Used by La Cagette and followers
]
# Columns Section
......
......@@ -172,7 +172,7 @@ class ResPartner(models.Model):
def set_special_state(self, cr, uid, partner, context=None):
if partner['state'] == 'cancel_special':
partner['state'] = 'unsubscribed'
return self.write(cr, uid, [partner['id']], {'cooperative_state': partner['state']} , context=context)
return self.write(cr, uid, [partner['id']], {'cooperative_state': partner['state'], 'working_state': partner['state']} , context=context)
def _write_state_change(self, state):
data = {'member_id': self.id, 'state': state}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment