...
 
Commits (7)
  • agb80's avatar
    chore(version): set version 2.6.7 · 73a98d7e
    agb80 authored
    73a98d7e
  • agb80's avatar
    Merge branch 'release-2.6.7' · fcf1bfeb
    agb80 authored
    fcf1bfeb
  • agb80's avatar
    chore(version): set version 2.7.0 · c37c6f30
    agb80 authored
    c37c6f30
  • agb80's avatar
    feat(account.voucher): agrega la posibilidad de cancelar los recibos de pago electrónicos · f0d769f0
    agb80 authored
    De acuerdo a la guía de llenado de complemento de pagos vigente al día 31 de agosto de 2018 los
    recibos electrónico de pagos se pueden cancelar siempre y cuando vayan a ser substituidos
    posteriormente por un recibo electrónico. El nuevo recibo debe estar relacionado con el recibo que
    se está cancelando.
    
    Para automatizar este proceso al interior del sistema estamos realizando
    los siguientes cambios importantes:
    * Agregamos un nuevo estado a los vouchers de pago que se llama `signed`
    que servirá para identificar claramente los vouchers firmados.
    * Cuando estamos en el estado `signed` agregamos dos botones de acción
    que permiten que el usario pueda realizar la cancelación del voucher o
    la substitución.
    * Si el usuario opta por cancelar el voucher entonces el sistema realiza
    de manera automática la cancelación del CFDI correspondiente, cancela
    también el voucher de pago al interior del sistema y posteriormente
    genera un nuevo CFDI por el valor de 1 peso relacionado con el CFDI
    original y lo timbra.
    * Si el usuario opta por substituir el voucher entonces el sistema
    cancela el voucher y el CFDI relacionado y luego vuelve a abrir el
    voucher de pago para que pueda ser modificado dejando de manera interna
    la relación con el CFDI original para que se incluya en el nuevo CFDI
    que se está generando.
    * Eliminamos el filtro `Sin Firmar` porque ya no tiene razón de ser,
    ahora todos los vouchers no firmados estarán por defecto en el estado
    `posted`
    f0d769f0
  • agb80's avatar
    fix(es_MX): actualiza traducción · e0fe9656
    agb80 authored
    e0fe9656
  • agb80's avatar
    feat(account.voucher): agrega la plantilla de correo electrónico · 376acc16
    agb80 authored
    Para facilitar el funcionamiento del sistema cuando se realiza una instalación nueva agregamos una
    plantilla de correo electrónico por defecto para el envío del recibo de pagos de forma automática.
    376acc16
  • agb80's avatar
