from trytond.model import DeactivableMixin, ModelSQL, ModelView, fields DGII_FORMS = [ ('', ''), ('606', '606 - Compras y Gastos'), ('607', '607 - Ventas e Ingresos'), ('608', '608 - NCF Anulados'), ('609', '609 - Pagos al Exterior'), ('it1', 'IT-1 - Declaracion mensual ITBIS'), ('it1_annex_a', 'IT-1 Anexo A'), ('ir17', 'IR-17 - Otras Retenciones y Retribuciones Complementarias'), ('ir18', 'IR-18 - Dividendos'), ('ir13', 'IR-13 - Retenciones del Estado'), ('isc', 'ISC - Selectivo al Consumo'), ('act', 'ACT - Impuesto sobre Activos'), ('ir2', 'IR-2 - Impuesto sobre la Renta Personas Juridicas'), ] DGII_AMOUNT_SOURCES = [ ('', ''), ('tax_base', 'Base imponible'), ('tax_amount', 'Monto impuesto'), ('withholding_amount', 'Monto retenido'), ('perception_amount', 'Monto percibido'), ('account_balance', 'Saldo contable'), ('informative', 'Informativo'), ] DGII_OPERATORS = [ ('+', 'Suma'), ('-', 'Resta'), ('info', 'Informativo'), ] DGII_FLOWS = [ ('', ''), ('sale', 'Venta'), ('purchase', 'Compra'), ('payment', 'Pago o cobro'), ('bank', 'Cargo bancario'), ('asset', 'Transferencia de activo'), ('annual', 'Declaracion anual'), ] class DgiiTaxMapping(DeactivableMixin, ModelSQL, ModelView): "DGII Tax Mapping" __name__ = 'account.do.dgii.tax.mapping' tax_template = fields.Many2One( 'account.tax.template', 'Tax Template', required=True, ondelete='CASCADE', help='Impuesto de account_do que alimenta esta casilla DGII.') account_template = fields.Many2One( 'account.account.template', 'Account Template', help='Cuenta contable principal usada como trazabilidad del mapeo.') form = fields.Selection( DGII_FORMS, 'DGII Form', required=True, sort=False) box = fields.Char( 'DGII Box', required=True, size=80, help='Numero de casilla oficial o nombre tecnico del campo.') box_label = fields.Char('DGII Box Label', required=True, size=180) amount_source = fields.Selection( DGII_AMOUNT_SOURCES, 'Amount Source', required=True, sort=False) operator = fields.Selection( DGII_OPERATORS, 'Operator', required=True, sort=False) flow = fields.Selection( DGII_FLOWS, 'Fiscal Flow', required=True, sort=False) effective_from = fields.Date('Effective From') effective_to = fields.Date('Effective To') legal_basis = fields.Text('Legal Basis') notes = fields.Text('Notes') @staticmethod def default_operator(): return '+' @staticmethod def default_amount_source(): return 'tax_amount' @staticmethod def default_flow(): return 'sale' def get_rec_name(self, name): return '%s %s - %s' % ( self.form.upper(), self.box, self.tax_template.rec_name)