diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-01-01 04:52:28 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-01-01 04:52:28 +0700 |
| commit | 4f29a01888d72ffe07ebffa4e9e0637efb2495d2 (patch) | |
| tree | 58de506497a0562748487ada2d9c9906906836a7 | |
| parent | 059514b9c74027bf023edf19bbd0a308d0c1afda (diff) | |
<Miqdad> fix invoice date
| -rw-r--r-- | fixco_custom/models/account_move.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fixco_custom/models/account_move.py b/fixco_custom/models/account_move.py index 63b3e8e..58c94f7 100644 --- a/fixco_custom/models/account_move.py +++ b/fixco_custom/models/account_move.py @@ -1,3 +1,4 @@ +from cmath import e from odoo import models, api, fields, _ from odoo.exceptions import AccessError, UserError, ValidationError from datetime import timedelta, date, datetime @@ -63,7 +64,7 @@ class AccountMove(models.Model): def export_faktur_to_xml(self): valid_invoices = self - + coretax_faktur = self.env['coretax.faktur'].create({}) response = coretax_faktur.export_to_download( @@ -130,7 +131,7 @@ class AccountMove(models.Model): 'target': 'current', 'domain': [('id', 'in', list(reverses.ids))], } - + def action_reverse(self): action = self.env["ir.actions.actions"]._for_xml_id("account.action_view_account_move_reversal") @@ -198,10 +199,12 @@ class AccountMove(models.Model): res = super(AccountMove, self).action_post() for entry in self: if entry.move_type == 'out_invoice': - entry.invoice_date = entry.picking_id.date_done + if entry.picking_id: + entry.invoice_date = entry.picking_id.date_done + return res - + @api.onchange('purchase_vendor_bill_ids', 'purchase_id') def _onchange_purchase_auto_complete(self): """ Load from either multiple old purchase orders or vendor bills. """ @@ -235,7 +238,7 @@ class AccountMove(models.Model): new_lines += new_line new_lines._onchange_mark_recompute_taxes() - + # Compute invoice_origin origins = set(self.line_ids.mapped('purchase_line_id.order_id.name')) |
