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
961 B

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