|
- # -*- coding: utf-8 -*-
- ##############################################################################
- #
- # OpenERP, Open Source Management Solution
- # Copyright (C) 2016 武康开源软件(宣一敏).
- #
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU Affero General Public License as
- # published by the Free Software Foundation, either version 3 of the
- # License, or (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU Affero General Public License for more details.
- #
- # You should have received a copy of the GNU Affero General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
- #
- ##############################################################################
-
- from odoo import api, fields, models, tools, _
- from random import randint
-
- class Partner(models.Model):
- '''
- 在合作伙伴上增加由系统创建标志,用于区别是tax系统反向生成还是别的人员录入,可以作为是否能自动反推的依据
- '''
- _inherit = "res.partner"
-
- computer_import = fields.Boolean('系统创建', default= False)
-
- class ProductTemplate(models.Model):
- _inherit = "product.template"
- '''
- 在产品上增加由系统创建标志,用于区别是tax系统反向生成还是别的人员录入,可以作为是否能自动反推的依据
- '''
- computer_import = fields.Boolean('系统创建',default= False)
- tax_category_id = fields.Many2one('tax.category', string='税收分类')
-
- class tax_category(models.Model):
- _name = 'tax.category'
- _description = '税收分类编码'
-
- '''
- 增加税收分类编码,此编码很重要,是开票系统上传国家税务局的数据之一
- '''
- code = fields.Char('编号')
- name = fields.Char('名称')
- print_name = fields.Char('简称')
- superior = fields.Many2one('tax.category', '上级分类', help='上级类别', copy=False)
- note = fields.Text('说明')
- tax_rate = fields.Integer('税率', help='因为有可能有多个税率在这里面,所以现在很奇怪')
-
- class ProductCategory(models.Model):
- _inherit = 'product.category'
-
- tax_category_id = fields.Many2one('tax.category', string='税收分类')
-
- class CnInvoiceType(models.Model):
- _name = 'cn.invoice.type'
- _description = '发票类型'
-
- def _get_default_color(self):
- return randint(1, 11)
-
- name = fields.Char('类型名称')
- is_coming_tax = fields.Boolean('是否可以抵扣')
- note = fields.Text('备注')
- code = fields.Char('发票类型代码')
- color = fields.Integer('颜色', default=_get_default_color)
- is_electric = fields.Boolean('是否全电发票', default=False)
-
- class AccountMoveLine(models.Model):
- _inherit = "account.move.line"
-
- is_cn_invoice = fields.Boolean('已开票')
|