Files
app-odoo/app_base_chinese/models/res_partner.py
ivan deng 70c3bf0316 add doc
2018-12-05 08:45:01 +08:00

35 lines
880 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
from odoo import api, models, fields, _
from odoo.exceptions import UserError, ValidationError
class ResPartner(models.Model):
_inherit = 'res.partner'
short_name = fields.Char('Short Name') # 简称
# ref编码限制在 app_partner_auto_reference
# 显示[编码]简称
@api.multi
def name_get(self):
result = []
for partner in self:
if partner.short_name:
name = partner.short_name
else:
name = partner.name
if partner.ref:
name = '[' + partner.ref + ']' + name
result.append((partner.id, name))
return result
class PartnerCategory(models.Model):
_inherit = 'res.partner.category'
_order = 'sequence, name'
sequence = fields.Integer('Sequence', help="Used to order partner category")