diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index a2167118a84ed6..e4f3a4043966c7 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -7898,18 +7898,6 @@ def _set_reversed_entry(self, credit_note): if len(original_invoice) == 1 and original_invoice._refunds_origin_required(): credit_note.reversed_entry_id = original_invoice.id - @api.model - def get_invoice_localisation_fields_required_to_invoice(self, country_id): - """ Returns the list of fields that needs to be filled when creating an invoice for the selected country. - This is required for some flows that would allow a user to request an invoice from the portal. - Using these, we can get their information and dynamically create form inputs based for the fields required legally for the company country_id. - The returned fields must be of type ir.model.fields in order to handle translations - - :param country_id: The country for which we want the fields. - :return: an array of ir.model.fields for which the user should provide values. - """ - return [] - def get_extra_print_items(self): """ Helper to dynamically add items in the 'Print' menu of list and form of account.move. """ diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index f39be1e83ead9e..626d13da9ab013 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -869,20 +869,6 @@ def _get_vat_required_valid(self, company=None): self.ensure_one() return bool(self.vat and self.vat != '/') - # TODO accounting/JCO, seems strange that this address validation logic is only there for pos, and - # not for standard address management on portal/ecommerce - @api.model - def get_partner_localisation_fields_required_to_invoice(self, country_id): - """ Returns the list of fields that needs to be filled when creating an invoice for the selected country. - This is required for some flows that would allow a user to request an invoice from the portal. - Using these, we can get their information and dynamically create form inputs based for the fields required legally for the company country_id. - The returned fields must be of type ir.model.fields in order to handle translations - - :param country_id: The country for which we want the fields. - :return: an array of ir.model.fields for which the user should provide values. - """ - return [] - # ------------------------------------------------------------------------- # EDI # ------------------------------------------------------------------------- diff --git a/addons/account/views/account_portal_templates.xml b/addons/account/views/account_portal_templates.xml index 2f4e032dab556b..8e01c71cf6e4c1 100644 --- a/addons/account/views/account_portal_templates.xml +++ b/addons/account/views/account_portal_templates.xml @@ -230,70 +230,44 @@ - - - diff --git a/addons/account_peppol/views/account_portal_templates.xml b/addons/account_peppol/views/account_portal_templates.xml index f1d49c8adbbd11..0f6b337d2f2934 100644 --- a/addons/account_peppol/views/account_portal_templates.xml +++ b/addons/account_peppol/views/account_portal_templates.xml @@ -1,9 +1,8 @@ diff --git a/addons/base_address_extended/__manifest__.py b/addons/base_address_extended/__manifest__.py index 59b8ac8f2233a9..7d842285a064c0 100644 --- a/addons/base_address_extended/__manifest__.py +++ b/addons/base_address_extended/__manifest__.py @@ -14,12 +14,12 @@ It is primarily used for EDIs that might need a special city code. """, 'data': [ - 'views/base_address_extended.xml', 'views/res_city_view.xml', 'views/res_country_view.xml', + 'views/res_partner_views.xml', 'security/ir.access.csv', ], - 'depends': ['base', 'contacts'], + 'depends': ['web'], 'author': 'Odoo S.A.', 'license': 'LGPL-3', } diff --git a/addons/base_address_extended/models/__init__.py b/addons/base_address_extended/models/__init__.py index 7d7f5d58b3dfc9..24d2c6aaa73ef2 100644 --- a/addons/base_address_extended/models/__init__.py +++ b/addons/base_address_extended/models/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import res_city diff --git a/addons/base_address_extended/models/res_country.py b/addons/base_address_extended/models/res_country.py index 233a79dd1192e8..dacbef4fd20ad7 100644 --- a/addons/base_address_extended/models/res_country.py +++ b/addons/base_address_extended/models/res_country.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import fields, models diff --git a/addons/base_address_extended/security/ir.access.csv b/addons/base_address_extended/security/ir.access.csv index dd565fc8c5d2e5..871e7dade6ae7e 100644 --- a/addons/base_address_extended/security/ir.access.csv +++ b/addons/base_address_extended/security/ir.access.csv @@ -1,3 +1,3 @@ id,name,model_id,group_id/id,operation,domain access_res_city_group_user,res_city group_user,res.city,base.group_partner_manager,crud, -access_res_city_group_all,res_city group_user_all,res.city,base.group_user,r, +access_res_city_group_all,res_city group_user_all,res.city,base.group_everyone,r, diff --git a/addons/base_address_extended/views/base_address_extended.xml b/addons/base_address_extended/views/base_address_extended.xml deleted file mode 100644 index 398d167fe044db..00000000000000 --- a/addons/base_address_extended/views/base_address_extended.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - partner.form.address.extended - res.partner - - -
-
- - - - -
- - - - - - -
- - - - - - -
-
-
-
- - - partner.form.address.extended.city_id - res.partner - - - - country_enforce_cities and (city_id or city in ('', False)) - - - - - - - - - country_enforce_cities and (city_id or city in ('', False)) - - - - - - - - -
diff --git a/addons/base_address_extended/views/res_city_view.xml b/addons/base_address_extended/views/res_city_view.xml index 4f18d83d2cc49a..76adf3fc58c12f 100644 --- a/addons/base_address_extended/views/res_city_view.xml +++ b/addons/base_address_extended/views/res_city_view.xml @@ -60,10 +60,5 @@ - - diff --git a/addons/base_address_extended/views/res_partner_views.xml b/addons/base_address_extended/views/res_partner_views.xml new file mode 100644 index 00000000000000..d6518f821c0308 --- /dev/null +++ b/addons/base_address_extended/views/res_partner_views.xml @@ -0,0 +1,54 @@ + + + + + partner.form.address.extended.city_id + res.partner + + + + + country_enforce_cities and (city_id or city in ('', False)) + + + + + + + + + + + country_enforce_cities and (city_id or city in ('', False)) + + + + + + + + + + diff --git a/addons/contacts/__manifest__.py b/addons/contacts/__manifest__.py index 6db9a6cdd978aa..62caf97b3cff2f 100644 --- a/addons/contacts/__manifest__.py +++ b/addons/contacts/__manifest__.py @@ -10,7 +10,7 @@ This module gives you a quick view of your contacts directory, accessible from your home page. You can track your vendors, customers and other contacts. """, - 'depends': ['base', 'mail', 'web_hierarchy'], + 'depends': ['base_address_extended', 'mail', 'web_hierarchy'], 'data': [ 'views/contact_views.xml', ], diff --git a/addons/contacts/views/contact_views.xml b/addons/contacts/views/contact_views.xml index b4a835f1e40378..45709a2083ba18 100644 --- a/addons/contacts/views/contact_views.xml +++ b/addons/contacts/views/contact_views.xml @@ -118,20 +118,33 @@ groups="base.group_no_one" sequence="5"/> - - - - - + + + + + + - diff --git a/addons/l10n_ar/controllers/portal.py b/addons/l10n_ar/controllers/portal.py index 8b6cecac63da21..903126c90ffb90 100644 --- a/addons/l10n_ar/controllers/portal.py +++ b/addons/l10n_ar/controllers/portal.py @@ -8,18 +8,22 @@ class L10nARPortalAccount(L10nLatamBasePortalAccount): def _is_argentinean_company(self): - return request.env.company.country_code == 'AR' + return request.env.company.account_fiscal_country_id.code == "AR" def _prepare_address_form_values(self, partner_sudo, *args, **kwargs): rendering_values = super()._prepare_address_form_values(partner_sudo, *args, **kwargs) if self._is_argentinean_company() and rendering_values['is_used_as_billing']: can_edit_commercial_fields = rendering_values["can_edit_commercial_fields"] ArAfipResponsibilityType = request.env['l10n_ar.afip.responsibility.type'] + default_afip_responsibility_type_id = ( + rendering_values["current_partner"].l10n_ar_afip_responsibility_type_id + or ArAfipResponsibilityType + ) rendering_values.update({ - 'responsibility': rendering_values['current_partner'].l10n_ar_afip_responsibility_type_id, + "responsibility": default_afip_responsibility_type_id, 'responsibility_types': ( ArAfipResponsibilityType.search([]) - if can_edit_commercial_fields else ArAfipResponsibilityType + if can_edit_commercial_fields else default_afip_responsibility_type_id ), }) return rendering_values diff --git a/addons/l10n_ar/views/portal_address_templates.xml b/addons/l10n_ar/views/portal_address_templates.xml index dd08224e64b240..2414e0663feb4b 100644 --- a/addons/l10n_ar/views/portal_address_templates.xml +++ b/addons/l10n_ar/views/portal_address_templates.xml @@ -3,14 +3,26 @@ diff --git a/addons/l10n_br/__manifest__.py b/addons/l10n_br/__manifest__.py index efde4b51c8937d..4237c0e0c5e23d 100644 --- a/addons/l10n_br/__manifest__.py +++ b/addons/l10n_br/__manifest__.py @@ -53,7 +53,6 @@ 'depends': [ 'account', 'account_qr_code_emv', - 'portal_address_extended', 'l10n_latam_base', 'l10n_latam_invoice_document', ], diff --git a/addons/l10n_br/models/res_country.py b/addons/l10n_br/models/res_country.py index 3b112ea67d2f32..67980d82d81421 100644 --- a/addons/l10n_br/models/res_country.py +++ b/addons/l10n_br/models/res_country.py @@ -6,11 +6,6 @@ class ResCountry(models.Model): _inherit = 'res.country' - def _get_cities(self, state_id=None): - if self.code == 'BR' and not state_id: - return self.env['res.city'].sudo().search([('country_id', '=', self.id)]) - return super()._get_cities(state_id) - def _get_cities_fields_to_fetch(self): res = super()._get_cities_fields_to_fetch() if self.code == 'BR': diff --git a/addons/l10n_br/static/src/interactions/address.js b/addons/l10n_br/static/src/interactions/address.js index 0dd8e1abc0f35e..6440e91fe852fe 100644 --- a/addons/l10n_br/static/src/interactions/address.js +++ b/addons/l10n_br/static/src/interactions/address.js @@ -13,9 +13,10 @@ patch(CustomerAddress.prototype, { await super.onChangeZip(); if (this._getSelectedCountryCode() !== 'BR') return; + const cities = this.addressForm.city_id; const newZip = this.addressForm.zip.value.padEnd(5, '0'); - for (const option of this.elementCities.options) { + for (const option of cities.options) { const ranges = option.dataset.l10n_br_zip_ranges; if (ranges) { // Parse the l10n_br_zip_ranges field (e.g. "[01000-001 05999-999] [08000-000 08499-999]"). @@ -28,7 +29,7 @@ patch(CustomerAddress.prototype, { // Rely on lexicographical order to figure out if the new zip is in this range. if (newZip >= start && newZip <= end) { - this.elementCities.dispatchEvent( + cities.dispatchEvent( new CustomEvent('select', { detail: { value: option.value } }) ); option.selected = 'selected'; @@ -44,10 +45,9 @@ patch(CustomerAddress.prototype, { await super.onChangeCity(); if (this._getSelectedCountryCode() !== 'BR') return; - if (this.elementCities.value) { - this._selectState( - this.elementCities.selectedOptions[0].dataset.state_id - ); + const cities = this.addressForm.city_id; + if (cities.options) { + this._selectState(cities.selectedOptions[0].dataset.state_id); } }, @@ -72,15 +72,14 @@ patch(CustomerAddress.prototype, { async onChangeState() { // For BR: don't want the standard behavior of reloading cities based on state if (this._getSelectedCountryCode() == 'BR') { - this.elementCities.value = ''; + this.addressForm.city_id.value = ""; return; } return await super.onChangeState(); }, - async _onChangeCountry(init=false) { - await this.waitFor(super._onChangeCountry(...arguments)); - + _updateCountryLayout() { + super._updateCountryLayout(...arguments); if (this._getSelectedCountryCode() === 'BR') { this._setVisibility('.o_standard_address', false); // hide this._setVisibility('.o_extended_address', true); // show diff --git a/addons/l10n_br/views/portal_address_templates.xml b/addons/l10n_br/views/portal_address_templates.xml index 610331a32fdb7b..93de895fb1da3e 100644 --- a/addons/l10n_br/views/portal_address_templates.xml +++ b/addons/l10n_br/views/portal_address_templates.xml @@ -1,14 +1,23 @@ -