[IMP]GOLEM Family : after michel new features merging, some typos

This commit is contained in:
Fabien BOURGEOIS 2018-01-29 15:35:52 +01:00
parent f30bd35a81
commit 4e2cee7d05
4 changed files with 67 additions and 71 deletions

View File

@ -18,7 +18,7 @@
{ {
'name': 'GOLEM families', 'name': 'GOLEM families',
'summary': 'GOLEM Members Families', 'summary': 'GOLEM Members Families',
'version': '10.0.2.0.0', 'version': '10.0.2.1.0',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Fabien Bourgeois', 'author': 'Fabien Bourgeois',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@ -24,7 +24,6 @@ class ResPartner(models.Model):
""" Partner adaptations """ """ Partner adaptations """
_inherit = 'res.partner' _inherit = 'res.partner'
family_member = fields.Many2one(related='family_id')
family_member_ids = fields.One2many(related='family_id.member_ids') family_member_ids = fields.One2many(related='family_id.member_ids')
family_street = fields.Char(related='family_id.street') family_street = fields.Char(related='family_id.street')
family_street2 = fields.Char(related='family_id.street2') 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_id = fields.Many2one('golem.family', string='Family', index=True)
family_role = fields.Many2one('golem.family.role', string='Role', family_role = fields.Many2one('golem.family.role', string='Role',
index=True) index=True)
family_count = fields.Integer('Family Count', related='family_id.count') family_count = fields.Integer(related='family_id.count')
@api.multi @api.multi
def button_family_members(self): def button_family_members(self):
@ -59,11 +58,10 @@ class ResPartner(models.Model):
if member.family_id and not any((member.lastname, member.street, \ if member.family_id and not any((member.lastname, member.street, \
member.street2, member.zip, member.city)): member.street2, member.zip, member.city)):
member.update({'lastname': member.family_id.name, member.update({'lastname': member.family_id.name,
'street': member.family_id[0].street, 'street': member.family_id.street,
'street2': member.family_id[0].street2, 'street2': member.family_id.street2,
'zip': member.family_id[0].zip, 'zip': member.family_id.zip,
'city': member.family_id[0].city 'city': member.family_id.city})
})
class GolemMember(models.Model): class GolemMember(models.Model):
""" Member adaptations """ """ Member adaptations """
@ -98,25 +96,25 @@ class GolemFamily(models.Model):
def _get_default_nationality_id(self): def _get_default_nationality_id(self):
return self.env.ref('base.main_company').country_id return self.env.ref('base.main_company').country_id
name = fields.Char('Name', index=True, required=True) name = fields.Char(index=True, required=True)
street = fields.Char('Street') street = fields.Char()
street2 = fields.Char('Street2') street2 = fields.Char()
zip = fields.Char('Zip') zip = fields.Char()
city = fields.Char('City') city = fields.Char()
state_id = fields.Many2one('res.country.state', 'State', state_id = fields.Many2one('res.country.state', 'State',
ondelete='restrict') ondelete='restrict')
country_id = fields.Many2one('res.country', 'Country', country_id = fields.Many2one('res.country', 'Country',
ondelete='restrict', ondelete='restrict',
default=_get_default_nationality_id) default=_get_default_nationality_id)
phone = fields.Char('Phone') phone = fields.Char()
mobile = fields.Char('Mobile') mobile = fields.Char()
email = fields.Char('Email') email = fields.Char()
website = fields.Char('Website') website = fields.Char()
member_ids = fields.One2many('res.partner', 'family_id', 'Members', member_ids = fields.One2many('res.partner', 'family_id', 'Members',
domain=[('is_company', '=', False)]) domain=[('is_company', '=', False)])
note = fields.Text('Note') note = fields.Text()
count = fields.Integer('Count', compute='_compute_count', store=True) count = fields.Integer(compute='_compute_count', store=True)
@api.depends('member_ids') @api.depends('member_ids')
def _compute_count(self): def _compute_count(self):
@ -124,7 +122,7 @@ class GolemFamily(models.Model):
family.count = len(family.member_ids) family.count = len(family.member_ids)
@api.onchange('member_ids') @api.onchange('member_ids')
def onchange_member(self): def onchange_members(self):
""" Sets as member address if there was no precedence """ """ Sets as member address if there was no precedence """
for family in self: for family in self:
if family.member_ids and not any((family.street, family.street2,\ 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, family.update({'street': family.member_ids[0].street,
'street2': family.member_ids[0].street2, 'street2': family.member_ids[0].street2,
'zip': family.member_ids[0].zip, 'zip': family.member_ids[0].zip,
'city': family.member_ids[0].city 'city': family.member_ids[0].city})
})
class GolemFamilyRole(models.Model): class GolemFamilyRole(models.Model):
""" GOLEM Family Role """ """ GOLEM Family Role """

View File

@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="inherit_id" ref="golem_member.golem_member_form" /> <field name="inherit_id" ref="golem_member.golem_member_form" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="lastname" position="before"> <field name="lastname" position="before">
<field name="family_id" invisible="1" /> <field name="family_id" />
<field name="family_role" /> <field name="family_role" />
</field> </field>
<page name="other_page" position="before"> <page name="other_page" position="before">
@ -64,7 +64,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</group> </group>
</group> </group>
</group> </group>
<field name="family_member_ids" context="{'default_family_id': active_id}"> <field name="family_member_ids"
context="{'default_family_id': active_id}">
<tree delete="false"> <tree delete="false">
<field name="name" /> <field name="name" />
<field name="family_role" /> <field name="family_role" />
@ -78,14 +79,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</field> </field>
</record> </record>
<!-- searches --> <!-- Searches -->
<record model="ir.ui.view" id="golem_family_search_inherit_golem_membership"> <record model="ir.ui.view" id="golem_member_search_inherit_golem_family">
<field name="name">GOLEM family search adaptations</field> <field name="name">GOLEM Member search adaptations</field>
<field name="model">golem.member</field> <field name="model">golem.member</field>
<field name="inherit_id" ref="golem_member.golem_member_search" /> <field name="inherit_id" ref="golem_member.golem_member_search" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="name" position="after"> <field name="name" position="after">
<field name="family_id" string="Family" /> <field name="family_id" />
</field> </field>
</field> </field>
</record> </record>

View File

@ -43,7 +43,6 @@ 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 """
@ -81,7 +80,6 @@ class GolemMember(models.Model):
partner_id = fields.Many2one('res.partner', required=True, index=True, partner_id = fields.Many2one('res.partner', required=True, index=True,
ondelete='cascade') ondelete='cascade')
@api.model @api.model
def _default_season(self): def _default_season(self):
""" Get default season """ """ Get default season """