Skip to content

Commit

Permalink
[8.0]-[BR1030]-[ADD/IMP][Reference field improvements] (OCA#208)
Browse files Browse the repository at this point in the history
* [8.0][BR1030][ADD][Reference field improvements]

* [IMP]Improved code
  • Loading branch information
serpentcs-dev1 authored and NachoAlesLopez committed Apr 27, 2024
1 parent 275931d commit a7f5bbc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions business_requirement/models/business.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _get_default_company(self):
states={'draft': [('readonly', False)]}
)
ref = fields.Char(
'Reference',
'WBS',
required=False,
readonly=True,
copy=False,
Expand Down Expand Up @@ -204,6 +204,7 @@ def _get_default_company(self):
track_visibility='onchange',
required=False,
copy=False, default='normal')
origin = fields.Text(string='Source')

@api.multi
@api.onchange('project_id')
Expand Down Expand Up @@ -269,7 +270,8 @@ def name_get(self):
result = []
for br in self:
if br.ref:
formatted_name = u'[{}] {}'.format(br.ref, br.description)
formatted_name = u'[{}][{}] {}'.format(br.ref, br.name,
br.description)
else:
formatted_name = u'[{}] {}'.format(br.name, br.description)
result.append((br.id, formatted_name))
Expand Down
2 changes: 2 additions & 0 deletions business_requirement/views/business_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<field name="project_id"/>
<field name="partner_id"/>
<field name="ref"/>
<field name="origin"/>
<field name="category_ids" widget="many2many_tags"/>

<field name="to_be_reviewed"/>
Expand Down Expand Up @@ -138,6 +139,7 @@
<field name="project_id" string="Project"/>
<field name="partner_id" string="Customer"/>
<field name="responsible_id" string="Responsible"/>
<field name="origin" string="Source"/>
<filter string="To be Reviewed" name="to_be_reviewed" domain="[('to_be_reviewed','!=', False)]"/>
<group expand="0" string="Group By">
<filter string="Project" context="{'group_by':'project_id'}"/>
Expand Down

0 comments on commit a7f5bbc

Please sign in to comment.