diff --git a/addons/account/__init__.py b/addons/account/__init__.py
index 866c39de02e..86d81923e02 100644
--- a/addons/account/__init__.py
+++ b/addons/account/__init__.py
@@ -45,6 +45,8 @@ def _auto_install_l10n(cr, registry):
'PL', 'PT', 'RO', 'SI', 'TR', 'UK', 'VE', 'VN'
]:
module_list.append('base_vat')
+ if country_code == 'MX':
+ module_list.append('l10n_mx_edi')
# European countries will be using SEPA
europe = env.ref('base.europe', raise_if_not_found=False)
diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py
index f4cb84a3531..539e9b64a8f 100644
--- a/addons/account/models/account_payment.py
+++ b/addons/account/models/account_payment.py
@@ -87,6 +87,16 @@ class account_abstract_payment(models.AbstractModel):
# Check all invoices have the same currency
if any(inv.currency_id != invoices[0].currency_id for inv in invoices):
raise UserError(_("In order to pay multiple invoices at once, they must use the same currency."))
+ # Check if, in batch payments, there are not negative invoices and positive invoices
+ dtype = invoices[0].type
+ for inv in invoices[1:]:
+ if inv.type != dtype:
+ if ((dtype == 'in_refund' and inv.type == 'in_invoice') or
+ (dtype == 'in_invoice' and inv.type == 'in_refund')):
+ raise UserError(_("You cannot register payments for vendor bills and supplier refunds at the same time."))
+ if ((dtype == 'out_refund' and inv.type == 'out_invoice') or
+ (dtype == 'out_invoice' and inv.type == 'out_refund')):
+ raise UserError(_("You cannot register payments for customer invoices and credit notes at the same time."))
# Look if we are mixin multiple commercial_partner or customer invoices with vendor bills
multi = any(inv.commercial_partner_id != invoices[0].commercial_partner_id
diff --git a/addons/account/models/res_users.py b/addons/account/models/res_users.py
index ab85e359d22..8030423e74d 100644
--- a/addons/account/models/res_users.py
+++ b/addons/account/models/res_users.py
@@ -14,8 +14,8 @@ class Users(models.Model):
super(Users, self)._check_one_user_type()
users_with_both_groups = self.filtered(lambda user:
- user.user_has_groups('account.group_show_line_subtotals_tax_included') and
- user.user_has_groups('account.group_show_line_subtotals_tax_excluded')
+ user.has_group('account.group_show_line_subtotals_tax_included') and
+ user.has_group('account.group_show_line_subtotals_tax_excluded')
)
if users_with_both_groups:
names = ", ".join(users_with_both_groups.mapped('name'))
diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml
index b7ec99e56c0..648dc59f1c3 100644
--- a/addons/account/security/account_security.xml
+++ b/addons/account/security/account_security.xml
@@ -59,6 +59,17 @@