Skip to content

Commit

Permalink
[REF] Adapt code to alternative version
Browse files Browse the repository at this point in the history
  • Loading branch information
mileo committed Apr 3, 2024
1 parent 6fcbb4b commit 76381c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions l10n_br_nfe_stock/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
],
"data": [
# Views
"views/document_view.xml",
"views/picking_view.xml",
"views/purchase_view.xml",
# "views/document_view.xml",
# "views/picking_view.xml",
# "views/purchase_view.xml",
# Wizards
"wizards/import_document.xml",
],
Expand Down
13 changes: 6 additions & 7 deletions l10n_br_nfe_stock/wizards/import_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class NfeImport(models.TransientModel):
model_to_link = fields.Selection(
string="Link with",
selection=[("picking", "Picking"), ("purchase", "Purchase Order")],
required=True,
)

link_type = fields.Selection(
Expand Down Expand Up @@ -181,10 +180,10 @@ def _get_pickings_from_xml_supplier(self):
]
)

def _create_edoc_from_xml(self):
def _create_edoc_from_file(self):
# HACK: Next line should be removed once 'out' documents partner_id is fixed
self._set_fields_by_xml_data()
edoc = super(NfeImport, self)._create_edoc_from_xml()
# self._set_fields_by_xml_data()
binding, edoc = super(NfeImport, self)._create_edoc_from_file()

if self.model_to_link == "purchase":
if self.link_type == "create":
Expand All @@ -211,7 +210,7 @@ def _create_edoc_from_xml(self):
if edoc.move_ids:
self._add_invoice_to_picking(edoc)

return edoc
return binding, edoc

def _create_purchase_order(self, document):
purchase = self.env["purchase.order"].create(
Expand All @@ -221,7 +220,7 @@ def _create_purchase_order(self, document):
"fiscal_operation_id": self._get_purchase_fiscal_operation_id(),
"date_order": datetime.now(),
"origin_document_id": document.id,
"imported": True,
"imported_document": True,
}
)

Expand Down Expand Up @@ -262,7 +261,7 @@ def _create_picking(self, document):
).default_location_dest_id.id,
"location_id": self.env.ref("stock.stock_location_suppliers").id,
"origin_document_id": document.id,
"imported": True,
"imported_document": True,
}
)

Expand Down
2 changes: 1 addition & 1 deletion l10n_br_nfe_stock/wizards/import_document.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
attrs="{
'invisible': [
'|',
('xml', '=', False),
('file', '=', False),
('document_id', '!=', False),
]
}"
Expand Down

0 comments on commit 76381c4

Please sign in to comment.