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.

57 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_model="statement.common.wizard",
  14. )
  15. default_show_aging_buckets = fields.Boolean(
  16. string="Show Aging Buckets",
  17. default_model="statement.common.wizard",
  18. )
  19. default_filter_partners_non_due = fields.Boolean(
  20. string='Exclude partners with no due entries',
  21. default_model="statement.common.wizard",
  22. )
  23. default_filter_negative_balances = fields.Boolean(
  24. "Exclude Negative Balances",
  25. default_model="statement.common.wizard",
  26. )
  27. group_outstanding_statement = fields.Boolean(
  28. "Enable OCA Outstanding Statements",
  29. group='account.group_account_invoice',
  30. implied_group='partner_statement.group_outstanding_statement',
  31. )
  32. def set_values(self):
  33. self = self.with_context(active_test=False)
  34. # default values fields
  35. IrDefault = self.env['ir.default'].sudo()
  36. for name, field in self._fields.items():
  37. if (name.startswith("default_") and
  38. field.default_model == 'statement.common.wizard'):
  39. if isinstance(self[name], models.BaseModel):
  40. if self._fields[name].type == 'many2one':
  41. value = self[name].id
  42. else:
  43. value = self[name].ids
  44. else:
  45. value = self[name]
  46. IrDefault.set('activity.statement.wizard', name[8:], value)
  47. IrDefault.set('outstanding.statement.wizard', name[8:], value)
  48. return super().set_values()