init hatchtec module

This commit is contained in:
ivan deng
2018-11-30 01:21:28 +08:00
parent a520d3c81e
commit 2814bfc59f
3 changed files with 1156 additions and 45 deletions

View File

@@ -1,17 +0,0 @@
# -*- coding: utf-8 -*-
from odoo.exceptions import UserError, ValidationError
from odoo import api, fields, models, _
class AccountAccount(models.Model):
_inherit = "account.account"
@api.model
def _search_new_account_code(self, company, digits, prefix):
for num in range(1, 100):
new_code = str(prefix.ljust(digits - 1, '0')) + str(num)
rec = self.search([('code', '=', new_code), ('company_id', '=', company.id)], limit=1)
if not rec:
return new_code
raise UserError(_('Cannot generate an unused account code.'))