Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

G2P-2717: Feedback changes on views and model file #156

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions g2p_enumerator/models/g2p_enumerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@

class G2PEnumerator(models.Model):
_name = "g2p.enumerator"
_rec = "name"

# Enum Details
enumerator_name = fields.Char()
enumerator_id = fields.Char()
name = fields.Char()
enumerator_user_id = fields.Char()
data_collection_date = fields.Date()

# Location
enum_latitude = fields.Float(string="Latitude", digits=(10, 7))
enum_longitude = fields.Float(string="Longitude", digits=(10, 7))
enum_altitude = fields.Float(string="Altitude")
enum_accuracy = fields.Float(string="Accuracy")

partner_id = fields.Many2one("res.partner")
5 changes: 4 additions & 1 deletion g2p_enumerator/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
class G2PRegistrant(models.Model):
_inherit = "res.partner"

enumerator_ids = fields.One2many("g2p.enumerator", "partner_id")
enumerator_id = fields.Many2one("g2p.enumerator")
enumerator_user_id = fields.Char(related="enumerator_id.enumerator_user_id")

data_collection_date = fields.Date(related="enumerator_id.data_collection_date")
24 changes: 22 additions & 2 deletions g2p_enumerator/views/g2p_enumerator_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<field name="model">g2p.enumerator</field>
<field name="arch" type="xml">
<tree>
<field name="enumerator_name" />
<field name="enumerator_id" />
<field name="name" string="Enumerator" />
<field name="enumerator_user_id" />
<field name="data_collection_date" />
<field name="enum_latitude" />
<field name="enum_longitude" />
Expand All @@ -19,6 +19,26 @@
</field>
</record>

<record id="view_enumerator_config_fomr" model="ir.ui.view">
<field name="name">view_enumerator_config_form</field>
<field name="model">g2p.enumerator</field>
<field name="arch" type="xml">
<form>
<group string="Enumerator Details">
<field name="name" string="Enumerator Name" />
<field name="enumerator_user_id" string="Enumerator User ID" />
<field name="data_collection_date" />
</group>
<group string="Enumerator Location">
<field name="enum_latitude" />
<field name="enum_longitude" />
<field name="enum_altitude" />
<field name="enum_accuracy" />
</group>
</form>
</field>
</record>

<record id="action_enumerator_action" model="ir.actions.act_window">
<field name="name">enumerator action</field>
<field name="type">ir.actions.act_window</field>
Expand Down
25 changes: 5 additions & 20 deletions g2p_enumerator/views/group_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,11 @@
<field name="arch" type="xml">
<xpath expr="//page[@name='other']" position="after">
<page string="Enumerator Details" name="enumerator_details">
<field name="enumerator_ids" nolabel="1" colspan="2">
<tree>
<field name="enumerator_name" />
<field name="enumerator_id" string="Enumerator ID" />
<field name="data_collection_date" />
</tree>
<form>
<group string="Enumerator Info">
<field name="enumerator_name" />
<field name="enumerator_id" string="Enumerator ID" />
<field name="data_collection_date" />
</group>
<group string="Enumerator Location">
<field name="enum_latitude" />
<field name="enum_longitude" />
<field name="enum_altitude" />
<field name="enum_accuracy" />
</group>
</form>
</field>
<group>
<field name="enumerator_id" string="Enumerator" />
<field name="enumerator_user_id" string="Enumerator User ID" />
<field name="data_collection_date" />
</group>
</page>
</xpath>
</field>
Expand Down
Loading