[FIX] account: mark as reconciled
`last_time_entries_checked` is a commercial field, so bypassing the write won't sync it. Closes #19274 opw-770018
This commit is contained in:
@@ -365,12 +365,7 @@ class ResPartner(models.Model):
|
||||
@api.multi
|
||||
def mark_as_reconciled(self):
|
||||
self.env['account.partial.reconcile'].check_access_rights('write')
|
||||
if self.ids:
|
||||
self.env.cr.execute(
|
||||
'UPDATE res_partner SET last_time_entries_checked = %s WHERE id IN %s',
|
||||
(time.strftime(DEFAULT_SERVER_DATETIME_FORMAT), tuple(self.ids),)
|
||||
)
|
||||
return True
|
||||
return self.sudo().with_context(company_id=self.env.user.company_id.id).write({'last_time_entries_checked': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)})
|
||||
|
||||
@api.one
|
||||
def _get_company_currency(self):
|
||||
|
||||
@@ -98,7 +98,11 @@ class ResPartner(models.Model):
|
||||
|
||||
@api.constrains("vat")
|
||||
def check_vat(self):
|
||||
if self.env.user.company_id.vat_check_vies:
|
||||
if self.env.context.get('company_id'):
|
||||
company = self.env['res.company'].browse(self.env.context['company_id'])
|
||||
else:
|
||||
company = self.env.user.company_id
|
||||
if company.vat_check_vies:
|
||||
# force full VIES online check
|
||||
check_func = self.vies_vat_check
|
||||
else:
|
||||
@@ -126,7 +130,11 @@ class ResPartner(models.Model):
|
||||
vat_no = "'CC##' (CC=Country Code, ##=VAT Number)"
|
||||
if default_vat_check(vat_country, vat_number):
|
||||
vat_no = _ref_vat[vat_country] if vat_country in _ref_vat else vat_no
|
||||
if self.env.user.company_id.vat_check_vies:
|
||||
if self.env.context.get('company_id'):
|
||||
company = self.env['res.company'].browse(self.env.context['company_id'])
|
||||
else:
|
||||
company = self.env.user.company_id
|
||||
if company.vat_check_vies:
|
||||
return '\n' + _('The VAT number [%s] for partner [%s] either failed the VIES VAT validation check or did not respect the expected format %s.') % (self.vat, self.name, vat_no)
|
||||
return '\n' + _('The VAT number [%s] for partner [%s] does not seem to be valid. \nNote: the expected format is %s') % (self.vat, self.name, vat_no)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user