diff --git a/l10n_es_aeat_mod349/models/mod349.py b/l10n_es_aeat_mod349/models/mod349.py index f6c361ca34f..519ba51b929 100644 --- a/l10n_es_aeat_mod349/models/mod349.py +++ b/l10n_es_aeat_mod349/models/mod349.py @@ -354,7 +354,7 @@ def onchange_format_partner_vat(self, partner_vat, country_id): report_id = fields.Many2one( comodel_name='l10n.es.aeat.mod349.report', - string='AEAT 349 Report ID') + string='AEAT 349 Report ID', ondelete="cascade") name = fields.Char(compute="get_record_name") partner_id = fields.Many2one( comodel_name='res.partner', string='Partner', required=True) @@ -368,8 +368,7 @@ def onchange_format_partner_vat(self, partner_vat, country_id): help='Checked if partner record is OK') record_detail_ids = fields.One2many( comodel_name='l10n.es.aeat.mod349.partner_record_detail', - inverse_name='partner_record_id', string='Partner record detail IDS', - ondelete='cascade') + inverse_name='partner_record_id', string='Partner record detail IDS') class Mod349PartnerRecordDetail(models.Model): @@ -384,7 +383,7 @@ class Mod349PartnerRecordDetail(models.Model): default=lambda self: self.env.context.get('partner_record_id'), string='Partner record', required=True, ondelete='cascade', select=1) invoice_id = fields.Many2one( - comodel_name='account.invoice', string='Invoice') + comodel_name='account.invoice', string='Invoice', required=True) amount_untaxed = fields.Float(string='Amount untaxed') date = fields.Date(related='invoice_id.date_invoice', string="Date", readonly=True) @@ -407,7 +406,8 @@ def _check_partner_refund_line(self): self.period_selection and self.fiscalyear_id) report_id = fields.Many2one( - comodel_name='l10n.es.aeat.mod349.report', string='AEAT 349 Report ID') + comodel_name='l10n.es.aeat.mod349.report', string='AEAT 349 Report ID', + ondelete="cascade") partner_id = fields.Many2one( comodel_name='res.partner', string='Partner', required=1, select=1) partner_vat = fields.Char(string='VAT', size=15) @@ -432,8 +432,7 @@ def _check_partner_refund_line(self): month_selection = fields.Selection(selection=MONTH_MAPPING, string='Month') refund_detail_ids = fields.One2many( comodel_name='l10n.es.aeat.mod349.partner_refund_detail', - inverse_name='refund_id', string='Partner refund detail IDS', - ondelete='cascade') + inverse_name='refund_id', string='Partner refund detail IDS') @api.multi def onchange_format_partner_vat(self, partner_vat, country_id): @@ -451,9 +450,10 @@ class Mod349PartnerRefundDetail(models.Model): refund_id = fields.Many2one( comodel_name='l10n.es.aeat.mod349.partner_refund', - string='Partner refund ID') + string='Partner refund ID', ondelete="cascade") invoice_id = fields.Many2one( - comodel_name='account.invoice', string='Invoice ID') + comodel_name='account.invoice', string='Invoice ID', + required=True) amount_untaxed = fields.Float(string='Amount untaxed') date = fields.Date(related='invoice_id.date_invoice', string="Date", readonly=True)