Skip to content

Commit

Permalink
[FIX] l10n_br_mdfe: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Dec 10, 2024
1 parent 433ce1a commit 91bf909
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 26 deletions.
3 changes: 2 additions & 1 deletion l10n_br_mdfe/models/modal_rodoviario.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class MDFeModalRodoviario(spec_models.StackedModel):
_mdfe30_binding_module = "nfelib.mdfe.bindings.v3_0.mdfe_modal_rodoviario_v3_00"
_mdfe30_stacking_mixin = "mdfe.30.rodo"
# all m2o at this level will be stacked even if not required:
_mdfe30_stacking_force_paths = ["rodo.infANTT", "rodo.infANTT.ValePed"]
_mdfe30_stacking_force_paths = ["rodo.infANTT", "rodo.infANTT.InfContratante"]
_mdfe30_stacking_skip_paths = ("mdfe30_valePed",)

document_id = fields.Many2one(comodel_name="l10n_br_fiscal.document")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,8 @@
<infAdFisco>Documento emitido por: Marc Demo</infAdFisco>
</infAdic>
</infMDFe>
<infMDFeSupl>
<qrCodMDFe
>https://dfe-portal.svrs.rs.gov.br/mdfe/qrCode?chMDFe=35230905472475000102580200000602011208018449&amp;tpAmb=2</qrCodMDFe>
</infMDFeSupl>
</MDFe>
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@
<CIOT>123456789101</CIOT>
<CPF>99999999999</CPF>
</infCIOT>
<valePed>
<disp>
<CNPJForn>99999999999999</CNPJForn>
<CNPJPg>99999999999999</CNPJPg>
<nCompra>1234</nCompra>
<vValePed>5.00</vValePed>
<tpValePed>01</tpValePed>
</disp>
<categCombVeic>02</categCombVeic>
</valePed>
<infPag>
<xNome>Intel do Brasil</xNome>
<CNPJ>86144802000190</CNPJ>
Expand Down Expand Up @@ -124,4 +114,8 @@
<infAdFisco>Documento emitido por: Marc Demo</infAdFisco>
</infAdic>
</infMDFe>
<infMDFeSupl>
<qrCodMDFe
>https://dfe-portal.svrs.rs.gov.br/mdfe/qrCode?chMDFe=35230905472475000102580200000602071611554500&amp;tpAmb=2</qrCodMDFe>
</infMDFeSupl>
</MDFe>
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@
<infAdFisco>Documento emitido por: Marc Demo</infAdFisco>
</infAdic>
</infMDFe>
<infMDFeSupl>
<qrCodMDFe
>https://dfe-portal.svrs.rs.gov.br/mdfe/qrCode?chMDFe=35230905472475000102580200000602081550195716&amp;tpAmb=2</qrCodMDFe>
</infMDFeSupl>
</MDFe>
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,8 @@
<infAdFisco>Documento emitido por: Marc Demo</infAdFisco>
</infAdic>
</infMDFe>
<infMDFeSupl>
<qrCodMDFe
>https://dfe-portal.svrs.rs.gov.br/mdfe/qrCode?chMDFe=35231005472475000102580200000602161434590525&amp;tpAmb=2</qrCodMDFe>
</infMDFeSupl>
</MDFe>
29 changes: 16 additions & 13 deletions l10n_br_mdfe/tests/test_mdfe_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,22 @@ def prepare_modal_rodoviario_data(self, mdfe):
},
),
]
mdfe.mdfe30_disp = [
(
0,
0,
{
"mdfe30_CNPJForn": "99999999999999",
"mdfe30_CNPJPg": "99999999999999",
"mdfe30_nCompra": "1234",
"mdfe30_vValePed": 5,
"mdfe30_tpValePed": "01",
},
),
]
# TODO: no momento foi desativado a tag ValePed por
# ela mesmo vazia aparecer no xml

# mdfe.mdfe30_disp = [
# (
# 0,
# 0,
# {
# "mdfe30_CNPJForn": "99999999999999",
# "mdfe30_CNPJPg": "99999999999999",
# "mdfe30_nCompra": "1234",
# "mdfe30_vValePed": 5,
# "mdfe30_tpValePed": "01",
# },
# ),
# ]
mdfe.mdfe30_infPag = [
(
0,
Expand Down
17 changes: 15 additions & 2 deletions l10n_br_mdfe/views/document.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
>{'invisible': [('document_type', 'in', ['58'])]}</attribute>
</xpath>

<xpath expr="//field[@name='fiscal_operation_id']" position="after">
<xpath expr="//field[@name='issuer']" position="after">
<field
name="mdfe_emit_type"
attrs="{'invisible': [('document_type', 'not in', ['58'])]}"
Expand Down Expand Up @@ -116,6 +116,20 @@
attrs="{'invisible': [('document_type', 'not in', ['58'])]}"
/>
</xpath>

<xpath expr="//page[@name='others']" position="inside">
<separator
colspan="4"
string="Authorized to Download XML"
attrs="{'invisible': [('document_type', 'not in', ['58'])]}"
/>
<field
name="mdfe30_autXML"
widget="many2many"
attrs="{'invisible': [('document_type', 'not in', ['58'])]}"
/>
</xpath>

</field>
</record>

Expand Down Expand Up @@ -178,7 +192,6 @@
>
<group>
<field name="mdfe_modal" widget="radio" />
<field name="mdfe_transp_type" />
</group>

<group
Expand Down

0 comments on commit 91bf909

Please sign in to comment.