Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement nested attributes for FacturX class #7

Closed
m3nu opened this issue May 15, 2018 · 3 comments
Closed

Implement nested attributes for FacturX class #7

m3nu opened this issue May 15, 2018 · 3 comments
Assignees

Comments

@m3nu
Copy link
Collaborator

m3nu commented May 15, 2018

Some invoice attributes, like buyer and seller would benefit from a nested structures. Like seller->country. I suggest to user a dot as separator to add "fake" nesting. I didn't find a good way to nest it natively without too many changes.

Example: factx['seller.country']

Steps to implement:

  • Find xpaths for missing nested attributes and add to fields.yml
  • Any changes needed to use nested attributes.
@duskybomb
Copy link

How I am implementing it:

if '.' in field_name:
    field_name = field_name.replace('.', '_')

Then in fields.yml

seller_name:  # for seller.name
    _path:
    ...

I have made nested attributes for seller.name, seller.country and similarly for buyer. What else should I add?

@duskybomb
Copy link

@m3nu should I add more fields in the similar manner as mentioned above, or should this be done differently?

@m3nu
Copy link
Collaborator Author

m3nu commented Jul 3, 2018

We could simply call our nested fields seller_name, seller_country, etc. So use the underscore directly instead of the dot. This would save the trouble of replacing it.

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

No branches or pull requests

2 participants