Skip to content

[17.0][MIG] bc3_importer: Migration to 17.0#40

Open
AlvaroRM11 wants to merge 11 commits intoOCA:17.0from
BinhexTeam:17.0-mig-bc3_importer
Open

[17.0][MIG] bc3_importer: Migration to 17.0#40
AlvaroRM11 wants to merge 11 commits intoOCA:17.0from
BinhexTeam:17.0-mig-bc3_importer

Conversation

@AlvaroRM11
Copy link

@rrebollo
Copy link

#34

Copy link

@rrebollo rrebollo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: Great work! The code looks good to me (LGTM). Thank you for your contribution! I've provided a few suggestions for your consideration—feel free to address them as you see fit.

The BC3 import process is quite complex and heavy, given the depth of parsing required for the BC3 format. In fact, it could be worth considering creating a dedicated Python library to encapsulate at least the parsing workflow. The addon could then leverage this library through a well-defined API, keeping the addon itself cleaner and more maintainable.

In addition, it would be valuable to:

  • Add more tests for the addon to ensure reliability.
  • Comment and explain the numerous methods and procedures within the addon.

The goal is to improve maintainability and sustainability, since even just reviewing the current addon is a complex and time-consuming task.

Comment on lines +26 to +27
if len(list(duplicates(register_name))) > 0:
raise ValidationError(_("Register name should unique"))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for the duplicates function — I didn’t know about it! I’m intrigued though: wouldn’t a unique _sql_constraints on the register side (by version_id, name) achieve the same? I’m guessing you’re trying to avoid having the same register linked multiple times to a version.

):
temp_line["price_unit"] = sale_order_line.price_unit
if "name" in temp_line and sale_order_line.name:
temp_line["name"] = sale_order_line.name + "-" + temp_line["name"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
temp_line["name"] = sale_order_line.name + "-" + temp_line["name"]
temp_line["name"] = f"{{sale_order_line.name}}-{{temp_line['name']}}"

line["price_unit"] = sale_order_line.price_unit
if "name" in line and sale_order_line.name:
if sale_order_line.name not in line["name"]:
line["name"] = sale_order_line.name + "- " + line["name"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
line["name"] = sale_order_line.name + "- " + line["name"]
line["name"] = f"{{sale_order_line.name}}-{{line['name']}}"

elif line_type == 0 and "#" in parsed_line[0][0]:
line["display_type"] = "line_section"
i -= 1
line["name"] = "[" + line["bc3_code"] + "] " + product_name

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
line["name"] = "[" + line["bc3_code"] + "] " + product_name
line["name"] = f"[{{line['bc3_code']}}] {{product_name}}"

@@ -0,0 +1 @@
Importer of quotations in bc3 format.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Importer of quotations in bc3 format.
## BC3 Quotation Importer
This addon provides the ability to **import quotations in BC3 format** directly into Odoo, streamlining the workflow for construction projects.
### About BC3
BC3 is a **standardized file format** widely used in the Spanish construction industry to exchange data between budgeting, estimation, and project-management software.
- **Extension:** `.bc3`
- **Structure:** Text-based, following the **FIEBDC-3 specification**
- **Purpose:** Encodes **bills of quantities**, **unit prices**, and **project cost breakdowns**
- **Use Case:** Facilitates importing/exporting **budgets and quotations** between tools like Presto, Arquímedes, Menfis, and now Odoo
With this addon, BC3 files can be directly mapped into **Odoo quotations**, reducing manual entry and ensuring data consistency across systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants