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.

73 lines
2.0 KiB

  1. .. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg
  2. :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
  3. :alt: License: LGPL-3
  4. ====================
  5. Locale - Default UoM
  6. ====================
  7. This module adds a concept of a default unit of measure on languages, unique by
  8. unit category type.
  9. It also provides a method that can be used in fields to work from said defaults.
  10. Configuration
  11. =============
  12. Set default unit of measures in the `Languages` menu in settings.
  13. Usage
  14. =====
  15. Fields that want to implement the language default should use the provided method,
  16. such as in the below example::
  17. class MyModel(models.Model):
  18. _name = 'my.model'
  19. time_uom_id = fields.Many2one(
  20. string='Time Units',
  21. comodel_name='product.uom',
  22. default=lambda s: s.env['res.lang'].default_uom_by_category('Time'),
  23. )
  24. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  25. :alt: Try me on Runbot
  26. :target: https://runbot.odoo-community.org/runbot/149/10.0
  27. Bug Tracker
  28. ===========
  29. Bugs are tracked on `GitHub Issues
  30. <https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
  31. check there if your issue has already been reported. If you spotted it first,
  32. help us smash it by providing detailed and welcomed feedback.
  33. Credits
  34. =======
  35. Images
  36. ------
  37. * Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
  38. Contributors
  39. ------------
  40. * Dave Lasley <dave@laslabs.com>
  41. Do not contact contributors directly about support or help with technical issues.
  42. Maintainer
  43. ----------
  44. .. image:: https://odoo-community.org/logo.png
  45. :alt: Odoo Community Association
  46. :target: https://odoo-community.org
  47. This module is maintained by the OCA.
  48. OCA, or the Odoo Community Association, is a nonprofit organization whose
  49. mission is to support the collaborative development of Odoo features and
  50. promote its widespread use.
  51. To contribute to this module, please visit https://odoo-community.org.