Commit 32139ab4 by François C.

Merge branch…

Merge branch '5873-really-prevent-special-status-to-be-lost-when-adding-capital-shares' into 'dev_cooperatic'

5873 really prevent special status to be lost when adding capital shares

See merge request !75
parents 0272b2df 66bdebd2
......@@ -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', 'unsubscribed', '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'
......@@ -46,8 +45,11 @@ class ResPartner(models.Model):
('up_to_date', 'Up to date'),
('alert', 'Alert'),
('suspended', 'Suspended'),
('unsubscribed', 'Unsubscribed'),
('delay', 'Delay'),
('blocked', 'Blocked'),
('gone', 'Gone'), # Used by La Cagette and followers
('associated', 'Associated') # Used by La Cagette and followers
]
# Columns Section
......
......@@ -16,7 +16,7 @@
#
'category': 'Uncategorized',
'version': '0.0.6',
'version': '0.0.7.2',
# any module necessary for this one to work correctly
'depends': ['base', 'coop_membership', 'coop_shift'],
......@@ -27,6 +27,7 @@
'data/ir_config_parameter_data.xml',
'static/src/xml/templates.xml',
'views/res_partner.xml',
'views/actions.xml'
],
'installable': True,
......
......@@ -18,7 +18,7 @@ EXTRA_COOPERATIVE_STATE_SELECTION = [
('vacation', 'On Vacation'),
('up_to_date', 'Up to date'),
('alert', 'Alert'),
('suspended', 'Suspended'),
('suspended', 'Suspended'), # translated as Rattrapage in LaCagette external app. context
('delay', 'Delay'),
('blocked', 'Blocked'),
('unpayed', 'Unpayed'),
......@@ -44,6 +44,12 @@ class ResPartner(models.Model):
"Number of shift done with both of the associate",
default= 0)
@api.multi
def recompute_member_states(self):
for record in self:
record._compute_working_state()
record._compute_cooperative_state()
@api.model
def run_process_target_status(self):
"""Method called by cron task"""
......@@ -166,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}
......
<?xml version="1.0"?>
<odoo>
<record id="res_partner_recompute_cooperative_state" model="ir.actions.server">
<field name="name">Recompute member status</field>
<field name="model_id" ref="lacagette_membership.model_res_partner" />
<field name="state">code</field>
<field name="code">action = self.recompute_member_states(cr, uid, context.get('active_ids', []), context=context)</field>
</record>
<record id="action_recompute_partner_status" model="ir.values">
<field name="model_id" ref="base.model_res_partner" />
<field name="name">Recompute member status</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.server,%d'%res_partner_recompute_cooperative_state" />
<field name="key">action</field>
<field name="model">res.partner</field>
</record>
</odoo>
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