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

Comments

Projects
None yet
2 participants
@m3nu
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.

@m3nu m3nu added the type:feature label May 15, 2018

@duskybomb

This comment has been minimized.

Show comment
Hide comment
@duskybomb

duskybomb Jun 9, 2018

Collaborator

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?

Collaborator

duskybomb commented Jun 9, 2018

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

This comment has been minimized.

Show comment
Hide comment
@duskybomb

duskybomb Jun 29, 2018

Collaborator

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

Collaborator

duskybomb commented Jun 29, 2018

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

@m3nu

This comment has been minimized.

Show comment
Hide comment
@m3nu

m3nu Jul 3, 2018

Collaborator

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.

Collaborator

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