Skip to content
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

[16.0][IMP] l10n_fr_chorus_account: backport view improvements from v18 #605

Open
wants to merge 7 commits into
base: 16.0
Choose a base branch
from
10 changes: 10 additions & 0 deletions l10n_fr_chorus_account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ class AccountMove(models.Model):
readonly=True,
states={"draft": [("readonly", False)]},
)
# disallow modification of transmit method on posted invoiced, because it allows
# users to switch to Chorus after confirmation, which by-passes the Chorus-specific checks
transmit_method_id = fields.Many2one(
readonly=True, states={"draft": [("readonly", False)]}
)
chorus_service_code = fields.Char(
related="partner_id.fr_chorus_service_id.code",
string="Chorus Service Code",
store=True,
)

@api.constrains("chorus_attachment_ids", "transmit_method_id")
def _check_chorus_attachments(self):
Expand Down
4 changes: 4 additions & 0 deletions l10n_fr_chorus_account/security/group.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<field name="name">Chorus API</field>
<field name="category_id" ref="base.module_category_hidden" />
</record>
<record id="group_chorus_api_debug" model="res.groups">
<field name="name">Chorus API Debugging</field>
<field name="category_id" ref="base.module_category_hidden" />
</record>
</data>
<data noupdate="1">
<record id="chorus_flow_rule" model="ir.rule">
Expand Down
1 change: 1 addition & 0 deletions l10n_fr_chorus_account/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_chorus_flow_readonly,Read-only access on chorus.flow to account viewer,model_chorus_flow,account.group_account_readonly,1,0,0,0
access_chorus_flow_user,Read/Write/Create access on chorus.flow to invoicing grp,model_chorus_flow,account.group_account_invoice,1,1,1,0
access_chorus_flow_full,Full access on chorus.flow to system grp,model_chorus_flow,base.group_system,1,1,1,1
access_chorus_partner_service_full,Full access on chorus.partner.service to system grp,model_chorus_partner_service,base.group_system,1,1,1,1
Expand Down
37 changes: 27 additions & 10 deletions l10n_fr_chorus_account/views/account_move.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<field name="model">account.move</field>
<field name="inherit_id" ref="account_invoice_transmit_method.view_move_form" />
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field
name="chorus_service_code"
attrs="{'invisible': [('transmit_method_code', '!=', 'fr-chorus')]}"
/>
</field>
<button name="action_invoice_sent" position="after">
<button
name="%(account_invoice_chorus_send_action)d"
Expand All @@ -30,17 +36,25 @@
<group name="chorus-tab">
<group name="chorus-main">
<field name="chorus_flow_id" />
<field name="chorus_identifier" />
<field name="chorus_status" />
<field name="chorus_status_date" />
<button
name="chorus_update_invoice_status"
type="object"
string="Update Chorus Invoice Status"
attrs="{'invisible': [('chorus_identifier', 'in', (False, 0))]}"
colspan="2"
class="btn-default"
<field name="chorus_identifier" invisible="1" />
<field
name="chorus_identifier"
groups="l10n_fr_chorus_account.group_chorus_api_debug"
/>
<field name="chorus_status" />
<label for="chorus_status_date" />
<div name="chorus_status_date" class="o_row">
<field name="chorus_status_date" />
<button
name="chorus_update_invoice_status"
type="object"
string="Update"
help="Update Chorus Invoice Status"
class="btn-link mb-1 px-0"
icon="fa-refresh"
attrs="{'invisible': [('chorus_identifier', '=', False)]}"
/>
</div>
</group>
<group name="chorus-attachments" string="Attachments">
<field
Expand All @@ -59,6 +73,9 @@
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_invoice_tree" />
<field name="arch" type="xml">
<field name="invoice_date" position="before">
<field name="chorus_service_code" optional="hide" />
</field>
<field name="payment_state" position="after">
<field name="chorus_status" optional="hide" />
</field>
Expand Down
7 changes: 6 additions & 1 deletion l10n_fr_chorus_account/views/chorus_flow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@
<field name="currency_id" invisible="1" />
<field name="state" invisible="1" />
<field name="payment_state" />
<field name="chorus_identifier" />
<field
name="chorus_identifier"
groups="l10n_fr_chorus_account.group_chorus_api_debug"
/>
<field name="chorus_status" />
<field name="chorus_status_date" />
</tree>
Expand Down Expand Up @@ -92,6 +95,8 @@
<field name="arch" type="xml">
<search>
<field name="name" />
<separator />
<filter string="Date" name="date" date="date" />
<group string="Group By" name="groupby">
<filter
name="status_groupby"
Expand Down
4 changes: 2 additions & 2 deletions l10n_fr_chorus_account/views/chorus_partner_service.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<field name="active" />
<field
name="chorus_identifier"
groups="l10n_fr_chorus_account.group_chorus_api"
groups="l10n_fr_chorus_account.group_chorus_api_debug"
/>
</group>
</form>
Expand All @@ -41,7 +41,7 @@
<field name="engagement_required" />
<field
name="chorus_identifier"
groups="l10n_fr_chorus_account.group_chorus_api"
groups="l10n_fr_chorus_account.group_chorus_api_debug"
/>
</tree>
</field>
Expand Down
60 changes: 40 additions & 20 deletions l10n_fr_chorus_account/views/config_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,33 @@
>
<div class="o_setting_left_pane" />
<div class="o_setting_right_pane">
<div class="row">
<label
for="fr_chorus_invoice_format"
class="col-md-5 o_light_label"
/>
<field name="fr_chorus_invoice_format" />
</div>
<div class="row">
<label
for="fr_chorus_invoice_format"
class="col-md-5 o_light_label"
/>
<field name="fr_chorus_invoice_format" />
</div>
</div>
<div
class="col-xs-12 col-md-12 o_setting_box"
attrs="{'invisible': [('group_chorus_api', '=', False)]}"
>
<div class="o_setting_left_pane">
<field name="fr_chorus_check_commitment_number" />
</div>
<div class="o_setting_right_pane">
<label
for="fr_chorus_check_commitment_number"
class="col-md-5 o_light_label"
/>
<field name="fr_chorus_check_commitment_number" />
</div>
for="fr_chorus_check_commitment_number"
class="col-md-5 o_light_label"
/>
</div>
</div>
<div
class="col-xs-12 col-md-12 o_setting_box"
attrs="{'invisible': [('group_chorus_api', '=', False)]}"
>
<div class="o_setting_left_pane" />
<div class="o_setting_right_pane">
<div class="row">
<label
for="fr_chorus_api_login"
Expand Down Expand Up @@ -76,13 +89,20 @@
widget="many2many_tags"
/>
</div>
<div class="row">
<label
for="fr_chorus_qualif"
class="col-md-5 o_light_label"
/>
<field name="fr_chorus_qualif" />
</div>
</div>
</div>
<div
class="col-xs-12 col-md-12 o_setting_box"
attrs="{'invisible': [('group_chorus_api', '=', False)]}"
>
<div class="o_setting_left_pane">
<field name="fr_chorus_qualif" />
</div>
<div class="o_setting_right_pane">
<label
for="fr_chorus_qualif"
class="col-md-5 o_light_label"
/>
</div>
</div>
</div>
Expand Down
63 changes: 51 additions & 12 deletions l10n_fr_chorus_account/views/res_partner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<field name="ref" position="after">
<field
name="fr_chorus_service_id"
attrs="{'invisible': ['|', ('parent_id', '=', False), ('customer_invoice_transmit_method_code', '!=', 'fr-chorus')]}"
domain="[('partner_id', '=', parent_id)]"
context="{'default_partner_id': parent_id}"
/>
</field>
<xpath
expr="//field[@name='child_ids']/form//label[@for='street']"
position="before"
Expand All @@ -33,29 +25,65 @@
expr="//page[@name='sales_purchases']/group[@name='container_row_2']"
position="inside"
>
<group
name="fr-chorus-child"
string="Chorus Pro"
attrs="{'invisible': ['|', ('customer_invoice_transmit_method_code', '!=', 'fr-chorus'), ('parent_id', '=', False)]}"
>
<field
name="fr_chorus_service_id"
attrs="{'invisible': ['|', '|', ('type', '!=', 'invoice'), ('parent_id', '=', False), ('customer_invoice_transmit_method_code', '!=', 'fr-chorus')]}"
domain="[('partner_id', '=', parent_id)]"
context="{'default_partner_id': parent_id}"
/>
<div name="parent_chorus" colspan="2">
<p>Other Chorus parameters are managed on <button
name="open_commercial_entity"
type="object"
string="the parent company"
class="oe_link"
/></p>
</div>
</group>
<group
name="fr-chorus"
string="Chorus Pro"
attrs="{'invisible': [('customer_invoice_transmit_method_code', '!=', 'fr-chorus')]}"
attrs="{'invisible': ['|', ('customer_invoice_transmit_method_code', '!=', 'fr-chorus'), ('parent_id', '!=', False)]}"
>
<button
name="fr_chorus_identifier_and_required_button"
type="object"
string="Update Chorus Info and Services"
string="Get Chorus Info and Services"
colspan="2"
class="btn-primary"
groups="l10n_fr_chorus_account.group_chorus_api"
attrs="{'invisible': [('fr_chorus_required', '!=', False)]}"
/>
<field name="fr_chorus_required" />