<a name="2.6.7"></a>
## 2.6.7 (2018-10-08)
#### Bug Fixes
* **account.voucher:**
* se corrige la hora de pago,en voucher T ([851cae38](851cae38))
* se corrige error al momento de pagar una factura con un saldo mayor al monto ([32beb78b](32beb78b))
<a name="2.6.6"></a>
## 2.6.6 (2018-09-27)
......
......@@ -2,7 +2,7 @@
{
'name': 'Factura Electronica CFDI',
'version': '2.6.6',
'version': '2.7.0',
'author': 'OpenPyme',
'category': 'Localization/Mexico',
'website': 'http://www.openpyme.mx/',
......@@ -26,6 +26,7 @@
'wizard/account_invoice_refund.xml',
'report/account_invoice.xml',
'report/account_voucher.xml',
'data/email_template.xml',
'data/ir_attachment_facturae_config.xml',
],
'installable': True,
......
<?xml version="1.0" ?>
<openerp>
<!-- Mail template are declared in a NOUPDATE block
so users can freely customize/delete them -->
<data noupdate="1">
<!--Email template -->
<record id="account_voucher_cfdi_email_template" model="email.template">
<field name="name">Electronic Payment Receipt</field>
<field name="subject">${object.company_id.name|safe} Payment (Ref ${object.number or 'n/a'})</field>
<field name="partner_to">${object.partner_id.id}</field>
<field name="model_id" ref="account_voucher.model_account_voucher"/>
<field name="auto_delete" eval="True"/>
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.partner_id.name},</p>
<p>A new payment receipt is available for you: </p>
<p style="border-left: 1px solid #8e0000; margin-left: 30px;">
&nbsp;&nbsp;<strong>REFERENCES</strong><br />
&nbsp;&nbsp;Internal reference: <strong>${object.number}</strong><br />
&nbsp;&nbsp;Total amount: <strong>${object.amount_total} ${object.currency_id.name}</strong><br />
&nbsp;&nbsp;Payment date: ${object.date}<br />
</p>
<br/>
<p>If you have any question, do not hesitate to contact us.</p>
<p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
<br/>
<br/>
<div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;">
<h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;">
<strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
</div>
<div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;">
<span style="color: #222; margin-bottom: 5px; display: block; ">
% if object.company_id.street:
${object.company_id.street}<br/>
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
</span>
% if object.company_id.phone:
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">
Phone:&nbsp; ${object.company_id.phone}
</div>
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<p></p>
</div>
</div>
]]></field>
</record>
</data>
</openerp>
......@@ -28,6 +28,7 @@
<field name="template_xml_cancel">Aun.no.hay.uno</field>
<field name="template_pdf_sign">account.voucher.cfdi.pdf</field>
<field name="template_pdf_cancel">account.voucher.cfdi.pdf</field>
<field name="email_template_id" ref="account_voucher_cfdi_email_template"/>
</record>
</data>
......
......@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0rc3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-14 17:12+0000\n"
"PO-Revision-Date: 2018-09-14 12:14-0500\n"
"POT-Creation-Date: 2018-09-21 21:05+0000\n"
"PO-Revision-Date: 2018-09-21 16:19-0500\n"
"Last-Translator: Agustín Cruz <agustin.cruz@openpyme.mx>\n"
"Language-Team: \n"
"Language: es_MX\n"
......@@ -144,6 +144,11 @@ msgstr "Adendas"
msgid "CFD-I Folio Fiscal"
msgstr "Folio Fiscal"
#. module: l10n_mx_facturae
#: view:account.voucher:l10n_mx_facturae.account_voucher_view_form
msgid "Are you sure to cancel this voucher?"
msgstr "¿Está seguro de que quiere cancelar este recibo?"
#. module: l10n_mx_facturae
#: field:account.invoice,cfdi_id:0 field:account.voucher,cfdi_id:0
msgid "CFDI"
......@@ -162,6 +167,7 @@ msgstr "Detalles"
#. module: l10n_mx_facturae
#: field:account.invoice,cfdi_relation_type:0
#: field:account.invoice.refund,cfdi_relation_type:0
#: field:account.voucher,cfdi_relation_type:0
msgid "CFDI Relation type"
msgstr "Tipo de relación de CFDI"
......@@ -175,6 +181,11 @@ msgstr "CFDI relacionado al documento seleccionado."
msgid "CFDI use"
msgstr "Uso del CFDI"
#. module: l10n_mx_facturae
#: view:account.voucher:l10n_mx_facturae.account_voucher_view_form
msgid "Cancel"
msgstr "Cancelar"
#. module: l10n_mx_facturae
#: help:res.partner,cfdi_use:0
msgid ""
......@@ -184,10 +195,16 @@ msgstr ""
"El uso del CFDI que se usará por defecto para las facturas y notas de "
"crédito emitidas a este cliente"
#. module: l10n_mx_facturae
#: field:account.invoice,cfdi_adenda_code:0
#: field:res.partner,cfdi_adenda_code:0
msgid "Code"
msgstr "Código"
#. module: l10n_mx_facturae
#: view:res.partner:l10n_mx_facturae.res_partner_view_form
msgid "Configuraciones"
msgstr ""
msgstr "Configuraciones"
#. module: l10n_mx_facturae
#: field:account.invoice,date_invoice_cancel:0
......@@ -234,13 +251,18 @@ msgstr "Número fiscal"
msgid "Folio used in the electronic invoice"
msgstr "Folio usado en la factura electrónica"
#. module: l10n_mx_facturae
#: help:account.invoice,cfdi_adenda_code:0 help:res.partner,cfdi_adenda_code:0
msgid "Helper field to improve view management"
msgstr "Campo de ayuda para mejorar la gestión de vistas"
#. module: l10n_mx_facturae
#: help:account.invoice,date_invoice_cancel:0
msgid "If the invoice is cancelled, save the date when was cancel"
msgstr "Si la facura es cancelada, se guarda la fecha en que se cancela"
#. module: l10n_mx_facturae
#: code:addons/l10n_mx_facturae/models/account_invoice.py:455
#: code:addons/l10n_mx_facturae/models/account_invoice.py:456
#, python-format
msgid ""
"Incorrect tax sequence configuration, check this data in Account >> Tax >> "
......@@ -254,6 +276,11 @@ msgstr ""
msgid "Invoice"
msgstr "Factura"
#. module: l10n_mx_facturae
#: model:ir.actions.report.xml,name:l10n_mx_facturae.l10n_mx_facturae_report_aeroo
msgid "Invoice CFDI"
msgstr "CFDI"
#. module: l10n_mx_facturae
#: model:ir.model,name:l10n_mx_facturae.model_account_invoice_line
msgid "Invoice Line"
......@@ -286,9 +313,9 @@ msgid "Missing SAT code for product: {product}"
msgstr "Falta el código SAT para el producto: {product}"
#. module: l10n_mx_facturae
#: view:account.voucher:l10n_mx_facturae.account_voucher_view_search
msgid "Not Signed Vouchers"
msgstr "Comprobantes sin firmar"
#: help:res.partner,supplier_number:0
msgid "Number or reference that the Client assigned to our company."
msgstr "Número o referencia que el Cliente le asignó a su compañía."
#. module: l10n_mx_facturae
#: view:res.partner:l10n_mx_facturae.res_partner_view_form
......@@ -304,6 +331,11 @@ msgstr ""
"empresa,\n"
"productos, servicios, facturas o notas de entrega"
#. module: l10n_mx_facturae
#: help:account.voucher,related_cfdi_ids:0
msgid "Original CFDI to which this CFDI is referred to"
msgstr "CFDI relacionado con el CFDI actual"
#. module: l10n_mx_facturae
#: model:ir.model,name:l10n_mx_facturae.model_res_partner
msgid "Partner"
......@@ -335,11 +367,21 @@ msgid "Posted"
msgstr "Posteda"
#. module: l10n_mx_facturae
#: code:addons/l10n_mx_facturae/models/account_invoice.py:438
#: code:addons/l10n_mx_facturae/models/account_invoice.py:439
#, python-format
msgid "Product {p} must have at least one tax selected."
msgstr "El producto {p} debe tener al menos un impuesto."
#. module: l10n_mx_facturae
#: field:account.voucher,related_cfdi_ids:0
msgid "Refund invoices"
msgstr "Notas de crédito"
#. module: l10n_mx_facturae
#: view:account.voucher:l10n_mx_facturae.account_voucher_view_form
msgid "Replace"
msgstr "Substituir"
#. module: l10n_mx_facturae
#: help:account.invoice,cfdi_adenda_id:0
msgid "Select addendum node to use on invoice."
......@@ -381,6 +423,11 @@ msgstr "Estado"
msgid "State of attachments"
msgstr "Estado de los adjuntos"
#. module: l10n_mx_facturae
#: field:res.partner,supplier_number:0
msgid "Supplier number"
msgstr "Número de proveedor"
#. module: l10n_mx_facturae
#: help:res.partner,cfdi_adenda:0
msgid "This field allows adding a node or addendum to the invoice"
......@@ -406,6 +453,12 @@ msgstr ""
msgid "{'always_reload': True,'no_quick_create': True}"
msgstr ""
#. module: l10n_mx_facturae
#: view:account.voucher:l10n_mx_facturae.account_voucher_view_form
msgid ""
"{'invisible': ['|', ('cfdi_state', '!=', False), ('state', '!=', 'cancel')]}"
msgstr ""
#. module: l10n_mx_facturae
#: view:account.invoice:l10n_mx_facturae.account_invoice_view_form_customer
msgid ""
......
......@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0rc14\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-14 17:12+0000\n"
"PO-Revision-Date: 2018-09-14 17:12+0000\n"
"POT-Creation-Date: 2018-09-21 21:05+0000\n"
"PO-Revision-Date: 2018-09-21 21:05+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
......@@ -123,6 +123,11 @@ msgstr ""
msgid "CFD-I Folio Fiscal"
msgstr ""
#. module: l10n_mx_facturae
#: view:account.voucher:l10n_mx_facturae.account_voucher_view_form
msgid "Are you sure to cancel this voucher?"
msgstr ""
#. module: l10n_mx_facturae
#: field:account.invoice,cfdi_id:0
#: field:account.voucher,cfdi_id:0
......@@ -142,6 +147,7 @@ msgstr ""
#. module: l10n_mx_facturae
#: field:account.invoice,cfdi_relation_type:0
#: field:account.invoice.refund,cfdi_relation_type:0
#: field:account.voucher,cfdi_relation_type:0
msgid "CFDI Relation type"
msgstr ""
......@@ -156,11 +162,22 @@ msgstr ""
msgid "CFDI use"
msgstr ""
#. module: l10n_mx_facturae
#: view:account.voucher:l10n_mx_facturae.account_voucher_view_form
msgid "Cancel"
msgstr ""
#. module: l10n_mx_facturae
#: help:res.partner,cfdi_use:0
msgid "Cfdi usage that will be used by default on this customer invoices and credit notes"
msgstr ""
#. module: l10n_mx_facturae
#: field:account.invoice,cfdi_adenda_code:0
#: field:res.partner,cfdi_adenda_code:0
msgid "Code"
msgstr ""
#. module: l10n_mx_facturae
#: view:res.partner:l10n_mx_facturae.res_partner_view_form
msgid "Configuraciones"
......@@ -206,8 +223,9 @@ msgid "Fiscal Number"
msgstr ""
#. module: l10n_mx_facturae
#: help:account.invoice,cfdi_folio_fiscal:0
msgid "Folio used in the electronic invoice"
#: help:account.invoice,cfdi_adenda_code:0
#: help:res.partner,cfdi_adenda_code:0
msgid "Helper field to improve view management"
msgstr ""
#. module: l10n_mx_facturae
......@@ -216,7 +234,7 @@ msgid "If the invoice is cancelled, save the date when was cancel"
msgstr ""
#. module: l10n_mx_facturae
#: code:addons/l10n_mx_facturae/models/account_invoice.py:455
#: code:addons/l10n_mx_facturae/models/account_invoice.py:456
#, python-format
msgid "Incorrect tax sequence configuration, check this data in Account >> Tax >> Sequence"
msgstr ""
......@@ -226,6 +244,11 @@ msgstr ""
msgid "Invoice"
msgstr ""
#. module: l10n_mx_facturae
#: model:ir.actions.report.xml,name:l10n_mx_facturae.l10n_mx_facturae_report_aeroo
msgid "Invoice CFDI"
msgstr ""
#. module: l10n_mx_facturae
#: model:ir.model,name:l10n_mx_facturae.model_account_invoice_line
msgid "Invoice Line"
......@@ -262,6 +285,11 @@ msgstr ""
msgid "Not Signed Vouchers"
msgstr ""
#. module: l10n_mx_facturae
#: help:res.partner,supplier_number:0
msgid "Number or reference that the Client assigned to our company."
msgstr ""
#. module: l10n_mx_facturae
#: view:res.partner:l10n_mx_facturae.res_partner_view_form
msgid "Once you have selected the addendum, you must add the necessary information\n"
......@@ -269,6 +297,11 @@ msgid "Once you have selected the addendum, you must add the necessary informati
" products, services, invoices or delivery notes"
msgstr ""
#. module: l10n_mx_facturae
#: help:account.voucher,related_cfdi_ids:0
msgid "Original CFDI to which this CFDI is referred to"
msgstr ""
#. module: l10n_mx_facturae
#: model:ir.model,name:l10n_mx_facturae.model_res_partner
msgid "Partner"
......@@ -296,11 +329,21 @@ msgid "Posted"
msgstr ""
#. module: l10n_mx_facturae
#: code:addons/l10n_mx_facturae/models/account_invoice.py:438
#: code:addons/l10n_mx_facturae/models/account_invoice.py:439
#, python-format
msgid "Product {p} must have at least one tax selected."
msgstr ""
#. module: l10n_mx_facturae
#: field:account.voucher,related_cfdi_ids:0
msgid "Refund invoices"
msgstr ""
#. module: l10n_mx_facturae
#: view:account.voucher:l10n_mx_facturae.account_voucher_view_form
msgid "Replace"
msgstr ""
#. module: l10n_mx_facturae
#: help:account.invoice,cfdi_adenda_id:0
msgid "Select addendum node to use on invoice."
......@@ -343,18 +386,18 @@ msgid "State of attachments"
msgstr ""
#. module: l10n_mx_facturae
#: help:res.partner,cfdi_adenda:0
msgid "This field allows adding a node or addendum to the invoice"
#: field:res.partner,supplier_number:0
msgid "Supplier number"
msgstr ""
#. module: l10n_mx_facturae
#: view:account.voucher:l10n_mx_facturae.account_voucher_view_search
msgid "UUID"
#: help:res.partner,cfdi_adenda:0
msgid "This field allows adding a node or addendum to the invoice"
msgstr ""
#. module: l10n_mx_facturae
#: view:account.voucher:l10n_mx_facturae.account_voucher_view_search
msgid "Unsigned"
msgid "UUID"
msgstr ""
#. module: l10n_mx_facturae
......@@ -367,6 +410,11 @@ msgstr ""
msgid "{'always_reload': True,'no_quick_create': True}"
msgstr ""
#. module: l10n_mx_facturae
#: view:account.voucher:l10n_mx_facturae.account_voucher_view_form
msgid "{'invisible': ['|', ('cfdi_state', '!=', False), ('state', '!=', 'cancel')]}"
msgstr ""
#. module: l10n_mx_facturae
#: view:account.invoice:l10n_mx_facturae.account_invoice_view_form_customer
msgid "{'search_default_customer':1, 'show_address': 1, 'default_is_company': 1}"
......
# -*- coding: utf-8 -*-
from openupgradelib import openupgrade as tools
from openerp import SUPERUSER_ID
def set_signed_status_vouchers(env):
"""Set all signed vouchers to the new signed status"""
tools.logged_query(
env.cr,
"""
UPDATE
account_voucher
SET
state = 'signed'
WHERE
cfdi_id IS NOT NULL AND
type = 'receipt' AND
state not in ('draft', 'cancel')
""",
)
@tools.migrate(use_env=True, uid=SUPERUSER_ID)
def migrate(env, installed_version):
set_signed_status_vouchers(env)
# -*- coding: utf-8 -*-
from openerp import api, models
from openerp import api, fields, models
from openerp.tools import float_round
......@@ -11,13 +11,60 @@ class AccountVoucher(models.Model):
'base.cfdi',
]
state = fields.Selection(
[
('draft', 'Draft'),
('cancel', 'Cancelled'),
('proforma', 'Pro-forma'),
('posted', 'Posted'),
('signed', 'Signed'),
],
)
@api.multi
def sign_voucher(self):
"""Create CFDI for selected vouchers"""
# Only vouchers to sign are the receipts
receipts = self.filtered(lambda r: r.type == 'receipt')
# Get only receipts that doesn't have a CFDI yet and create it
receipts.filtered(lambda r: not r.cfdi_id.exists()).create_cfdi()
for receipt in receipts.filtered(lambda r: not r.cfdi_id.exists()):
receipt.create_cfdi()
receipt.state = 'signed'
@api.multi
def cancel_voucher(self):
"""Cancel CFDI for selected vouchers"""
res = super(AccountVoucher, self).cancel_voucher()
self.cancel_cfdi()
return res
@api.multi
def _cancel_voucher(self):
"""General steps needed for cancel a voucher"""
self.ensure_one()
# Before cancel original voucher set relation to current related CFDI
self.write({
'cfdi_relation_type': self.env.ref('l10n_mx.cfdi_relation_type_04').id,
'related_cfdi_ids': [(6, None, [self.cfdi_id.id])],
})
# We also remove relation for attachments to avoid confusing situations
self.cfdi_id.file_xml_sign.res_id = None
self.cfdi_id.file_pdf.res_id = None
self.cancel_voucher()
@api.multi
def substitute_voucher(self):
"""Create new voucher for substitute this one"""
self._cancel_voucher()
# After cancel voucher we must re open it
self.action_cancel_draft()
@api.multi
def replace_cfdi(self):
"""Cancel voucher cfdi by replacing with 1 MXN voucher"""
self._cancel_voucher()
# Create a new cfdi to replace the one we cancelled
self.create_cfdi()
@api.multi
def currency_rate(self):
......
......@@ -30,11 +30,12 @@ class EmailTemplate(models.Model):
ir_model_data = self.pool.get('ir.model.data')
reference_ids = []
states = ['printable', 'sent_customer', 'done']
states = ['done']
data = {
'account': 'email_template_edi_invoice',
'portal_sale': 'email_template_edi_invoice',
'l10n_mx_ir_attachment_facturae': 'email_template_template_facturae_mx', # noqa
'l10n_mx_ir_attachment_facturae': 'email_template_template_facturae_mx',
'l10n_mx_facturae': 'account_voucher_cfdi_email_template',
}
# Look for possible templates for invoice and override
......@@ -52,15 +53,16 @@ class EmailTemplate(models.Model):
if template_id in reference_ids:
for res_id in res_ids:
model = values[res_id]['model']
iatt_ids = att_obj.search(
cr, uid,
[
('res_id', '=', res_id),
('type_attachment', '=', 'account.invoice'),
('type_attachment', '=', model),
],
context=context,
)
for iattach in att_obj.browse(cr, uid, iatt_ids, context=context): # noqa
for iattach in att_obj.browse(cr, uid, iatt_ids, context=context):
attachments = []
if iattach.state in states:
# Attach XML file to mesage
......
No preview for this file type
......@@ -5,7 +5,6 @@
<record id="report_templates_aeroo_account_voucher_cfdi_33" model="report.templates.aeroo">
<field name="name">Account Invoice XML CFDI 3.3</field>
<field name="model">account.voucher</field>
<field name="report_name">account.voucher.cfdi.33</field>
<field name="report_rml">l10n_mx_facturae/templates/account_voucher_33.txt</field>
</record>
<record id="ir_actions_report_xml_account_voucher_cfdi_33" model="ir.actions.report.xml">
......@@ -25,7 +24,6 @@
<record id="report_templates_aeroo_account_voucher_pdf_cfdi_33" model="report.templates.aeroo">
<field name="name">Default Voucher PDF</field>
<field name="model">account.voucher</field>
<field name="report_name">account.voucher.cfdi.33.pdf</field>
<field name="report_rml">l10n_mx_facturae/report/account_voucher.odt</field>
</record>
<record id="ir_actions_report_pdf_account_voucher_cfdi_33" model="ir.actions.report.xml">
......
......@@ -19,6 +19,13 @@
Total="0"
TipoDeComprobante="P"
LugarExpedicion="${ o.company_id.zip }" >
{% if o.related_cfdi_ids %}
<cfdi:CfdiRelacionados TipoRelacion="${ o.cfdi_relation_type.code }">
{% for cfdi in o.related_cfdi_ids %}
<cfdi:CfdiRelacionado UUID="${ cfdi.uuid }"/>
{% end %}
</cfdi:CfdiRelacionados>
{% end %}
<cfdi:Emisor
{% choose o.company_id.partner_id.vat_split %}
{% when False %}${ validationerror(_('Missing VAT number for company')) }{% end %}
......@@ -63,64 +70,73 @@
{% when '99' %}${ validationerror(_('Payment method must be different than 99.')) }{% end %}
{% otherwise %}FormaDePagoP="${ o.payment_type_id.code }"{% end %}
{% end %}
MonedaP="${ o.currency_id.name }"
{% if o.currency_id.name != 'MXN' %}
TipoCambioP="${ o.currency_rate() }"
{% end %}
Monto="${ '{0:.2f}'.format(o.currency_id.cfdi_round(o.amount)) }"
NumOperacion="${ o.reference or o.number }"
{% if o.partner_bank_id and o.partner_bank_id.is_valid_for_payment_form(o.payment_type_id.regex) %}
CtaOrdenante="$o.partner_bank_id.acc_number"
{% if o.partner_bank_id.bank.exists() %}
{% choose o.partner_bank_id.bank.full_name %}
{% when False %}{% end %}
{% otherwise %}NomBancoOrdExt="$o.partner_bank_id.bank.full_name"{% end %}
{% end %}
{% choose o.partner_bank_id.bank.vat_number %}
{% when False %}{% end %}
{% otherwise %}RfcEmisorCtaOrd="$o.partner_bank_id.bank.vat_number"{% end %}
{% end %}
{% choose o.state %}
{% when 'cancel' %}
MonedaP="MXN"
Monto="1.00"
>
{% end %}
{% end %}
{% if o.payment_type_id.code in ["02", "03", "04", "05", "28" "29"]%}
{% choose o.journal_id.res_partner_bank_id.acc_number %}
{% when None %}{% end %}
{% when False %}{% end %}
{% otherwise %}
CtaBeneficiario="$o.journal_id.res_partner_bank_id.acc_number"
{% if o.journal_id.res_partner_bank_id.bank.vat_number %}
RfcEmisorCtaBen="$o.journal_id.res_partner_bank_id.bank.vat_number"
{% otherwise %}
MonedaP="${ o.currency_id.name }"
{% if o.currency_id.name != 'MXN' %}
TipoCambioP="${ o.currency_rate() }"
{% end %}
Monto="${ '{0:.2f}'.format(o.currency_id.cfdi_round(o.amount)) }"
NumOperacion="${ o.reference or o.number }"
{% if o.partner_bank_id and o.partner_bank_id.is_valid_for_payment_form(o.payment_type_id.regex) %}
CtaOrdenante="$o.partner_bank_id.acc_number"
{% if o.partner_bank_id.bank.exists() %}
{% choose o.partner_bank_id.bank.full_name %}
{% when False %}{% end %}
{% otherwise %}NomBancoOrdExt="$o.partner_bank_id.bank.full_name"{% end %}
{% end %}
{% choose o.partner_bank_id.bank.vat_number %}
{% when False %}{% end %}
{% otherwise %}RfcEmisorCtaOrd="$o.partner_bank_id.bank.vat_number"{% end %}
{% end %}
{% end %}
{% end %}
{% end %}
{% end %}
>
{% for invoice in o.doctos_relacionados %}
<pago10:DoctoRelacionado
{% if invoice.journal_id.sequence_id.prefix %}
Serie="$invoice.serie"
{% end %}
Folio="$invoice.folio"
IdDocumento="${ invoice.cfdi_folio_fiscal }"
MonedaDR="${ invoice.currency_id.name }"
{% if invoice.currency_id != o.currency_id %}
{% choose invoice.currency_id.name %}
{% when 'MXN' %}TipoCambioDR="1"{% end %}
{% otherwise %}TipoCambioDR="${ o.tipocambiodr(invoice) }"{% end %}
{% if o.payment_type_id.code in ["02", "03", "04", "05", "28" "29"]%}
{% choose o.journal_id.res_partner_bank_id.acc_number %}
{% when None %}{% end %}
{% when False %}{% end %}
{% otherwise %}
CtaBeneficiario="$o.journal_id.res_partner_bank_id.acc_number"
{% if o.journal_id.res_partner_bank_id.bank.vat_number %}
RfcEmisorCtaBen="$o.journal_id.res_partner_bank_id.bank.vat_number"
{% end %}
{% end %}
{% end %}
{% end %}
{% end %}
{% choose invoice.payment_method_id.code %}
{% when False %}MetodoDePagoDR="PUE"{% end %}
{% otherwise %}
MetodoDePagoDR="$invoice.payment_method_id.code"
{% if invoice.payment_method_id.code == 'PPD' %}
NumParcialidad="${ o.numparcialidad(invoice) }"
ImpSaldoAnt="${ '{0:.2f}'.format(o.impsaldoant(invoice)) }"
ImpSaldoInsoluto="${ '{0:.2f}'.format(o.impsaldoant(invoice) - o.imppagado(invoice)) }"
>
{% for invoice in o.doctos_relacionados %}
<pago10:DoctoRelacionado
{% if invoice.journal_id.sequence_id.prefix %}
Serie="$invoice.serie"
{% end %}
Folio="$invoice.folio"
IdDocumento="${ invoice.cfdi_folio_fiscal }"
MonedaDR="${ invoice.currency_id.name }"
{% if invoice.currency_id != o.currency_id %}
{% choose invoice.currency_id.name %}
{% when 'MXN' %}TipoCambioDR="1"{% end %}
{% otherwise %}TipoCambioDR="${ o.tipocambiodr(invoice) }"{% end %}
{% end %}
{% end %}
{% choose invoice.payment_method_id.code %}
{% when False %}MetodoDePagoDR="PUE"{% end %}
{% otherwise %}
MetodoDePagoDR="$invoice.payment_method_id.code"
{% if invoice.payment_method_id.code == 'PPD' %}
NumParcialidad="${ o.numparcialidad(invoice) }"
ImpSaldoAnt="${ '{0:.2f}'.format(o.impsaldoant(invoice)) }"
ImpSaldoInsoluto="${ '{0:.2f}'.format(o.impsaldoant(invoice) - o.imppagado(invoice)) }"
{% end %}
{% end %}
{% end %}
ImpPagado="${ '{0:.2f}'.format(o.imppagado(invoice)) }" />
{% end %}
{% end %}
ImpPagado="${ '{0:.2f}'.format(o.imppagado(invoice)) }" />
{% end %}
</pago10:Pago>
</pago10:Pagos>
......
......@@ -26,7 +26,9 @@
<field name="inherit_id" ref="account_voucher.view_vendor_receipt_form"/>
<field name="arch" type="xml">
<button name="proforma_voucher" position="after">
<button name="sign_voucher" type="object" string="Sign" class="oe_highlight" attrs="{'invisible':['|',('state','!=','posted'),('cfdi_state','!=',False)]}"/>
<button name="sign_voucher" type="object" string="Sign" class="oe_highlight" states="posted"/>
<button name="substitute_voucher" type="object" string="Replace" states="signed"/>
<button name="replace_cfdi" type="object" string="Cancel" states="signed" confirm="Are you sure to cancel this voucher?"/>
</button>
<xpath expr="//sheet/h1" position="after">
<h4 attrs="{'invisible': [('number','=',False)]}" collspan="2">
......@@ -34,6 +36,11 @@
<field name="cfdi_state" invisible="1"/>
</h4>
</xpath>
<!-- Hide cancel to draft button when voucher have a related CFDI -->
<xpath expr="//button[@name='action_cancel_draft']" position="attributes">
<attribute name="states"></attribute>
<attribute name="attrs">{'invisible': ['|', ('cfdi_state', '!=', False), ('state', '!=', 'cancel')]}</attribute>
</xpath>
</field>
</record>
......@@ -46,9 +53,7 @@
<field name="cfdi_id" string="UUID" />
</field>
<filter string="Posted" position="after">
<separator/>
<filter string="Unsigned" domain="[('cfdi_id','=',False)]" help="Not Signed Vouchers"/>
<filter string="Signed" domain="[('cfdi_id','!=',False)]" help="Signed Vouchers"/>
<filter string="Signed" domain="[('state', '=', 'signed')]" help="Signed Vouchers"/>
</filter>
</field>
</record>
......