Skip to content

Commit

Permalink
[MIG] edi_voxel_oca: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FernandoRomera committed Jul 25, 2024
1 parent 85a61c5 commit 8724128
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 50 deletions.
2 changes: 1 addition & 1 deletion edi_voxel_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Voxel",
"summary": "Base module for connecting with Voxel",
"version": "15.0.1.0.0",
"version": "17.0.1.0.0",
"development_status": "Production/Stable",
"category": "Hidden",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
30 changes: 0 additions & 30 deletions edi_voxel_oca/migrations/15.0.1.0.0/pre-migration.py

This file was deleted.

18 changes: 14 additions & 4 deletions edi_voxel_oca/models/voxel_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,14 @@ def _update_voxel_export_status(self, company):
queue_obj = self.env["queue.job"].sudo()
# Determine processed documents
filenames = self._list_voxel_document_filenames("Outbox", company)
processed = sent_docs.filtered(lambda r: r.voxel_filename not in filenames)
processed = sent_docs.filtered(
lambda r, filenames=filenames: r.voxel_filename not in filenames
)
# Determine documents with errors
filenames = self._list_voxel_document_filenames("Error", company)
with_errors = processed.filtered(lambda r: r.voxel_filename in filenames)
with_errors = processed.filtered(
lambda r, filenames=filenames: r.voxel_filename in filenames
)
doc_dict = {}
for doc in with_errors:
if doc.voxel_filename:
Expand All @@ -118,7 +122,10 @@ def _update_voxel_export_status(self, company):
# If not, create it
file_job = queue_obj.search(
[("channel", "=", "root.voxel_status")]
).filtered(lambda r: r.args == [filename, company])[:1]
).filtered(
lambda r, filename=filename, company=company: r.args
== [filename, company]
)[:1]
if not file_job:
error_msg = (
document.with_context(company_id=company.id)
Expand Down Expand Up @@ -160,7 +167,10 @@ def enqueue_import_voxel_documents(self, company):
# If not, create it
file_job = queue_job_obj.search(
[("channel", "=", "root.voxel_import")]
).filtered(lambda r: r.args == [voxel_filename, company])[:1]
).filtered(
lambda r, voxel_filename=voxel_filename, company=company: r.args
== [voxel_filename, company]
)[:1]
if not file_job:
self.with_context(
company_id=company.id
Expand Down
4 changes: 1 addition & 3 deletions edi_voxel_oca/security/voxel_security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
<record id="voxel_login_multi_company_rule" model="ir.rule">
<field name="name">Voxel login multi-company</field>
<field name="model_id" ref="edi_voxel_oca.model_voxel_login" />
<field
name="domain_force"
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
</record>
</odoo>
11 changes: 5 additions & 6 deletions edi_voxel_oca/views/res_company_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
<field name="name">res.company.voxel.form</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form" />
<field name="groups_id" eval="[(4, ref('group_voxel_manager'))]" />
<field name="arch" type="xml">
<notebook position="inside">
<page name="voxel" string="Voxel">
<page name="voxel" string="Voxel" groups="group_voxel_manager">
<group name="voxel_enabled">
<field name="voxel_enabled" />
</group>
<group
string="Logins"
name="voxel_logins"
attrs="{'invisible': [('voxel_enabled', '=', False)]}"
invisible="not voxel_enabled"
>
<field name="voxel_login_ids" nolabel="1">
<tree editable="bottom">
Expand All @@ -30,19 +29,19 @@
<group
name="voxel_config"
string="Configuration"
attrs="{'invisible': [('voxel_enabled', '=', False)]}"
invisible="not voxel_enabled"
>
<group name="voxel_send_config">
<field name="voxel_send_mode" />
<field
name='voxel_sent_time'
widget='float_time'
attrs="{'invisible': [('voxel_send_mode', '!=', 'fixed')]}"
invisible="voxel_send_mode != 'fixed'"
/>
<field
name='voxel_delay_time'
widget='float_time'
attrs="{'invisible': [('voxel_send_mode', '!=', 'delayed')]}"
invisible="voxel_send_mode != 'delayed'"
/>
</group>
<group name="voxel_login_config" />
Expand Down
4 changes: 2 additions & 2 deletions edi_voxel_oca/views/res_config_settings_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</div>
<div
class="row mt16"
attrs="{'invisible': [('voxel_send_mode', '!=', 'fixed')]}"
invisible="voxel_send_mode != 'fixed'"
>
<label
for="voxel_sent_time"
Expand All @@ -46,7 +46,7 @@
</div>
<div
class="row mt16"
attrs="{'invisible': [('voxel_send_mode', '!=', 'delayed')]}"
invisible="voxel_send_mode != 'delayed'"
>
<label
for="voxel_delay_time"
Expand Down
5 changes: 1 addition & 4 deletions edi_voxel_oca/views/res_partner_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
<field name="groups_id" eval="[(4, ref('group_voxel_manager'))]" />
<field name="arch" type="xml">
<group name="sale" position="inside">
<field
name="voxel_enabled"
attrs="{'invisible': [('parent_id', '!=', False), ('is_company', '=', False)]}"
/>
<field name="voxel_enabled" invisible="parent_id and not is_company" />
</group>
</field>
</record>
Expand Down

0 comments on commit 8724128

Please sign in to comment.