Browse Source

publish muk_autovacuum - 12.0

pull/9/head
MuK IT GmbH 6 years ago
parent
commit
4e3b1c88f3
  1. 2
      muk_autovacuum/__manifest__.py
  2. 8
      muk_autovacuum/models/ir_autovacuum.py

2
muk_autovacuum/__manifest__.py

@ -20,7 +20,7 @@
{
'name': 'MuK Autovacuum',
'summary': 'Configure automatic garbage collection',
'version': '12.0.2.1.9',
'version': '12.0.2.1.10',
'category': 'Extra Tools',
'license': 'AGPL-3',
'author': 'MuK IT',

8
muk_autovacuum/models/ir_autovacuum.py

@ -59,18 +59,18 @@ class AutoVacuum(models.AbstractModel):
if rule.only_inactive and "active" in rule.model.field_id.mapped("name"):
domain.append(('active', '=', False))
_logger.info(_("GC domain: %s"), domain)
records = model.with_context({'active_test': False}).search(domain)
records = model.with_context(active_test=False).search(domain)
elif rule.state == 'size':
size = rule.size if rule.size_type == 'fixed' else rule.size_parameter_value
count = model.with_context({'active_test': False}).search([], count=True)
count = model.with_context(active_test=False).search([], count=True)
if size and size > 0 and count > size:
limit = count - size
_logger.info(_("GC domain: [] order: %s limit: %s"), rule.size_order, limit)
records = model.with_context({'active_test': False}).search([], order=rule.size_order, limit=limit)
records = model.with_context(active_test=False).search([], order=rule.size_order, limit=limit)
elif rule.state == 'domain':
_logger.info(_("GC domain: %s"), rule.domain)
domain = safe_eval(rule.domain or "[]", rules._get_eval_domain_context())
records = model.with_context({'active_test': False}).search(domain)
records = model.with_context(active_test=False).search(domain)
if rule.only_attachments:
attachments = self.env['ir.attachment'].sudo().search([
('res_model', '=', rule.model.model),

Loading…
Cancel
Save