-
-
Notifications
You must be signed in to change notification settings - Fork 290
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
[12.0] Migrate base_business_document_import* #85
Conversation
Hey @alexis-via, thank you for your Pull Request. It looks like some users haven't signed our Contributor License Agreement, yet.
Appreciation of efforts, |
base_business_document_import/models/business_document_import.py
Outdated
Show resolved
Hide resolved
base_business_document_import/models/business_document_import.py
Outdated
Show resolved
Hide resolved
'country_id': self.env.ref('base.fr').id, | ||
'type': 'invoice', | ||
}) | ||
agrolait = self.env.ref('base.res_partner_2') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to have variable agrolait
renamed (eg.: res_partner_2
).
CI is red because of unavailable dependency on base_vat_sanitized |
I added back the oca_dependencies.txt file. @alexis-via rebasing your PR should get a greener build. |
…voice dict, cleaner organisation) Code refactoring: move code in base_business_document_import, factorise code for tax matching (it was duplicated in UBL and ZUGFeRD) Now support PDF with embedded UBL XML file Enable unittests on account_invoice_import_ubl More absolute xpath in account_invoice_import_ubl instead of relative xpath WARNING: these are big changes, I may have broken a few details
Adapt module account_invoice_import_ubl to use the new base_ubl module Small fixes
Better generation of address block in UBL (make it coherent with the datamodel of Odoo) Add generation of several UBL blocks: language, delivery, payment terms, customer party, spplier party Add parsing of zip in UBL party (will be used in the future for delivery partner match)
Use country code and state code to match partners UBL: Add delivery terms and line item UBL XML block generation UBL: add parsing of delivery block
Add unitests in base_business_document_import Small code enhancements/simplifications
Code cleanup/minor changes
Rename key 'quantity' to 'qty' in all parsing dicts['lines'] Add common methods compare_lines() and post_create_or_update() Make sure price_unit is always untaxed in UBL XML files
Add support for partner bank matching on invoice update (before, it was only supported on invoice creation)
[FIX] LINT Use try/except when importing external libs Remove self.ensure_one() that has nothing to do in an api.model method
Rename __openerp__.py to __manifest__.py and set installable to False
Add match for accounts and journals
Improve match for journals and accounts
Also port all the modules that generate the XML documents: account_invoice_ubl, account_invoice_zugferd, purchase_order_ubl and sale_order_ubl
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
…import_phone for consistency Add connector-telephony in oca_dependencies.txt
Add support for partner bank matching on invoice update (before, it was only supported on invoice creation)
[FIX] LINT Use try/except when importing external libs Remove self.ensure_one() that has nothing to do in an api.model method
Rename __openerp__.py to __manifest__.py and set installable to False
Also port all the modules that generate the XML documents: account_invoice_ubl, account_invoice_zugferd, purchase_order_ubl and sale_order_ubl
When using auto invoice download, the cron is executed by default by admin user, which is above record rules: only handle download config in the company of the user and improve matching by always selecting obj in the same company (or company = False)
… in multi-company environnement Fix my previous commit on sequence field on invoice import config (caused a crash when creating a new record) Usability improvements on download config
Migrate base_business_document_import_phone from v10 to v12 Convert readme to the new format
1c1f4c3
to
d8ae007
Compare
Thanks Alexandre. I made a rebased, let's see what Travis will say now... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexis-via
Please accept the proposed changes. One test of #101 is failing and the proposed changes fix the error.
The key 'phone' is used by the module | ||
base_phone_business_document_import | ||
""" | ||
rpo = self.env['res.partner'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rpo = self.env['res.partner'] | |
partner = self.env['res.partner'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me a partner is an instance of the model 'res.partner' not the class represented by self.env['res.partner']
rpo is better because it's a shorcut. Just my opinion
country = False | ||
if partner_dict.get('country_code'): | ||
countries = self.env['res.country'].search([ | ||
('code', '=', partner_dict['country_code'])]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not limit=1, if you only needs one record
if country and partner_dict.get('state_code'): | ||
states = self.env['res.country.state'].search([ | ||
('code', '=', partner_dict['state_code']), | ||
('country_id', '=', country.id)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
limit=1
partners = rpo.search( | ||
domain + [ | ||
('parent_id', '=', False), | ||
('sanitized_vat', '=', vat)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
limit=1
('sanitized_vat', '=', vat)]) | ||
if partners: | ||
return partners[0] | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The else
sentence is not necessary here, because the if
return if its True
domain + [('email', '=ilike', partner_dict['email'])]) | ||
if partners: | ||
return partners[0] | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same here
if not partners and website_domain: | ||
partners = rpo.search( | ||
domain + | ||
[('email', '=ilike', '%@' + website_domain)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
limit=1
return partners[0] | ||
if partner_dict.get('ref'): | ||
partners = rpo.search( | ||
domain + [('ref', '=', partner_dict['ref'])]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
limit=1
return partners[0] | ||
if partner_dict.get('name'): | ||
partners = rpo.search( | ||
domain + [('name', '=ilike', partner_dict['name'])]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
limit=1
The partner argument is a bit special: it is a fallback in case | ||
shipping_dict['partner'] = {} | ||
""" | ||
rpo = self.env['res.partner'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rpo = self.env['res.partner'] | |
partner = self.env['res.partner'] |
@alexis-via are you going to finish this? |
@pedrobaeza yes, sure. Now that intrastat is finished for v12, I can come back to edi. Travis is green. I'll have a look at the last remarks in the coming days. |
Thanks |
Improve code for shipping addresse matching Improve tests
Travis is red |
Travis errors fixed with a2671fa, this branch should be rebased. |
Migrate base_business_document_import from v11 to v12
Migrate base_business_document_import_phone from v10 to v12
Convert README to new format