Skip to content

Commit

Permalink
[IMP] Add multiple references. Partially operational for N/C N/D (in_…
Browse files Browse the repository at this point in the history
…refund and out_refund)
  • Loading branch information
Danisan committed Sep 9, 2016
1 parent 4342f8f commit 8a7abeb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
15 changes: 6 additions & 9 deletions README.md
Expand Up @@ -34,18 +34,15 @@ TO-DO:
argentinean localization project, but just in forms, not in code.


<p>
<img alt="Logo BMYA" src="http://crm.blancomartin.cl/index.php?entryPoint=image&name=c82ab43f-e8dd-b2fa-25ff-56017f69d116" />
</p>
**Blanco Martin & Asociados EIRL** - http://blancomartin.cl


## Créditos
### Este módulo es de autoría total de BMyA e inspirado por
el proyecto de localización argentina, pero solo en formas, no en código.

<p>
<img alt="Logo BMYA" src="http://crm.blancomartin.cl/index.php?entryPoint=image&name=c82ab43f-e8dd-b2fa-25ff-56017f69d116" />
</p>

![Logo BMyA](https://blancomartin.cl/website/image/ir.attachment/9711_e6d1eea/datas)
**Blanco Martin & Asociados EIRL** - http://blancomartin.cl


#### Versions:
8.1.0.0.0
- This version includes multiple references, for invoices and credit notes.
2 changes: 1 addition & 1 deletion __openerp__.py
Expand Up @@ -22,7 +22,7 @@
{
"name": """Chile - Web Services de Documentos Tributarios Electrónicos\
""",
'version': '8.0.2.1.0',
'version': '8.1.0.0.0',
'category': 'Localization/Chile',
'sequence': 12,
'author': 'Blanco Martín & Asociados',
Expand Down
26 changes: 19 additions & 7 deletions wizard/dte_status_update.py
Expand Up @@ -205,6 +205,7 @@ def compute_refund(self, mode='refund'):
self.ensure_one()
result = super(AccountInvoiceRefund, self).compute_refund(mode)
inv_obj = self.env['account.invoice']
ref_obj = self.env['invoice.reference']
# references = []
# num = 1
for active_id in inv_obj.browse(self.env.context.get('active_ids')):
Expand All @@ -216,13 +217,24 @@ def compute_refund(self, mode='refund'):

if created_inv and created_inv[0]:
refund_inv_id = created_inv[0][0]
inv_obj.browse(refund_inv_id).write(
_logger.info('ientra a la opcion de guardar referencia')
ref_obj.create(
{
'origin': self.description,
'reference': active_id.document_number,
'sii_referencia_FolioRef': self.get_folio_current(active_id),
'sii_referencia_TpoDocRef': active_id.sii_document_class_id.sii_code,
'sii_referencia_FchRef': active_id.date_invoice,
'sii_referencia_CodRef': self.sii_selection
'invoice_id': refund_inv_id,
'name': self.get_folio_current(active_id),
'sii_document_class_id': active_id.sii_document_class_id.id,
'reference_date': active_id.date_invoice,
'prefix': active_id.sii_document_class_id.sii_code,
'codref': self.sii_selection,
'reason': self.description,
})
# inv_obj.browse(refund_inv_id).write(
# {
# 'origin': self.description,
# 'reference': active_id.document_number,
# 'sii_referencia_FolioRef': self.get_folio_current(active_id),
# 'sii_referencia_TpoDocRef': active_id.sii_document_class_id.sii_code,
# 'sii_referencia_FchRef': active_id.date_invoice,
# 'sii_referencia_CodRef': self.sii_selection
# })
return result

0 comments on commit 8a7abeb

Please sign in to comment.