mirror of
https://gitlab.com/datalifeit/trytond-account_es_sii
synced 2023-12-14 06:13:02 +01:00
Add CSV field to aeat report
This commit is contained in:
parent
140414e540
commit
f35cc32424
25
aeat.py
25
aeat.py
|
@ -255,10 +255,13 @@ class SIIReport(Workflow, ModelSQL, ModelView):
|
|||
communication_state = fields.Selection( AEAT_COMMUNICATION_STATE,
|
||||
'Communication State', readonly=True)
|
||||
|
||||
csv = fields.Char(
|
||||
'CSV', readonly=True
|
||||
)
|
||||
|
||||
version = fields.Selection([
|
||||
('0.7', '0.7'),
|
||||
], 'Version', required=True, states={
|
||||
'readonly': ~Eval('state').in_(['draft', 'confirmed']),
|
||||
}, depends=['state'])
|
||||
|
||||
lines = fields.One2Many('aeat.sii.report.lines', 'report',
|
||||
|
@ -372,14 +375,18 @@ class SIIReport(Workflow, ModelSQL, ModelView):
|
|||
# TODO: assert response lines order matches report line order
|
||||
for (report_line, response_line) in zip(
|
||||
report.lines, res.RespuestaLinea):
|
||||
report_line.state = response_line.EstadoRegistro
|
||||
report_line.communication_code = \
|
||||
response_line.CodigoErrorRegistro
|
||||
report_line.communication_msg = \
|
||||
response_line.DescripcionErrorRegistro
|
||||
report_line.save()
|
||||
report.communication_state = res.EstadoEnvio
|
||||
report.save()
|
||||
report_line.write([report_line], {
|
||||
'state':
|
||||
response_line.EstadoRegistro,
|
||||
'communication_code':
|
||||
response_line.CodigoErrorRegistro,
|
||||
'communication_msg':
|
||||
response_line.DescripcionErrorRegistro,
|
||||
})
|
||||
report.write([report], {
|
||||
'communication_state': res.EstadoEnvio,
|
||||
'csv': res.CSV,
|
||||
})
|
||||
_logger.debug('Done sending reports to AEAT SII')
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
<field name="state"/>
|
||||
<label name="communication_state"/>
|
||||
<field name="communication_state"/>
|
||||
|
||||
<label name="csv"/>
|
||||
<field name="csv"/>
|
||||
<group id="buttons" colspan="2">
|
||||
<button name="draft" string="Draft"/>
|
||||
<button name="confirm" string="Confirm"/>
|
||||
|
|
Loading…
Reference in a new issue