gityopie / odoo-addons

Odoo and Google maps integration
GNU Lesser General Public License v3.0
100 stars 159 forks source link

Fillfields not updating when supplied in options attribute in xml form #211

Closed lesdekock closed 1 year ago

lesdekock commented 1 year ago

Branch 15.0

In the js file gplaces_autocomplete.js on line 299 the if statement reads: if (this.edit === 'edit') {...}

Can not see that this.edit is ever set and is always undefined,

Should this not perhaps be: if (this.mode === 'edit') {...}

Here is my code from the xml file. I am adding a suburb field to capture the sublocallity.

<xpath expr="//field[@name='street']" position="attributes">
                <attribute name="widget">gplaces_address_autocomplete</attribute>
                <attribute name="options">{
                    'lat': 'latitude',
                    'lng': 'longitude',
                    'fillfields': {
                        'street': ['street_number', 'route'],
                        'street2': ['administrative_area_level_3', 'administrative_area_level_4', 'administrative_area_level_5'],
                        'suburb': ['sublocality', 'sublocality_level_1'],
                        'city': ['locality', 'administrative_area_level_2'],
                        'zip': 'postal_code',
                        'state_id': 'administrative_area_level_1',
                        'country_id': 'country',
                    },
                    'address_form': {
                        'street': 'street',
                        'street2': 'street2',
                        'suburb': 'suburb',
                        'city': 'city',
                        'zip': 'zip',
                        'state_id': 'state_id',
                        'country_id': 'country_id',
                    },
                    'display_name': 'street',
                    'force_override': true
                }</attribute>
                <attribute name="class">o_address_street</attribute>
            </xpath>
gityopie commented 1 year ago

Hi @lesdekock

I'll check this weekend and keep you posted.

Thanks!

gityopie commented 1 year ago

Hi @lesdekock I've pushed the fixes

Waiting your feedback on it Thanks!

gityopie commented 1 year ago

Hi @lesdekock I will closed this issue Please do not hesitate to submit a PR when you find a bug or make an improvement

Thanks a lot for your collaboration