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.

30 lines
935 B

  1. # Copyright 2017 Tecnativa - Vicent Cubells
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo import api, fields, models
  4. class AccountAnalyticAccount(models.Model):
  5. _name = 'account.analytic.account'
  6. _inherit = ['account.analytic.account', 'mail.thread']
  7. customer_signature = fields.Binary(
  8. string='Customer acceptance',
  9. )
  10. signature_name = fields.Char(
  11. string='Signed by',
  12. )
  13. @api.model
  14. def create(self, values):
  15. contract = super(AccountAnalyticAccount, self).create(values)
  16. if contract.customer_signature:
  17. values = {'customer_signature': contract.customer_signature}
  18. contract._track_signature(values, 'customer_signature')
  19. return contract
  20. @api.multi
  21. def write(self, values):
  22. self._track_signature(values, 'customer_signature')
  23. return super(AccountAnalyticAccount, self).write(values)