diff --git a/wizard/export_wizard.py b/wizard/export_wizard.py index 1a018cf93c08340f1ad24fb6028bfb909a1ccb75..05ec02d6f4296fd0072c35827ecc1150d296d612 100644 --- a/wizard/export_wizard.py +++ b/wizard/export_wizard.py @@ -40,6 +40,14 @@ class Export_wizard(models.TransientModel): string="Tipo de Acreditación", default="transfer", ) + impound_type = fields.Selection( + [ + ("judicial", "Judicial"), + ("food_quota", "Cuota Alimentaria"), + ], + string="Tipo Embargo", + default="judicial", + ) comments = fields.Char(string="Comentarios") company_id = fields.Many2one( @@ -64,13 +72,14 @@ class Export_wizard(models.TransientModel): self.total_impounds_amount = \ sum(line.impound_balance_line_ids.mapped('impound_novelties_quantity')) - def _create_impound_domain(self, from_date, until_date, acreditation_type, select_bank): + def _create_impound_domain(self, from_date, until_date, acreditation_type, impound_type, select_bank): valid_dates = set() impound_domain = [] impound_domain.append('&') impound_domain.append('&') impound_domain.append(('impounds_id.accreditation_type', '=', acreditation_type)) + impound_domain.append(('impounds_id.impound_type', '=', impound_type)) impound_domain.append(('impounds_id.state', '=', 'in_progress')) if self.bank_id.select_bank == 'OTROSBANCOS': @@ -96,7 +105,7 @@ class Export_wizard(models.TransientModel): return impound_domain - @api.onchange('bank_id', 'from_date', 'until_date', 'export_type', 'acreditation_type') + @api.onchange('bank_id', 'from_date', 'until_date', 'export_type', 'acreditation_type', 'impound_type') def _onchange_filter_ids(self): payslip_domain = [ ('date_from', '>=', self.from_date), @@ -128,9 +137,11 @@ class Export_wizard(models.TransientModel): from_date = self.from_date until_date = self.until_date acreditation_type = self.acreditation_type - if from_date and until_date and acreditation_type: + impound_type = self.impound_type + + if from_date and until_date and acreditation_type and impound_type: impound_domain = self._create_impound_domain( - from_date, until_date, acreditation_type, self.bank_id.select_bank) + from_date, until_date, acreditation_type, impound_type, self.bank_id.select_bank) return { 'domain': { @@ -353,10 +364,11 @@ class Export_wizard(models.TransientModel): from_date = self.from_date until_date = self.until_date acreditation_type = self.acreditation_type + impound_type = self.impound_type select_bank = self.bank_id.select_bank - if from_date and until_date and acreditation_type: + if from_date and until_date and acreditation_type and impound_type: impound_domain = self._create_impound_domain( - from_date, until_date, acreditation_type, select_bank) + from_date, until_date, acreditation_type, impound_type, select_bank) impound_balance_line_ids = self.env['impound.balance.lines'].search(impound_domain) if not impound_balance_line_ids.ids: @@ -396,6 +408,7 @@ class Export_wizard(models.TransientModel): 'cuil': employee.cuil, 'accreditation_date': self.accreditation_date.strftime('%Y%m%d'), 'acreditation_type': self.acreditation_type, + 'impound_type': self.impound_type, 'branch_office': bank_list[0]['office'], 'struct_type': 'impound', 'comments': 'EMBARGOS', diff --git a/wizard/export_wizard_views.xml b/wizard/export_wizard_views.xml index b764d8c3301690072f393731dada42934ac0a10a..e92b5de2303e51a7732dd33efe59856377b82705 100644 --- a/wizard/export_wizard_views.xml +++ b/wizard/export_wizard_views.xml @@ -36,6 +36,12 @@ 'invisible': ['|','|','|',('from_date','=', False),('until_date', '=', False),('accreditation_date', '=', False),('export_type', '!=', 'impound')]}" /> </group> + <group colspan="2"> + <field name="impound_type" + attrs="{ + 'invisible': ['|','|','|',('from_date','=', False),('until_date', '=', False),('accreditation_date', '=', False),('export_type', '!=', 'impound')]}" + /> + </group> <group> <field name="paylisp_ids" string='Nóminas'