[TMP] Add Smartbutton invoices in member form

This commit is contained in:
michel 2018-02-06 14:41:55 +01:00
parent edd333f0ae
commit 4d01b8d074
3 changed files with 23 additions and 2 deletions

View File

@ -24,7 +24,7 @@
'license': 'AGPL-3', 'license': 'AGPL-3',
'application': True, 'application': True,
'installable': True, 'installable': True,
'depends': ['golem_base', 'golem_activity', 'golem_season', 'depends': ['account', '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',

View File

@ -66,7 +66,6 @@ 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 GolemMember(models.Model): class GolemMember(models.Model):
""" GOLEM Member model """ """ GOLEM Member model """
_name = 'golem.member' _name = 'golem.member'
@ -220,6 +219,16 @@ class GolemMember(models.Model):
self.generate_number() self.generate_number()
return res return res
@api.multi
def open_partner_invoices(self):
""" Go to member form """
self.ensure_one()
if self[0].member_id:
return {'type': 'ir.actions.act_window',
'res_model': 'account.invoice',
'view_mode': 'tree',
'res_id': self[0].member_id.id}
class GolemMemberNumber(models.Model): class GolemMemberNumber(models.Model):
""" GOLEM Member Numbers """ """ GOLEM Member Numbers """

View File

@ -28,6 +28,17 @@ 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 name="button_box" position="inside">
<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>
@ -42,6 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="season_ids" widget="many2many_tags" /> <field name="season_ids" widget="many2many_tags" />
<field name="category_id" widget="many2many_tags" <field name="category_id" widget="many2many_tags"
placeholder="Tags..."/> placeholder="Tags..."/>
<field name="partner_id" />
</group> </group>
</group> </group>
<group string="Personal details"> <group string="Personal details">