Skip to content

Commit

Permalink
[FIX] l10n_mx_res_partner_csf
Browse files Browse the repository at this point in the history
  • Loading branch information
max3903 committed Jan 1, 2025
1 parent 1e9ab4d commit da19c84
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 27 deletions.
13 changes: 12 additions & 1 deletion l10n_mx_res_partner_csf/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Contact CSF for Mexico
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e89b7d63cfe2572d8c2deae516c3bf53dd7acd0a59941544170cb6b49c66a5d3
!! source digest: sha256:ffbec86cbe29b0dc39fdae5051787fd924b2f5688178d64d881f83b539695764
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -37,6 +37,17 @@ information of a partner.
.. contents::
:local:

Installation
============

This module requires the unaccent extension of PostgreSQL:

.. code:: sql
CREATE EXTENSION "unaccent";
and ``unaccent=True`` in Odoo configuration file.

Usage
=====

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This module requires the unaccent extension of PostgreSQL:

.. code-block:: sql
create extension "unaccent" ;
```sql
CREATE EXTENSION "unaccent";
```

and `unaccent=True` in Odoo configuration file.
51 changes: 31 additions & 20 deletions l10n_mx_res_partner_csf/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Contact CSF for Mexico</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e89b7d63cfe2572d8c2deae516c3bf53dd7acd0a59941544170cb6b49c66a5d3
!! source digest: sha256:ffbec86cbe29b0dc39fdae5051787fd924b2f5688178d64d881f83b539695764
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-mexico/tree/17.0/l10n_mx_res_partner_csf"><img alt="OCA/l10n-mexico" src="https://img.shields.io/badge/github-OCA%2Fl10n--mexico-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-mexico-17-0/l10n-mexico-17-0-l10n_mx_res_partner_csf"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-mexico&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to upload the proof of tax situation (Constancia
Expand All @@ -376,19 +376,28 @@ <h1 class="title">Contact CSF for Mexico</h1>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-6">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
<li><a class="reference internal" href="#installation" id="toc-entry-1">Installation</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-7">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-8">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="installation">
<h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
<p>This module requires the unaccent extension of PostgreSQL:</p>
<pre class="code sql literal-block">
<span class="k">CREATE</span><span class="w"> </span><span class="n">EXTENSION</span><span class="w"> </span><span class="ss">&quot;unaccent&quot;</span><span class="p">;</span>
</pre>
<p>and <tt class="docutils literal">unaccent=True</tt> in Odoo configuration file.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<ul class="simple">
<li>Go to Contacts</li>
<li>Click on “Create”</li>
Expand All @@ -397,23 +406,23 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-mexico/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/l10n-mexico/issues/new?body=module:%20l10n_mx_res_partner_csf%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple">
<li>Open Source Integrators</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.opensourceintegrators.com">Open Source Integrators</a>:<ul>
<li>Maxime Chambreuil &lt;<a class="reference external" href="mailto:mchambreuil&#64;opensourceintegrators.com">mchambreuil&#64;opensourceintegrators.com</a>&gt;</li>
Expand All @@ -424,15 +433,17 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-6">Other credits</a></h2>
<h2><a class="toc-backref" href="#toc-entry-7">Other credits</a></h2>
<ul class="simple">
<li>Open Source Integrators</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
Expand Down
7 changes: 4 additions & 3 deletions l10n_mx_res_partner_csf/wizard/import_csf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

class ImportCSF(models.TransientModel):
_name = "import.csf"
_description = "Import CSF wizard"

file = fields.Binary(required=True, attachment=True)
file_name = fields.Char()
Expand Down Expand Up @@ -47,7 +48,7 @@ def upload_csf(self):
def prepare_res_partner_values(self, text):
state_obj = self.env["res.country.state"]
split_data = text.split("\n")
vat = name = zip = city = street = street2 = state = ""
vat = name = zipcode = city = street = street2 = state = ""
for index, line in enumerate(split_data):
if "CÉDULA DE IDENTIFICACIÓN FISCAL" in line:
vat += split_data[index + 2].strip()
Expand All @@ -58,7 +59,7 @@ def prepare_res_partner_values(self, text):
elif split_data[index + 3].isupper():
name += " " + split_data[index + 3].strip()
elif "Código Postal" in line:
zip += line.split(":")[-1].strip()
zipcode += line.split(":")[-1].strip()
elif "Tipo de Vialidad" in line:
street += line.split("Tipo de Vialidad:")[-1].strip() + " "
elif "Nombre de Vialidad" in line:
Expand All @@ -82,7 +83,7 @@ def prepare_res_partner_values(self, text):
return {
"vat": vat,
"name": name,
"zip": zip,
"zip": zipcode,
"city": city,
"street": street,
"street2": street2,
Expand Down

0 comments on commit da19c84

Please sign in to comment.