Skip to content

Commit

Permalink
[MIG] l10n_ar_edi_ux: Migration to 17.0
Browse files Browse the repository at this point in the history
closes #290

Signed-off-by: Juan José Scarafía <jjs@adhoc.com.ar>
  • Loading branch information
pablohmontenegro committed Dec 11, 2023
1 parent 611adcb commit 24baac2
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 191 deletions.
3 changes: 1 addition & 2 deletions l10n_ar_edi_ux/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ Argentinian Electronic Invoicing UX

* Add l10n_ar_afip_asoc_period_start / l10n_ar_afip_asoc_period_end fields and functionality on invoices
* Improve auto detecion of linked document when posting to afip an NC/ND by checking linked invoices on a sale order (for eg. a credit note created from a sale order will report as related invoice the invoice created from the same sale order)
* Implement electronic validation of documents created as purchase documents (for eg. liquido producto). There is an open PR to include this in Odoo standard
* Disable l10n_ar_ux view that add Argentinian Localization accounting settings and use the one added by l10n_ar_edi
* Logic to connecto to AFIP Padron using connection approach in enterprise module l10n_ar_edi
* Add button on electronic journals to get valid document types for the selected webservice. When is given the response and the Webservice used, returns a more legible message to be shown to the users.

About Padron:

Expand Down
1 change: 0 additions & 1 deletion l10n_ar_edi_ux/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
##############################################################################
from . import models
from . import wizards
from .hooks import post_init_hook
7 changes: 2 additions & 5 deletions l10n_ar_edi_ux/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
'name': 'Argentinian Electronic Invoicing UX',
'version': "16.0.1.1.0",
'version': "17.0.1.0.0",
'category': 'Localization/Argentina',
'sequence': 14,
'author': 'ADHOC SA',
Expand All @@ -15,9 +15,7 @@
'python': ['zeep'],
},
'data': [
'wizards/res_config_settings_view.xml',
'wizards/res_partner_update_from_padron_wizard_view.xml',
'wizards/account_payment_group_invoice_wizard_view.xml',
'views/res_partner_view.xml',
'views/account_move_view.xml',
'views/account_journal_view.xml',
Expand All @@ -26,8 +24,7 @@
'demo': [
'demo/res_partner_demo.xml',
],
'installable': False,
'installable': True,
'auto_install': True,
'application': False,
'post_init_hook': 'post_init_hook',
}
26 changes: 0 additions & 26 deletions l10n_ar_edi_ux/hooks.py

This file was deleted.

2 changes: 0 additions & 2 deletions l10n_ar_edi_ux/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ class AccountMove(models.Model):

l10n_ar_afip_asoc_period_start = fields.Date(
string='Associated Period Start',
states={'draft': [('readonly', False)]},
help='Set this field if it is you are reporting debit/credit note and have not related invoice.'
' IMPORTANT: This is only applies on "Electronic Invoice - Web Service"')
l10n_ar_afip_asoc_period_end = fields.Date(
string='Associated Perdio End',
states={'draft': [('readonly', False)]},
help='Set this field if it is you are reporting debit/credit note and have not related invoice.'
' IMPORTANT: This is only applies on "Electronic Invoice - Web Service"')

Expand Down
10 changes: 0 additions & 10 deletions l10n_ar_edi_ux/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@
class ResPartner(models.Model):
_inherit = 'res.partner'

def update_partner_data_from_afip(self):
""" Funcion que llama al wizard para actualizar data de partners desde afip sin abrir wizard.
Podríamos mejorar pasando un argumento para sobreescribir o no valores que esten o no definidos
Podriamos mejorarlo moviento lógica del wizard a esta funcion y que el wizard use este método. """
for rec in self:
wiz = rec.env['res.partner.update.from.padron.wizard'].with_context(
active_ids=rec.ids, active_model=rec._name).create({})
wiz.change_partner()
wiz.update_selection()

