Comments (7)
Same for cbc:RegistrationName
(which is not necesarily identical to res.partner.name
) - res.partner.name
can be used for well known commercial insignia (eg. brand).
from edi.
It happens so that both have the same signature:
- http://www.datypic.com/sc/ubl21/t-cbc_CompanyIDType.html
- http://www.datypic.com/sc/ubl21/t-cbc_IDType.html
Therefore the existing localization machinery can be reused:
@api.model
def _ubl_get_party_identification(self, commercial_partner):
'''This method is designed to be inherited in localisation modules
Should return a dict with key=SchemeName, value=Identifier'''
return {}
@api.model
def _ubl_add_party_identification(
self, commercial_partner, parent_node, ns, version='2.1'):
id_dict = self._ubl_get_party_identification(commercial_partner)
if id_dict:
party_identification = etree.SubElement(
parent_node, ns['cac'] + 'PartyIdentification')
for scheme_name, party_id_text in id_dict.items():
party_identification_id = etree.SubElement(
party_identification, ns['cbc'] + 'ID',
schemeName=scheme_name)
party_identification_id.text = party_id_text
return
EDIT: This localization machinery must support all available attributes.
from edi.
Proposal:
@api.model
def _ubl_get_party_identification(self, commercial_partner):
'''This method is designed to be inherited in localisation modules
Should return a list of dict reflecting the json xml notation of
- either cbe:IDType
- or: cbc:CompanyIDType
which both have identical signatures.
Example:
{
"IdentifierContent":"DK12345",
"IdentificationSchemeIdentifier":"DKVAT",
"IdentificationSchemeNameText":"DKVAT",
"IdentificationSchemeAgencyIdentifier":"ZZZ",
"IdentificationSchemeAgencyNameText":"ZZZ",
"IdentificationSchemeVersionIdentifier":"ZZZ",
"IdentificationSchemeDataUniformResourceIdentifier":"ZZZ",
"IdentificationSchemeUniformResourceIdentifier":"ZZZ",
}
Full spec: http://docs.oasis-open.org/ubl/UBL-2.1-JSON/v1.0/cnd02/
/json-schema/common/CCTS_CCT_SchemaModule-2.1.json
'''
return []
@api.model
def _ubl_add_id_type(self, id_dict, node_name, parent_node, ns, version='2.1'):
if "IdentifierContent" not in id_dict:
raise UserError(_(
"No 'IdentiferContent' provided for '%s'")
% node_name)
json_to_xml_attrs = {
"IdentificationSchemeIdentifier": "schemeID",
"IdentificationSchemeNameText": "schemeName",
"IdentificationSchemeAgencyIdentifier": "schemeAgencyID",
"IdentificationSchemeAgencyNameText": "schemeAgencyName",
"IdentificationSchemeVersionIdentifier": "schemeVersionID",
"IdentificationSchemeDataUniformResourceIdentifier": "schemeDataURI",
"IdentificationSchemeUniformResourceIdentifier": "schemeURI",
}
iid = etree.SubElement(
parent_node,
ns['cbc'] + node_name,
**dict(
(json_to_xml_attrs[key], value)
for (key, value) in id_dict.items()
if key in json_to_xml_attrs
)
)
iid.text = id_dict['IdentifierContent']
@api.model
def _ubl_add_party_identification(
self, commercial_partner, parent_node, ns, version='2.1'):
id_dicts = self._ubl_get_party_identification(commercial_partner)
if id_dicts:
party_identification = etree.SubElement(
parent_node, ns['cac'] + 'PartyIdentification')
for id_dict in id_dicts:
self._ubl_add_id_type(
id_dict, 'ID', party_identification, ns, version=version)
return
Mimicks the official JSON Alternative Representation V1.0 as python dict.
A little verbose, but well documented, standard conformant and sufficiently expressive.
from edi.
/cc @Deiber
from edi.
@blaggacao I get the idea behind your proposal #126 (comment) and it looks good to me.
from edi.
I went a little further and made "dict parsers" for UBL IdentifierType
TextType
and CodeType
. THis way we can construe more complex TaxScheme
instances. Once I've get a patch working for my case, I'll share it.
from edi.
There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.
from edi.
Related Issues (20)
- Migration to version 16.0 HOT 12
- Documentation required HOT 8
- Question regarding OVH authentication HOT 4
- [14.0] Can't find "endpoint" module required for edi_endpoint_oca HOT 1
- edi_oca: exchange dependency HOT 3
- [14.0] edi_storage_oca with SFTP backend ACK aren't synchronized HOT 3
- 14.0 edi_oca synchronize ACK state with parent state when parent isn't processed by itself HOT 5
- Proposed changes for account_invoice_import v16 HOT 3
- Proposal for sale_order_import_csv: migration and import profiles HOT 1
- account_invoice_facturx: Mandatory country issue HOT 6
- Build red on 14.0 and 15.0 branch HOT 1
- pdf_helper.: PDF file parsing failed: '/Names' HOT 4
- account_invoice_facturx: Invoice generated are not valid facturx
- PyPDF2 usage problem in pdf_helper 16.0 HOT 2
- Migration to version 17.0 HOT 5
- [14.0] account_invoice_ubl_peppol tests broken
- Invalid XML invoice according to Mustang app if invoice and company have different currency HOT 1
- product.uom missing for Module account_invoice_import_facturx HOT 1
- Use import simple pdf module with email attachments HOT 1
- [15.0] edi_oca: support multicompany with edi.exchange.record HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edi.