|
1 | | - |
2 | | -from odoo import api, models, fields |
| 1 | +from odoo import api, fields, models |
3 | 2 |
|
4 | 3 |
|
5 | 4 | class AccountTaxKind(models.Model): |
6 | 5 |
|
7 | | - _name = 'account.tax.kind' |
8 | | - _description = 'Tax exemption kind' |
| 6 | + _name = "account.tax.kind" |
| 7 | + _description = "Tax exemption kind" |
9 | 8 |
|
10 | | - code = fields.Char(string='Code', size=4, required=True) |
11 | | - name = fields.Char(string='Name', required=True) |
| 9 | + code = fields.Char(string="Code", size=4, required=True) |
| 10 | + name = fields.Char(string="Name", required=True) |
12 | 11 |
|
13 | 12 | @api.multi |
14 | 13 | def name_get(self): |
15 | 14 | res = [] |
16 | 15 | for tax_kind in self: |
17 | | - res.append( |
18 | | - (tax_kind.id, '[%s] %s' % (tax_kind.code, tax_kind.name))) |
| 16 | + res.append((tax_kind.id, "[{}] {}".format(tax_kind.code, tax_kind.name))) |
19 | 17 | return res |
20 | 18 |
|
21 | 19 | @api.model |
22 | | - def name_search(self, name='', args=None, operator='ilike', limit=100): |
| 20 | + def name_search(self, name="", args=None, operator="ilike", limit=100): |
23 | 21 | if not args: |
24 | 22 | args = [] |
25 | 23 | if name: |
26 | | - records = self.search([ |
27 | | - '|', ('name', operator, name), ('code', operator, name) |
28 | | - ] + args, limit=limit) |
| 24 | + records = self.search( |
| 25 | + ["|", ("name", operator, name), ("code", operator, name)] + args, |
| 26 | + limit=limit, |
| 27 | + ) |
29 | 28 | else: |
30 | 29 | records = self.search(args, limit=limit) |
31 | 30 | return records.name_get() |
0 commit comments