def button_update_partner_data_from_afip(self):
self.ensure_one()
wiz = self.env['res.partner.update.from.padron.wizard'].with_context(
Expand Down
2 changes: 1 addition & 1 deletion l10n_ar_edi_ux/views/account_journal_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<field name="inherit_id" ref="l10n_ar.view_account_journal_form"/>
<field name="arch" type="xml">
<button name="l10n_ar_check_afip_pos_number" position="after">
<button name="l10n_ar_check_afip_doc_types" string="Get Document Types" help="Get valid document types for this webservice" type="object" attrs="{'invisible':[('l10n_ar_afip_ws', '=', False)]}"/>
<button name="l10n_ar_check_afip_doc_types" string="Get Document Types" help="Get valid document types for this webservice" type="object" invisible="not l10n_ar_afip_ws"/>
</button>
</field>
</record>
Expand Down
2 changes: 1 addition & 1 deletion l10n_ar_edi_ux/views/res_partner_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<field name="inherit_id" ref="l10n_latam_base.view_partner_latam_form"/>
<field name="arch" type="xml">
<xpath expr="//group/group//div[2]//field[@name='vat']" position="after">
<button name="button_update_partner_data_from_afip" string="Update From AFIP" class="oe_link oe_inline" type="object" attrs="{'invisible': [('vat', '=', False)]}"/>
<button name="button_update_partner_data_from_afip" string="Update From AFIP" class="oe_link oe_inline" type="object" invisible="not vat"/>
</xpath>
</field>
</record>
Expand Down
1 change: 0 additions & 1 deletion l10n_ar_edi_ux/wizards/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
##############################################################################
from . import res_partner_update_from_padron_wizard
from . import res_config_settings
from . import account_payment_group_invoice_wizard
44 changes: 0 additions & 44 deletions l10n_ar_edi_ux/wizards/account_payment_group_invoice_wizard.py

This file was deleted.

This file was deleted.

41 changes: 0 additions & 41 deletions l10n_ar_edi_ux/wizards/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,3 @@ class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'

arba_cit = fields.Char(related='company_id.arba_cit', readonly=False)

def refresh_taxes_from_padron(self):
self.refresh_from_padron("impuestos")

def refresh_concepts_from_padron(self):
self.refresh_from_padron("conceptos")

def refresh_activities_from_padron(self):
self.refresh_from_padron("actividades")

@api.model
def refresh_from_padron(self, resource_type):
""" resource_type puede ser "impuestos", "conceptos", "actividades" """
data = {'impuestos': 'afip.tax', 'actividades': 'afip.activity', 'conceptos': 'afip.concept'}
resource_name = resource_type.capitalize().replace('tos', 'to').replace('des', 'd')

model = data.get(resource_type)
if not model:
raise UserError(_('Resource Type %s not implemented!') % (resource_type))

url = "https://soa.afip.gob.ar/parametros/v1/%s/" % resource_type
res = requests.get(url=url)
data = res.json().get('data')
if res.status_code != 200:
raise UserError(_('Error getting %s params from AFIP!') % resource_type)

codes = []
for item in data:
code = item.get("id" + resource_name)
values = {'code': code,
'name': item.get("desc" + resource_name),
'active': True}
record = self.env[model].search([('code', '=', code)], limit=1)
codes.append(code)
if record:
record.write(values)
else:
record.create(values)

# deactivate the ones that are not in afip
self.env[model].search([('code', 'not in', codes)]).write({'active': False})
27 changes: 0 additions & 27 deletions l10n_ar_edi_ux/wizards/res_config_settings_view.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,39 @@
<button name='update_selection' string='Update Selection'
class='oe_highlight'
type='object'
attrs="{'invisible': [('state', 'in', ('option', 'finished' ))]}"
/>
invisible="state in ('option', 'finished')"/>
<button name='next_cb' string='Skip these partner'
type='object' class='oe_link'
attrs="{'invisible': [('state', '!=', 'selection')]}" />
invisible="state != 'selection'" />
<button name='start_process_cb'
string='Update with Manual Check'
type='object' class='oe_highlight'
attrs="{'invisible': [('state', '!=', 'option')]}" />
invisible="state != 'option'" />
<button name='automatic_process_cb'
string='Update Automatically'
type='object' class='oe_highlight'
confirm="Are you sure to execute the automatic update of your partners ?"
attrs="{'invisible': [('state', '!=', 'option')]}" />
<span class="or_cancel" attrs="{'invisible': [('state', '=', 'finished')]} ">or
invisible="state != 'option'" />
<span class="or_cancel" invisible="state == 'finished'">or
<button string="Cancel" class="oe_link oe_inline" special="cancel"/>
</span>
<span class="or_cancel" attrs="{'invisible': [('state', '!=', 'finished')]} ">
<span class="or_cancel" invisible="state != 'finished'">
<button string="Close" class="oe_link oe_inline" special="cancel"/>
</span>
</header>
<sheet>
<h2 attrs="{'invisible': [('state', '!=', 'finished')]}">There are no more partners to update for this request...</h2>
<p class="oe_grey" attrs="{'invisible': [('state', '!=', ('option'))]}">
<h2 invisible="state != 'finished'">There are no more partners to update for this request...</h2>
<p class="oe_grey" invisible="state != 'option'">
Only Partners with cuit are going to be updated.<br/>
Select the list of fields you want to update.
</p>
<group attrs="{'invisible': [('state', 'not in', ('option',))]}">
<group invisible="state not in ('option',)">
<field name="field_to_update_ids" widget="many2many_tags" options="{'no_create': True}" />
<field name="update_constancia"/>
<field name="title_case"/>
</group>
<group attrs="{'invisible': [('state', 'in', ('option', 'finished'))]}">
<field name="partner_id" attrs="{'required': [('state', '=', 'selection')]}"/>
<group invisible="state in ('option', 'finished')">
<field name="partner_id" required="state == 'selection'"/>
<field name="field_ids" nolabel="1" colspan="2">
<tree create="false">
<field name="label"/>
Expand Down

0 comments on commit 24baac2

Please sign in to comment.