forked from Yaltik/golem
[New] Module Golem member account
This commit is contained in:
parent
8c102ff103
commit
e26cd1c149
@ -24,7 +24,7 @@
|
|||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'application': True,
|
'application': True,
|
||||||
'installable': True,
|
'installable': True,
|
||||||
'depends': ['account', 'golem_base', 'golem_activity', 'golem_season',
|
'depends': ['golem_base', 'golem_activity', 'golem_season',
|
||||||
'odoo_partner_merge'],
|
'odoo_partner_merge'],
|
||||||
'data': ['views/golem_member_views.xml',
|
'data': ['views/golem_member_views.xml',
|
||||||
'views/res_partner_views.xml',
|
'views/res_partner_views.xml',
|
||||||
|
@ -22,7 +22,6 @@ from odoo import models, fields, api, _
|
|||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ResPartner(models.Model):
|
class ResPartner(models.Model):
|
||||||
""" GOLEM Member partner adaptations """
|
""" GOLEM Member partner adaptations """
|
||||||
_inherit = 'res.partner'
|
_inherit = 'res.partner'
|
||||||
@ -43,6 +42,7 @@ class ResPartner(models.Model):
|
|||||||
is_member = fields.Boolean('Is member', compute='_compute_is_member')
|
is_member = fields.Boolean('Is member', compute='_compute_is_member')
|
||||||
member_number = fields.Char('Member number', related='member_id.number')
|
member_number = fields.Char('Member number', related='member_id.number')
|
||||||
|
|
||||||
|
|
||||||
@api.depends('member_id')
|
@api.depends('member_id')
|
||||||
def _compute_is_member(self):
|
def _compute_is_member(self):
|
||||||
""" Computes is member """
|
""" Computes is member """
|
||||||
@ -105,7 +105,7 @@ class GolemMember(models.Model):
|
|||||||
image_permission = fields.Boolean('Image permission?', default=True)
|
image_permission = fields.Boolean('Image permission?', default=True)
|
||||||
currency_id = fields.Many2one('res.currency', compute='_get_company_currency',
|
currency_id = fields.Many2one('res.currency', compute='_get_company_currency',
|
||||||
string="Currency")
|
string="Currency")
|
||||||
|
|
||||||
@api.one
|
@api.one
|
||||||
def _get_company_currency(self):
|
def _get_company_currency(self):
|
||||||
if self.company_id:
|
if self.company_id:
|
||||||
@ -229,17 +229,6 @@ class GolemMember(models.Model):
|
|||||||
self.generate_number()
|
self.generate_number()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def open_partner_invoices(self):
|
|
||||||
""" Open invoices member """
|
|
||||||
self.ensure_one()
|
|
||||||
return {'type': 'ir.actions.act_window',
|
|
||||||
'res_model': 'account.invoice',
|
|
||||||
'view_mode': 'tree',
|
|
||||||
'context': {'search_default_partner_id': self.partner_id.id},
|
|
||||||
'res_id': self.partner_id.id}
|
|
||||||
|
|
||||||
|
|
||||||
class GolemMemberNumber(models.Model):
|
class GolemMemberNumber(models.Model):
|
||||||
""" GOLEM Member Numbers """
|
""" GOLEM Member Numbers """
|
||||||
_name = 'golem.member.number'
|
_name = 'golem.member.number'
|
||||||
|
@ -28,19 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<sheet>
|
<sheet>
|
||||||
<div colspan="2"
|
<div colspan="2"
|
||||||
style="background-color: #ccc; color: #fff; font-size: 150%; font-weight: bold; padding: 0.5%; text-align: center; margin-bottom: 1%;">Member form</div>
|
style="background-color: #ccc; color: #fff; font-size: 150%; font-weight: bold; padding: 0.5%; text-align: center; margin-bottom: 1%;">Member form</div>
|
||||||
<div class="oe_button_box" name="button_box">
|
|
||||||
<button type="object" class="oe_stat_button" id="invoice_button"
|
|
||||||
icon="fa-pencil-square-o" name="open_partner_invoices"
|
|
||||||
attrs="{'invisible': [('free_member', '=', True)]}"
|
|
||||||
context="{'default_partner_id': active_id}">
|
|
||||||
<div class="o_form_field o_stat_info">
|
|
||||||
<span class="o_stat_value">
|
|
||||||
<field name="total_invoiced" widget='monetary' options="{'currency_field': 'currency_id'}"/></span>
|
|
||||||
<span class="o_stat_text">Invoiced</span>
|
|
||||||
</div>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<group>
|
<group>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
<h1>
|
<h1>
|
||||||
|
18
golem_member_account/__init__.py
Normal file
18
golem_member_account/__init__.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from . import models
|
29
golem_member_account/__manifest__.py
Normal file
29
golem_member_account/__manifest__.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'GOLEM non-profit members',
|
||||||
|
'summary': 'Extends Odoo contacts for MJC',
|
||||||
|
'version': '10.0.1.0.0',
|
||||||
|
'category': 'GOLEM',
|
||||||
|
'author': 'Fabien Bourgeois, Michel Dessenne',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'application': True,
|
||||||
|
'installable': True,
|
||||||
|
'depends': ['account', 'golem_base', 'golem_member'],
|
||||||
|
'data': ['views/golem_member_views.xml']
|
||||||
|
}
|
1143
golem_member_account/i18n/fr.po
Normal file
1143
golem_member_account/i18n/fr.po
Normal file
File diff suppressed because it is too large
Load Diff
1134
golem_member_account/i18n/golem_member_account.pot
Normal file
1134
golem_member_account/i18n/golem_member_account.pot
Normal file
File diff suppressed because it is too large
Load Diff
18
golem_member_account/models/__init__.py
Normal file
18
golem_member_account/models/__init__.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from . import golem_member
|
39
golem_member_account/models/golem_member.py
Normal file
39
golem_member_account/models/golem_member.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright 2016 Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
""" GOLEM Members """
|
||||||
|
|
||||||
|
import logging
|
||||||
|
from odoo import models, fields, api, _
|
||||||
|
from odoo.exceptions import UserError
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class GolemMember(models.Model):
|
||||||
|
""" GOLEM Member adaptations """
|
||||||
|
_inherit = 'golem.member'
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def open_partner_invoices(self):
|
||||||
|
""" Open invoices member """
|
||||||
|
self.ensure_one()
|
||||||
|
return {'type': 'ir.actions.act_window',
|
||||||
|
'res_model': 'account.invoice',
|
||||||
|
'view_mode': 'tree',
|
||||||
|
'context': {'search_default_partner_id': self.partner_id.id,
|
||||||
|
'default_partner_id': self.partner_id.id}}
|
46
golem_member_account/views/golem_member_views.xml
Normal file
46
golem_member_account/views/golem_member_views.xml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<!-- Forms -->
|
||||||
|
<record model="ir.ui.view" id="golem_member_account_form_inherit_golem_member">
|
||||||
|
<field name="name">GOLEM Member account Form</field>
|
||||||
|
<field name="model">golem.member</field>
|
||||||
|
<field name="inherit_id" ref="golem_member.golem_member_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<div class="oe_title" position="after">
|
||||||
|
<div class="oe_button_box" name="button_box">
|
||||||
|
<button type="object" class="oe_stat_button" id="invoice_button"
|
||||||
|
icon="fa-pencil-square-o" name="open_partner_invoices"
|
||||||
|
attrs="{'invisible': [('free_member', '=', True)]}"
|
||||||
|
context="{'default_partner_id': active_id}">
|
||||||
|
<div class="o_form_field o_stat_info">
|
||||||
|
<span class="o_stat_value">
|
||||||
|
<field name="total_invoiced" widget='monetary' options="{'currency_field': 'currency_id'}"/></span>
|
||||||
|
<span class="o_stat_text">Invoiced</span>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</odoo>
|
Loading…
x
Reference in New Issue
Block a user