forked from Yaltik/golem
include partner in legal_guardian_ids
This commit is contained in:
parent
eaf48497b2
commit
308ee2e7bd
@ -22,6 +22,13 @@ from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
class golemTest(models.Model):
|
||||
""" Partner Area """
|
||||
_name = 'golem.test'
|
||||
|
||||
partner_id = fields.Many2one('res.partner')
|
||||
nomination = fields.Char()
|
||||
product_id = fields.Many2one('product.product')
|
||||
|
||||
class PartnerArea(models.Model):
|
||||
""" Partner Area """
|
||||
@ -109,6 +116,27 @@ class GolemMember(models.Model):
|
||||
|
||||
partner_id = fields.Many2one('res.partner', required=True, index=True,
|
||||
ondelete='cascade')
|
||||
def membership_invoice_action(self):
|
||||
self.ensure_one()
|
||||
member = self[0]
|
||||
action = self.env.ref('golem_member.golem_membership_invoice_action').read()[0]
|
||||
action['domain'] = [('partner_id', 'in', member.legal_guardian_ids.ids)]
|
||||
return action
|
||||
#action = self.env.ref('golem_member.golem_test_action2').read()[0]
|
||||
#return action
|
||||
#lst = member.legal_guardian_ids.ids
|
||||
#return {
|
||||
# 'name': _('Next activity'),
|
||||
# 'res_model': 'golem.test',
|
||||
# 'context': {},
|
||||
# 'domain' : [('product_id.type', '=', 'service')],
|
||||
# 'type': 'ir.actions.act_window',
|
||||
# 'view_id': False,
|
||||
# 'view_mode': 'form',
|
||||
# 'target': 'new',
|
||||
# 'view_type': 'form'
|
||||
#}
|
||||
|
||||
|
||||
@api.model
|
||||
def default_season(self):
|
||||
|
@ -28,6 +28,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
res_model="golem.member" view_mode="kanban,tree,form,graph" />
|
||||
<act_window id="res_partner_category_action" name="GOLEM Members Tags"
|
||||
res_model="res.partner.category" view_mode="tree,form" />
|
||||
|
||||
<act_window id="golem_test_action2"
|
||||
name="Golem Test"
|
||||
res_model="golem.test"
|
||||
view_mode="tree,form"
|
||||
domain="[('partner_id.is_company', '=', False)]"/>
|
||||
|
||||
<!--<record id="golem_test_action" model="ir.actions.act_window">
|
||||
<field name="name">Golem Test</field>
|
||||
<field name="res_model">golem.test</field>
|
||||
<field name="domain">[('partner_id.is_company', '=', False)]</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>-->
|
||||
<menuitem name="golem test" id="golem_test_menu"
|
||||
action="golem_test_action2" />
|
||||
|
||||
<record id="golem_membership_invoice_action" model="ir.actions.act_window">
|
||||
<field name="name">Join Membership</field>
|
||||
<field name="res_model">golem.membership.invoice</field>
|
||||
@ -131,10 +148,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<div>
|
||||
<field name="partner_id" invisible="True" required="False" />
|
||||
<field name="membership_state"/>
|
||||
<button name="%(golem_membership_invoice_action)d"
|
||||
type="action" string="Buy Membership"
|
||||
<!--"%(golem_membership_invoice_action)d"-->
|
||||
<!-- <button name="%(golem_test_action2)d"-->
|
||||
<button name="membership_invoice_action"
|
||||
type="object" string="Buy Membership"
|
||||
attrs="{'invisible':[('free_member','=',True)]}"
|
||||
context="{'default_partner_id': partner_id}"
|
||||
class="oe_link"/>
|
||||
</div>
|
||||
</group>
|
||||
|
Loading…
Reference in New Issue
Block a user