<label for="fr_chorus_required" />
<div name="fr_chorus_required" class="o_row">
<field name="fr_chorus_required" />
<button
name="fr_chorus_identifier_and_required_button"
type="object"
string="Update"
class="btn-link mb-1 px-0"
icon="fa-refresh"
groups="l10n_fr_chorus_account.group_chorus_api"
attrs="{'invisible': [('fr_chorus_required', '=', False)]}"
help="Update Info Required for Chorus and Chorus Services"
/>
</div>
<field
name="fr_chorus_identifier"
groups="l10n_fr_chorus_account.group_chorus_api"
groups="l10n_fr_chorus_account.group_chorus_api_debug"
/>
<button
type="action"
class="btn-link"
name="%(chorus_partner_service_action)d"
context="{'search_default_partner_id': active_id, 'default_partner_id': active_id}"
colspan="2"
>
<field
name="fr_chorus_service_count"
Expand All @@ -65,6 +93,17 @@
</button>
</group>
</xpath>
<xpath expr="//field[@name='child_ids']/kanban" position="inside">
<field name="fr_chorus_service_id" />
</xpath>
<xpath
expr="//field[@name='child_ids']/kanban/templates/t[@t-name='kanban-box']//div[@t-if='record.mobile.raw_value']"
position="after"
>
<div t-if="record.fr_chorus_service_id.raw_value">Chorus Service: <field
name="fr_chorus_service_id"
/></div>
</xpath>
</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def default_get(self, fields_list):
invoice_count = fields.Integer(string="Number of Invoices", readonly=True)
company_id = fields.Many2one("res.company", string="Company", readonly=True)
chorus_invoice_format = fields.Selection(
related="company_id.fr_chorus_invoice_format", readonly=True
related="company_id.fr_chorus_invoice_format",
)

