Skip to content

Commit

Permalink
[FIX] pos_partner_location_map: Changed views.
Browse files Browse the repository at this point in the history
  • Loading branch information
geomer198 committed May 20, 2023
1 parent e968884 commit 084c41c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 13 deletions.
4 changes: 3 additions & 1 deletion pos_partner_location_map/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"website": "https://github.com/OCA/pos",
"license": "AGPL-3",
"depends": ["base_geolocalize", "point_of_sale"],
"data": [],
"data": [
"views/res_partner_views.xml",
],
"assets": {
"point_of_sale.assets": [
"pos_partner_location_map/static/src/css/*.css",
Expand Down
4 changes: 2 additions & 2 deletions pos_partner_location_map/models/pos_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ def _loader_params_res_partner(self):
res = super()._loader_params_res_partner()
res["search_params"]["fields"] += [
"map_partner_address",
"lat_address",
"lang_address",
"partner_latitude",
"partner_longitude",
]
return res

Expand Down
2 changes: 0 additions & 2 deletions pos_partner_location_map/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ class ResPartner(models.Model):
_inherit = "res.partner"

map_partner_address = fields.Char()
lat_address = fields.Char("Latitude")
lang_address = fields.Char("Longitude")
8 changes: 4 additions & 4 deletions pos_partner_location_map/static/src/js/PartnerMapEdit.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ odoo.define("pos_partner_location_map.PartnerMapEdit", function (require) {
setup() {
super.setup();
this.partner = this.props.partner;
this.lat = parseFloat(this.partner.lat_address) || 0;
this.lng = parseFloat(this.partner.lang_address) || 0;
this.lat = parseFloat(this.partner.partner_latitude) || 0;
this.lng = parseFloat(this.partner.partner_longitude) || 0;
this.address = this.partner.map_partner_address || "";
this.mapContainerRef = useRef("map-container");
this.addrInput = useRef("addr-input");
Expand Down Expand Up @@ -71,8 +71,8 @@ odoo.define("pos_partner_location_map.PartnerMapEdit", function (require) {

async getPayload() {
return {
lat_address: this.lat,
lang_address: this.lng,
partner_latitude: this.lat,
partner_longitude: this.lng,
map_partner_address: this.address,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
<span class="label">Lat/Long</span>
<input
class="detail"
name="lat_address"
name="partner_latitude"
t-on-change="captureChange"
t-att-value="props.partner.lat_address || ''"
t-att-value="props.partner.partner_latitude || ''"
placeholder="Latitude"
style="width: 170px"
/>
<input
class="detail"
name="lang_address"
name="partner_longitude"
t-on-change="captureChange"
t-att-value="props.partner.lang_address || ''"
t-att-value="props.partner.partner_longitude || ''"
placeholder="Longitude"
style="width: 170px"
/>
Expand Down
15 changes: 15 additions & 0 deletions pos_partner_location_map/views/res_partner_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>

<record id="view_partner_form" model="ir.ui.view">
<field name="name">res.partner.location.map.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<div class="o_address_format" position="after">
<field name="map_partner_address" />
</div>
</field>
</record>

</odoo>

0 comments on commit 084c41c

Please sign in to comment.