forked from Yaltik/golem
[IMP]GOLEM Family : after michel new features merging, some typos
This commit is contained in:
parent
f30bd35a81
commit
4e2cee7d05
@ -18,7 +18,7 @@
|
||||
{
|
||||
'name': 'GOLEM families',
|
||||
'summary': 'GOLEM Members Families',
|
||||
'version': '10.0.2.0.0',
|
||||
'version': '10.0.2.1.0',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
|
@ -24,7 +24,6 @@ class ResPartner(models.Model):
|
||||
""" Partner adaptations """
|
||||
_inherit = 'res.partner'
|
||||
|
||||
family_member = fields.Many2one(related='family_id')
|
||||
family_member_ids = fields.One2many(related='family_id.member_ids')
|
||||
family_street = fields.Char(related='family_id.street')
|
||||
family_street2 = fields.Char(related='family_id.street2')
|
||||
@ -40,7 +39,7 @@ class ResPartner(models.Model):
|
||||
family_id = fields.Many2one('golem.family', string='Family', index=True)
|
||||
family_role = fields.Many2one('golem.family.role', string='Role',
|
||||
index=True)
|
||||
family_count = fields.Integer('Family Count', related='family_id.count')
|
||||
family_count = fields.Integer(related='family_id.count')
|
||||
|
||||
@api.multi
|
||||
def button_family_members(self):
|
||||
@ -59,11 +58,10 @@ class ResPartner(models.Model):
|
||||
if member.family_id and not any((member.lastname, member.street, \
|
||||
member.street2, member.zip, member.city)):
|
||||
member.update({'lastname': member.family_id.name,
|
||||
'street': member.family_id[0].street,
|
||||
'street2': member.family_id[0].street2,
|
||||
'zip': member.family_id[0].zip,
|
||||
'city': member.family_id[0].city
|
||||
})
|
||||
'street': member.family_id.street,
|
||||
'street2': member.family_id.street2,
|
||||
'zip': member.family_id.zip,
|
||||
'city': member.family_id.city})
|
||||
|
||||
class GolemMember(models.Model):
|
||||
""" Member adaptations """
|
||||
@ -98,25 +96,25 @@ class GolemFamily(models.Model):
|
||||
def _get_default_nationality_id(self):
|
||||
return self.env.ref('base.main_company').country_id
|
||||
|
||||
name = fields.Char('Name', index=True, required=True)
|
||||
street = fields.Char('Street')
|
||||
street2 = fields.Char('Street2')
|
||||
zip = fields.Char('Zip')
|
||||
city = fields.Char('City')
|
||||
name = fields.Char(index=True, required=True)
|
||||
street = fields.Char()
|
||||
street2 = fields.Char()
|
||||
zip = fields.Char()
|
||||
city = fields.Char()
|
||||
state_id = fields.Many2one('res.country.state', 'State',
|
||||
ondelete='restrict')
|
||||
country_id = fields.Many2one('res.country', 'Country',
|
||||
ondelete='restrict',
|
||||
default=_get_default_nationality_id)
|
||||
phone = fields.Char('Phone')
|
||||
mobile = fields.Char('Mobile')
|
||||
email = fields.Char('Email')
|
||||
website = fields.Char('Website')
|
||||
phone = fields.Char()
|
||||
mobile = fields.Char()
|
||||
email = fields.Char()
|
||||
website = fields.Char()
|
||||
|
||||
member_ids = fields.One2many('res.partner', 'family_id', 'Members',
|
||||
domain=[('is_company', '=', False)])
|
||||
note = fields.Text('Note')
|
||||
count = fields.Integer('Count', compute='_compute_count', store=True)
|
||||
note = fields.Text()
|
||||
count = fields.Integer(compute='_compute_count', store=True)
|
||||
|
||||
@api.depends('member_ids')
|
||||
def _compute_count(self):
|
||||
@ -124,7 +122,7 @@ class GolemFamily(models.Model):
|
||||
family.count = len(family.member_ids)
|
||||
|
||||
@api.onchange('member_ids')
|
||||
def onchange_member(self):
|
||||
def onchange_members(self):
|
||||
""" Sets as member address if there was no precedence """
|
||||
for family in self:
|
||||
if family.member_ids and not any((family.street, family.street2,\
|
||||
@ -132,8 +130,7 @@ class GolemFamily(models.Model):
|
||||
family.update({'street': family.member_ids[0].street,
|
||||
'street2': family.member_ids[0].street2,
|
||||
'zip': family.member_ids[0].zip,
|
||||
'city': family.member_ids[0].city
|
||||
})
|
||||
'city': family.member_ids[0].city})
|
||||
|
||||
class GolemFamilyRole(models.Model):
|
||||
""" GOLEM Family Role """
|
||||
|
@ -26,66 +26,67 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<field name="inherit_id" ref="golem_member.golem_member_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="lastname" position="before">
|
||||
<field name="family_id" invisible="1" />
|
||||
<field name="family_id" />
|
||||
<field name="family_role" />
|
||||
</field>
|
||||
<page name="other_page" position="before">
|
||||
<page string="Family"
|
||||
attrs="{'invisible': [('family_id', '=', False)]}">
|
||||
<page name="other_page" position="before">
|
||||
<page string="Family"
|
||||
attrs="{'invisible': [('family_id', '=', False)]}">
|
||||
<group>
|
||||
<group string="Address">
|
||||
<group>
|
||||
<group string="Address">
|
||||
<group>
|
||||
<field name="family_street" placeholder="Street..." />
|
||||
<field name="family_street2" />
|
||||
<field name="family_zip" placeholder="ZIP" />
|
||||
<field name="family_city" placeholder="City" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="family_state_id" class="oe_no_button"
|
||||
placeholder="State" />
|
||||
<field name="family_country_id" placeholder="Country"
|
||||
class="oe_no_button" />
|
||||
</group>
|
||||
</group>
|
||||
<field name="family_street" placeholder="Street..." />
|
||||
<field name="family_street2" />
|
||||
<field name="family_zip" placeholder="ZIP" />
|
||||
<field name="family_city" placeholder="City" />
|
||||
</group>
|
||||
<group>
|
||||
<group string="Communication">
|
||||
<group>
|
||||
<field name="family_phone" placeholder="0000000000"
|
||||
widget="phonefr" />
|
||||
<field name="family_mobile" placeholder="0000000000"
|
||||
widget="phonefr" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="family_email" widget="email"
|
||||
placeholder="name@example.org" />
|
||||
<field name="family_website" widget="url"
|
||||
placeholder="e.g. www.odoo.com"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="family_state_id" class="oe_no_button"
|
||||
placeholder="State" />
|
||||
<field name="family_country_id" placeholder="Country"
|
||||
class="oe_no_button" />
|
||||
</group>
|
||||
<field name="family_member_ids" context="{'default_family_id': active_id}">
|
||||
<tree delete="false">
|
||||
<field name="name" />
|
||||
<field name="family_role" />
|
||||
<field name="phone" />
|
||||
<field name="mobile" />
|
||||
<field name="email" widget="email" />
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</page>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group string="Communication">
|
||||
<group>
|
||||
<field name="family_phone" placeholder="0000000000"
|
||||
widget="phonefr" />
|
||||
<field name="family_mobile" placeholder="0000000000"
|
||||
widget="phonefr" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="family_email" widget="email"
|
||||
placeholder="name@example.org" />
|
||||
<field name="family_website" widget="url"
|
||||
placeholder="e.g. www.odoo.com"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
<field name="family_member_ids"
|
||||
context="{'default_family_id': active_id}">
|
||||
<tree delete="false">
|
||||
<field name="name" />
|
||||
<field name="family_role" />
|
||||
<field name="phone" />
|
||||
<field name="mobile" />
|
||||
<field name="email" widget="email" />
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</page>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- searches -->
|
||||
<record model="ir.ui.view" id="golem_family_search_inherit_golem_membership">
|
||||
<field name="name">GOLEM family search adaptations</field>
|
||||
<!-- Searches -->
|
||||
<record model="ir.ui.view" id="golem_member_search_inherit_golem_family">
|
||||
<field name="name">GOLEM Member search adaptations</field>
|
||||
<field name="model">golem.member</field>
|
||||
<field name="inherit_id" ref="golem_member.golem_member_search" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="family_id" string="Family" />
|
||||
<field name="family_id" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -43,7 +43,6 @@ class ResPartner(models.Model):
|
||||
is_member = fields.Boolean('Is member', compute='_compute_is_member')
|
||||
member_number = fields.Char('Member number', related='member_id.number')
|
||||
|
||||
|
||||
@api.depends('member_id')
|
||||
def _compute_is_member(self):
|
||||
""" Computes is member """
|
||||
@ -81,7 +80,6 @@ class GolemMember(models.Model):
|
||||
partner_id = fields.Many2one('res.partner', required=True, index=True,
|
||||
ondelete='cascade')
|
||||
|
||||
|
||||
@api.model
|
||||
def _default_season(self):
|
||||
""" Get default season """
|
||||
|
Loading…
Reference in New Issue
Block a user