Finish migration to version 10.0

Do not raise ConnectionError if we get a response
Use ConnectionError from requests lib instead of overriding it
Fix push_to_pingen (writes on state as for cron), remove unneeded loops
This commit is contained in:
Akim Juillerat
2018-01-11 14:57:10 +01:00
parent f470bb7be5
commit e3b2f67dec
17 changed files with 342 additions and 347 deletions

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="base_config_settings_inherit" model="ir.ui.view">
<field name="name">base.config.settings.inherit</field>
<field name="inherit_id" ref="base_setup.view_general_configuration"/>
<field name="model">base.config.settings</field>
<field name="arch" type="xml">
<group name="report" position="before">
<group string="Pingen Integration">
<field name="pingen_token" groups="base.group_system"/>
<field name="pingen_staging" groups="base.group_system"/>
</group>
</group>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_attachment_form" model="ir.ui.view">
<field name="name">ir.attachment.pingen.view</field>
<field name="model">ir.attachment</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_attachment_form"/>
<field name="arch" type="xml">
<xpath expr="//group/group[2]" position="after">
<group string="Pingen info" groups="base.group_no_one">
<field name="send_to_pingen"/>
<field name="pingen_send" attrs="{'required': [('send_to_pingen', '=', True)]}"/>
<field name="pingen_speed" attrs="{'required': [('pingen_send', '=', True)]}"/>
<field name="pingen_color" />
</group>
</xpath>
</field>
</record>
<act_window
context="{'search_default_attachment_id': [active_id], 'default_attachment_id': active_id}"
id="act_attachment_to_pingen_document"
name="Pingen Document"
groups=""
res_model="pingen.document"
src_model="ir.attachment"/>
</odoo>

View File

@@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_pingen_document_tree" model="ir.ui.view">
<field name="name">pingen.document.tree</field>
<field name="model">pingen.document</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Pingen Document">
<field name="name"/>
<field name="datas_fname"/>
<field name="pingen_send"/>
<field name="pingen_speed"/>
<field name="pingen_color"/>
<field name="state"/>
</tree>
</field>
</record>
<record id="view_pingen_document_form" model="ir.ui.view">
<field name="name">pingen.document.form</field>
<field name="model">pingen.document</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Pingen Document">
<header>
<field name="state" widget="statusbar"
statusbar_visible="pending,pushed,sent"
statusbar_colors='{"error":"red","pingen_error":"red","canceled":"grey","pushed":"blue","sent":"green"}'/>
</header>
<group colspan="4" col="6">
<field name="name" readonly="True"/>
<field name="type" readonly="True"/>
<field name="company_id" readonly="True" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
<page string="Pingen.com">
<separator string="Options" colspan="4"/>
<newline />
<group col="2" colspan="2">
<field name="pingen_send" attrs="{'readonly': [('state', 'in', ['sendcenter', 'sent'])]}"/>
<field name="pingen_speed" attrs="{'readonly': [('state', 'in', ['sendcenter', 'sent'])], 'required': [('pingen_send', '=', True)]}"/>
<field name="pingen_color" attrs="{'readonly': [('state', 'in', ['sendcenter', 'sent'])]}"/>
</group>
<separator string="Dates" colspan="4"/>
<newline />
<group col="2" colspan="2">
<field name="push_date"/>
</group>
<group colspan="4" attrs="{'invisible': [('last_error_message', '=', False)]}">
<separator string="Errors" colspan="4"/>
<newline />
<group col="2" colspan="2">
<field nolabel="1" name="last_error_message"/>
</group>
</group>
<group colspan="4" attrs="{'invisible': [('state', 'not in', ['sendcenter', 'sent'])]}">
<separator string="Sendcenter" colspan="4"/>
<newline />
<group col="4" colspan="2">
<field colspan="4" name="post_status"/>
<group col="3" colspan="2">
<field name="cost"/>
<field colspan="1" nolabel="1" name="currency_id"/>
</group>
<newline/>
<field name="parsed_address"/>
<field name="country_id"/>
<field name="send_date"/>
<field name="pages"/>
</group>
</group>
<separator string="Actions" colspan="4"/>
<newline />
<group col="2" colspan="2">
<button name="push_to_pingen" type="object"
states="pending"
string="Push to pingen.com" icon="fa-upload"/>
<button name="ask_pingen_send" type="object"
states="pushed"
string="Ask pingen.com to send the document" icon="fa-share"/>
<button name="resolve_error" type="object"
states="error,pingen_error"
string="Errors resolved" icon="fa-repeat"/>
<button name="update_post_infos" type="object"
states="sendcenter"
string="Update the letter's informations" icon="fa-refresh"/>
</group>
</page>
<page string="Attachment">
<group col="4" colspan="4">
<separator string="Data" colspan="4"/>
<newline />
<group col="2" colspan="4" attrs="{'invisible':[('type','=','url')]}">
<field name="datas" filename="datas_fname" readonly="True"/>
<field name="datas_fname" select="1" readonly="True"/>
</group>
<group col="2" colspan="4" attrs="{'invisible':[('type','=','binary')]}">
<field name="url" widget="url" readonly="True"/>
</group>
</group>
<group col="2" colspan="4">
<separator string="Attached To" colspan="2"/>
<field name="attachment_id"/>
</group>
</page>
</notebook>
</form>
</field>
</record>
<record id="view_pingen_document_search" model="ir.ui.view">
<field name="name">pingen.document.search</field>
<field name="model">pingen.document</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Pingen Document">
<filter icon="terp-project"
string="Pending"
domain="[('state','=','pending')]"/>
<filter icon="terp-stage"
string="Pushed"
domain="[('state','=','pushed')]"/>
<filter icon="gtk-print"
string="In Sendcenter"
domain="[('state','=','sendcenter')]"/>
<filter icon="kanban-apply"
string="Sent"
domain="[('state','=','sent')]"/>
<filter icon="kanban-stop"
string="Error"
domain="[('state','=','error')]"/>
<filter icon="STOCK_NO"
string="Pingen Error"
domain="[('state','=','pingen_error')]"/>
<filter icon="terp-dialog-close"
string="Canceled"
domain="[('state','=','canceled')]"/>
<separator orientation="vertical"/>
<field name="attachment_id" />
</search>
</field>
</record>
<record id="action_pingen_document" model="ir.actions.act_window">
<field name="name">Pingen Documents</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pingen.document</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_pingen_document_search"/>
</record>
<menuitem action="action_pingen_document" id="menu_pingen_document"/>
</odoo>