def run(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<field name="invoice_ids" widget="many2many_tags" />
<field name="invoice_count" />
<field name="company_id" groups="base.group_multi_company" />
<field name="company_id" invisible="1" />
<field name="chorus_invoice_format" />
</group>
<footer>
Expand Down
5 changes: 5 additions & 0 deletions l10n_fr_chorus_sale/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class SaleOrder(models.Model):
invoice_transmit_method_code = fields.Char(
related="partner_invoice_id.customer_invoice_transmit_method_id.code",
)
chorus_service_code = fields.Char(
related="partner_invoice_id.fr_chorus_service_id.code",
string="Chorus Service Code",
store=True,
)

def action_confirm(self):
"""Check validity of Chorus orders"""
Expand Down
28 changes: 28 additions & 0 deletions l10n_fr_chorus_sale/views/sale_order.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,38 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<field name="partner_invoice_id" position="after">
<field
name="chorus_service_code"
attrs="{'invisible': [('invoice_transmit_method_code', '!=', 'fr-chorus')]}"
/>
</field>
<group name="sale_info" position="inside">
<field name="invoice_transmit_method_id" />
<field name="invoice_transmit_method_code" invisible="1" />
</group>
</field>
</record>
<record id="view_order_tree" model="ir.ui.view">
<field name="name">chorus.sale.order.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree" />
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="chorus_service_code" optional="hide" />
</field>
</field>
</record>
<record id="view_quotation_tree" model="ir.ui.view">
<field name="name">chorus.sale.order.quotation.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_quotation_tree" />
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="chorus_service_code" optional="hide" />
</field>
</field>
</record>


</odoo>
Loading