Skip to content

Commit

Permalink
fixes #176 fixes #175. tilde de anulacion de FCE en el form del compr…
Browse files Browse the repository at this point in the history
…obante. Error fecha de pago en MiPyme.

Se agrega el tilde en el view_form de invoice para que se pueda crear
una nota de credito de MiPyme manualmente o que la nota de credito fuera
generada por una devolución de venta.

Ademas se corrige el error 10175, si realizamos una nota de crédito de
servicios de un tipo comprobante FCE pero que no esta anulada por el
cliente, entonces no se le debe informar el campo fecha de pago.
  • Loading branch information
lukio committed Jan 3, 2020
1 parent b215295 commit 10e2702
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
19 changes: 14 additions & 5 deletions invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ class Invoice:
'numbers.type': 'cbu',
},
depends=_DEPENDS + ['company_party'])
pyafipws_anulacion = fields.Boolean(u'FCE Anulación', states=_STATES,
pyafipws_anulacion = fields.Boolean(u'FCE MiPyme anulación', states=_STATES,
depends=_DEPENDS)
pyafipws_cmp_asoc = fields.Many2Many('account.invoice-cmp.asoc',
'invoice', 'cmp_asoc', 'Cmp Asoc', states=_STATES,
Expand Down Expand Up @@ -783,6 +783,8 @@ def _credit(self):

credit.reference = '%s' % self.number
credit.pyafipws_cmp_asoc = [self.id]
credit.pyafipws_anulacion = Transaction().context.get(
'pyafipws_anulacion', False)
return credit

@classmethod
Expand Down Expand Up @@ -1208,7 +1210,8 @@ def strip_accents(text):
fecha_venc_pago = fecha_serv_desde = fecha_serv_hasta = None
fecha_pago = None
if (int(concepto) != 1 or
self.invoice_type.invoice_type in ('201', '206', '211')):
self.invoice_type.invoice_type in ('201', '202', '203', '206',
'207', '208', '211', '212', '213')):
payments = []
if self.payment_term:
payments = self.payment_term.compute(self.total_amount,
Expand All @@ -1226,6 +1229,11 @@ def strip_accents(text):
if service == 'wsfex' and self.invoice_type.invoice_type == '19':
fecha_pago = fecha_venc_pago

if self.invoice_type.invoice_type in ('202', '203', '207',
'208', '212', '213'):
if not self.pyafipws_anulacion:
fecha_venc_pago = None

if int(concepto) != 1:
if self.pyafipws_billing_start_date:
fecha_serv_desde = self.pyafipws_billing_start_date.strftime(
Expand Down Expand Up @@ -1386,7 +1394,7 @@ def strip_accents(text):
# ws.AgregarOpcional(2102, "tryton") # alias del cbu
if self.invoice_type.invoice_type in ('202', '203', '207',
'208', '212', '213'):
if Transaction().context.get('pyafipws_anulacion', False):
if self.pyafipws_anulacion:
ws.AgregarOpcional(22, 'S')
else:
ws.AgregarOpcional(22, 'N')
Expand Down Expand Up @@ -1819,12 +1827,13 @@ def _get_pyafipws_barcode_img(cls, Invoice, invoice):
output.close()
return image


class CreditInvoiceStart:
__name__ = 'account.invoice.credit.start'
__metaclass__ = PoolMeta

from_fce = fields.Boolean('From FCE', readonly=True)
pyafipws_anulacion = fields.Boolean(u'Anulación',
pyafipws_anulacion = fields.Boolean(u'FCE MiPyme anulación',
states={
'invisible': ~Bool(Eval('from_fce')),
},
Expand All @@ -1836,7 +1845,7 @@ def view_attributes(cls):
states = {'invisible': ~Bool(Eval('from_fce'))}
return [
('/form//image[@name="tryton-dialog-warning"]', 'states', states),
('/form//label[@id="credit_contract"]', 'states', states),
('/form//label[@id="credit_fce"]', 'states', states),
]


Expand Down
19 changes: 19 additions & 0 deletions view/invoice_form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
<data>
<xpath expr="/form/notebook/page[@id='payment']" position="after">
<page string="Factura Electronica Argentina" id="electronic_invoice">
<group col="-1" colspan="2" id="checkboxes">
<label name="pyafipws_anulacion"/>
<field name="pyafipws_anulacion" xexpand="0" width="25"/>
<!-- Add here some checkboxes ! -->
</group>
<field name="pyafipws_cmp_asoc" colspan="4"/>
<label name="pyafipws_concept"/>
<field name="pyafipws_concept"/>
Expand Down Expand Up @@ -65,7 +70,21 @@
<xpath
expr="/form/notebook/page[@id='info']/field[@name='cancel_move']"
position="after">
<newline />
<label string="Facturación Argentina"
id="invoice_ar" colspan="4" yalign="0.0" xalign="0.0"
xexpand="1"/>
<label name="currency_rate"/>
<field name="currency_rate"/>
<label name="pyafipws_imp_neto"/>
<field name="pyafipws_imp_neto"/>
<label name="pyafipws_imp_tot_conc"/>
<field name="pyafipws_imp_tot_conc"/>
<label name="pyafipws_imp_op_ex"/>
<field name="pyafipws_imp_op_ex"/>
<label name="pyafipws_imp_iva"/>
<field name="pyafipws_imp_iva"/>
<label name="pyafipws_imp_trib"/>
<field name="pyafipws_imp_trib"/>
</xpath>
</data>

0 comments on commit 10e2702

Please sign in to comment.