You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.0 KiB

  1. from odoo import fields, models
  2. class ResConfigSettings(models.TransientModel):
  3. _inherit = 'res.config.settings'
  4. group_activity_statement = fields.Boolean(
  5. "Enable OCA Activity Statements",
  6. group='account.group_account_invoice',
  7. implied_group='partner_statement.group_activity_statement',
  8. )
  9. default_aging_type = fields.Selection(
  10. [("days", "Age by Days"), ("months", "Age by Months")],
  11. string="Aging Method",
  12. required=True,
  13. default="days",
  14. default_model="statement.common.wizard",
  15. )
  16. default_show_aging_buckets = fields.Boolean(
  17. string="Show Aging Buckets",
  18. default_model="statement.common.wizard",
  19. )
  20. default_filter_partners_non_due = fields.Boolean(
  21. string='Exclude partners with no due entries',
  22. default_model="statement.common.wizard",
  23. )
  24. default_filter_negative_balances = fields.Boolean(
  25. "Exclude Negative Balances",
  26. default_model="statement.common.wizard",
  27. )
  28. group_outstanding_statement = fields.Boolean(
  29. "Enable OCA Outstanding Statements",
  30. group='account.group_account_invoice',
  31. implied_group='partner_statement.group_outstanding_statement',
  32. )
  33. def set_values(self):
  34. self = self.with_context(active_test=False)
  35. # default values fields
  36. IrDefault = self.env['ir.default'].sudo()
  37. for name, field in self._fields.items():
  38. if (name.startswith("default_") and
  39. field.default_model == 'statement.common.wizard'):
  40. if isinstance(self[name], models.BaseModel):
  41. if self._fields[name].type == 'many2one':
  42. value = self[name].id
  43. else:
  44. value = self[name].ids
  45. else:
  46. value = self[name]
  47. IrDefault.set('activity.statement.wizard', name[8:], value)
  48. IrDefault.set('outstanding.statement.wizard', name[8:], value)
  49. return super().set_values()