summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-07-19 16:30:16 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-07-19 16:30:16 +0700
commitcd376800df0363e4df16772bde6b24f4800283c8 (patch)
treed655a4f688cc536573a4ad9941203409cdf4fd1b
parentf5d98918ebe21fab6fe97e7ab1eef9d15d158421 (diff)
fix error iscancel and invoice column
-rw-r--r--vit_efaktur/wizard/pk.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/vit_efaktur/wizard/pk.py b/vit_efaktur/wizard/pk.py
index 3c94622..ceb7549 100644
--- a/vit_efaktur/wizard/pk.py
+++ b/vit_efaktur/wizard/pk.py
@@ -56,8 +56,8 @@ class efaktur_pk_wizard(models.TransientModel):
csvwriter.writerow([h.upper() for h in headers])
inv_obj = self.env['account.move']
- invoices = inv_obj.search([('is_efaktur_exported','=',False),
- ('state','=','open'),
+ invoices = inv_obj.search([('is_efaktur_exported','!=',True),
+ ('state','=','posted'),
('efaktur_id','!=', False),
('move_type','=','out_invoice')])
@@ -235,7 +235,8 @@ class efaktur_pk_wizard(models.TransientModel):
print ("Tax Round ", round(inv['amount_tax']))
print ("DPP Round ", round(inv['amount_untaxed']))
- if inv['is_cancel']:
+ # fix is_cancel and invoice number column @stephan
+ if 'cancel' in inv['state']:
data = {
'FK': 'FK',
'KD_JENIS_TRANSAKSI': '01',
@@ -245,8 +246,8 @@ class efaktur_pk_wizard(models.TransientModel):
'TAHUN_PAJAK': inv['tahun_pajak'] or '',
'TANGGAL_FAKTUR': invoice_date,
'NPWP': npwp,
- 'NAMA': partner_id.name.encode('utf8') or '',
- 'ALAMAT_LENGKAP': partner_id.alamat_lengkap.encode('utf8') or '',
+ 'NAMA': partner_id.name or '',
+ 'ALAMAT_LENGKAP': partner_id.alamat_lengkap or '',
'JUMLAH_DPP': round(inv['amount_untaxed']) or 0,
'JUMLAH_PPN': round(inv['amount_tax']) or 0,
'JUMLAH_PPNBM': 0,
@@ -255,10 +256,10 @@ class efaktur_pk_wizard(models.TransientModel):
'UANG_MUKA_DPP': 0,
'UANG_MUKA_PPN': 0,
'UANG_MUKA_PPNBM': 0,
- 'REFERENSI': inv['number'] or ''
+ 'REFERENSI': inv['name'] or ''
}
- elif not inv['is_cancel']:
+ elif 'cancel' not in inv['state']:
data = {
'FK': 'FK',
'KD_JENIS_TRANSAKSI': '01',
@@ -268,8 +269,8 @@ class efaktur_pk_wizard(models.TransientModel):
'TAHUN_PAJAK': inv['tahun_pajak'] or '',
'TANGGAL_FAKTUR': invoice_date,
'NPWP': npwp,
- 'NAMA': partner_id.name.encode('utf8') or '',
- 'ALAMAT_LENGKAP': partner_id.alamat_lengkap.encode('utf8') or '',
+ 'NAMA': partner_id.name or '',
+ 'ALAMAT_LENGKAP': partner_id.alamat_lengkap or '',
'JUMLAH_DPP': round(inv['amount_untaxed']) or 0,
'JUMLAH_PPN': round(inv['amount_tax']) or 0,
'JUMLAH_PPNBM': 0,
@@ -278,7 +279,7 @@ class efaktur_pk_wizard(models.TransientModel):
'UANG_MUKA_DPP': 0,
'UANG_MUKA_PPN': 0,
'UANG_MUKA_PPNBM': 0,
- 'REFERENSI': inv['number'] or ''
+ 'REFERENSI': inv['name'] or ''
}
_logger.info(data)