forked from Yaltik/golem
[IMP]GOLEM Member numbers now generated only after memberships
This commit is contained in:
parent
ad003e27f5
commit
25d2f6ac62
@ -20,7 +20,7 @@
|
|||||||
'name': 'GOLEM non-profit members',
|
'name': 'GOLEM non-profit members',
|
||||||
'summary': 'Extends Odoo contacts for MJC',
|
'summary': 'Extends Odoo contacts for MJC',
|
||||||
'description': 'Extends Odoo contacts for MJC',
|
'description': 'Extends Odoo contacts for MJC',
|
||||||
'version': '10.0.2.0.0',
|
'version': '10.0.2.1.0',
|
||||||
'category': 'GOLEM',
|
'category': 'GOLEM',
|
||||||
'author': 'Fabien Bourgeois, Michel Dessenne',
|
'author': 'Fabien Bourgeois, Michel Dessenne',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
@ -66,6 +66,19 @@ class ResPartner(models.Model):
|
|||||||
gm_obj = self.env['golem.member']
|
gm_obj = self.env['golem.member']
|
||||||
gm_obj.create({'partner_id': self[0].id})
|
gm_obj.create({'partner_id': self[0].id})
|
||||||
|
|
||||||
|
class GolemMembershipInvoice(models.TransientModel):
|
||||||
|
""" GOLEM Membership Invoice adaptations """
|
||||||
|
_inherit = 'golem.membership.invoice'
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def membership_invoice(self):
|
||||||
|
""" Extend invoice generation with number generation """
|
||||||
|
self.ensure_one()
|
||||||
|
res = super(GolemMembershipInvoice, self).membership_invoice()
|
||||||
|
if self.partner_id.member_id:
|
||||||
|
self.partner_id.member_id.generate_number()
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
class GolemMember(models.Model):
|
class GolemMember(models.Model):
|
||||||
""" GOLEM Member model """
|
""" GOLEM Member model """
|
||||||
@ -210,7 +223,7 @@ class GolemMember(models.Model):
|
|||||||
isauto = conf.get_param('golem_numberconfig_isautomatic') == '1'
|
isauto = conf.get_param('golem_numberconfig_isautomatic') == '1'
|
||||||
isperseason = conf.get_param('golem_numberconfig_isperseason') == '1'
|
isperseason = conf.get_param('golem_numberconfig_isperseason') == '1'
|
||||||
isfornew = conf.get_param('golem_numberconfig_isfornewmembersonly') == '1'
|
isfornew = conf.get_param('golem_numberconfig_isfornewmembersonly') == '1'
|
||||||
for member in self:
|
for member in self.filtered(lambda m: m.membership_state != 'none'):
|
||||||
if not isauto or (isfornew and member.number_manual):
|
if not isauto or (isfornew and member.number_manual):
|
||||||
member.number = member.number_manual
|
member.number = member.number_manual
|
||||||
else:
|
else:
|
||||||
@ -219,13 +232,6 @@ class GolemMember(models.Model):
|
|||||||
else:
|
else:
|
||||||
member.number = member.generate_number_global()
|
member.number = member.generate_number_global()
|
||||||
|
|
||||||
@api.model
|
|
||||||
def create(self, values):
|
|
||||||
""" Number generation after creation """
|
|
||||||
new_member = super(GolemMember, self).create(values)
|
|
||||||
new_member.generate_number()
|
|
||||||
return new_member
|
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def write(self, values):
|
def write(self, values):
|
||||||
""" Number generation after updates """
|
""" Number generation after updates """
|
||||||
@ -318,7 +324,10 @@ class GolemNumberConfig(models.TransientModel):
|
|||||||
self.env['golem.season'].search([]).write({
|
self.env['golem.season'].search([]).write({
|
||||||
'member_counter': int(self.number_from)
|
'member_counter': int(self.number_from)
|
||||||
})
|
})
|
||||||
self.env['golem.member'].search([]).generate_number()
|
member_obj = self.env['golem.member']
|
||||||
|
member_obj.search([('membership_state', '=', 'none')]).write({'number': False})
|
||||||
|
member_obj.search([('membership_state', '!=', 'none')]).generate_number()
|
||||||
|
return {'type': 'ir.actions.client', 'tag': 'reload'}
|
||||||
|
|
||||||
|
|
||||||
class MergePartnerAutomatic(models.TransientModel):
|
class MergePartnerAutomatic(models.TransientModel):
|
||||||
|
@ -68,10 +68,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<field name="lastname" required="True" />
|
<field name="lastname" required="True" />
|
||||||
<field name="firstname" required="True" />
|
<field name="firstname" required="True" />
|
||||||
<field name="number" readonly="True"
|
<field name="number" readonly="True"
|
||||||
attrs="{'invisible': [('is_number_manual', '=', True)]}" />
|
attrs="{'invisible': ['|', ('membership_state', '=', 'none'), ('is_number_manual', '=', True)]}" />
|
||||||
<field name="number_manual"
|
<field name="number_manual"
|
||||||
attrs="{'invisible': [('is_number_manual', '=', False)],
|
attrs="{'invisible': ['|', ('membership_state', '=', 'none'), ('is_number_manual', '=', False)],
|
||||||
'required': [('is_number_manual', '=', True)]}" />
|
'required': [('is_number_manual', '=', True), ('membership_state', '!=', 'none')]}" />
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="gender" />
|
<field name="gender" />
|
||||||
@ -210,7 +210,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<div class="oe_kanban_details">
|
<div class="oe_kanban_details">
|
||||||
<h4 class="oe_partner_heading">
|
<h4 class="oe_partner_heading">
|
||||||
<a type="open"><field name="display_name" /></a>
|
<a type="open"><field name="display_name" /></a>
|
||||||
(N° <field name="number" />)
|
<t t-if="record.number.raw_value != ''">(N° <field name="number" />)</t>
|
||||||
</h4>
|
</h4>
|
||||||
<div class="oe_kanban_partner_categories" />
|
<div class="oe_kanban_partner_categories" />
|
||||||
<div class="oe_kanban_partner_links" />
|
<div class="oe_kanban_partner_links" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user