# -*- encoding: utf-8 -*-
###############################################################################
#                                                                             #
# Copyright (C) 2013  Renato Lima - Akretion                                  #
#                                                                             #
#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 openerp import models, fields

from .l10n_br_account_product import (
    PRODUCT_FISCAL_TYPE,
    PRODUCT_FISCAL_TYPE_DEFAULT)


class L10nBrAccountFiscalCategory(models.Model):
    _inherit = 'l10n_br_account.fiscal.category'

    fiscal_type = fields.Selection(
        PRODUCT_FISCAL_TYPE, 'Tipo Fiscal', required=True,
        default=PRODUCT_FISCAL_TYPE_DEFAULT)


class L10nBrAccountDocumentSerie(models.Model):
    _inherit = 'l10n_br_account.document.serie'
    _columns = {
        'fiscal_type': fields.selection(
            PRODUCT_FISCAL_TYPE, 'Tipo Fiscal', required=True),
    }
    _defaults = {
        'fiscal_type': PRODUCT_FISCAL_TYPE_DEFAULT,
    }


class L10n_brAccountPartnerFiscalType(orm.Model):
    _inherit = 'l10n_br_account.partner.fiscal.type'
    _columns = {
        'icms': fields.boolean('Recupera ICMS'),
        'ipi': fields.boolean('Recupera IPI')
    }
    defaults = {
        'icms': True,
        'ipi': True
    }
@@ -1856,34 +1856,13 @@
 ie'%0A
-    _columns = %7B%0A  
+%0A
     
-  '
 fisc
@@ -1868,26 +1868,26 @@
 cal_type
-':
+ =
  fields.
 selectio
@@ -1878,17 +1878,17 @@
  fields.
-s
+S
 election
@@ -1893,28 +1893,24 @@
 on(%0A        
-    
 PRODUCT_FISC
@@ -1950,58 +1950,26 @@
 True
-)
 ,%0A    
-%7D%0A
     
-_
 default
-s = %7B%0A        'fiscal_type': 
+=
 PROD
@@ -1995,16 +1995,9 @@
 AULT
-,%0A    %7D%0A
+)
 %0A%0Acl

migrate l10n_br_account.document.serie object to new API