mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] contract_layout_category_hide_detail: black, isort, prettier
This commit is contained in:
@@ -7,15 +7,8 @@
|
|||||||
"version": "12.0.1.0.0",
|
"version": "12.0.1.0.0",
|
||||||
"category": "Contract Management",
|
"category": "Contract Management",
|
||||||
"website": "https://github.com/OCA/contract",
|
"website": "https://github.com/OCA/contract",
|
||||||
"author": "Tecnativa, "
|
"author": "Tecnativa, " "Odoo Community Association (OCA)",
|
||||||
"Odoo Community Association (OCA)",
|
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"depends": [
|
"depends": ["contract", "sale_layout_category_hide_detail"],
|
||||||
"contract",
|
"data": ["views/abstract_contract_line.xml", "views/contract.xml"],
|
||||||
"sale_layout_category_hide_detail",
|
|
||||||
],
|
|
||||||
"data": [
|
|
||||||
"views/abstract_contract_line.xml",
|
|
||||||
"views/contract.xml",
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,11 @@
|
|||||||
# Copyright 2020 Tecnativa - Ernesto Tejeda
|
# Copyright 2020 Tecnativa - Ernesto Tejeda
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import models, fields
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
class ContractAbstractContractLine(models.AbstractModel):
|
class ContractAbstractContractLine(models.AbstractModel):
|
||||||
_inherit = 'contract.abstract.contract.line'
|
_inherit = "contract.abstract.contract.line"
|
||||||
|
|
||||||
show_details = fields.Boolean(
|
show_details = fields.Boolean(string="Show details", default=True)
|
||||||
string="Show details",
|
show_subtotal = fields.Boolean(string="Show subtotal", default=True)
|
||||||
default=True
|
|
||||||
)
|
|
||||||
show_subtotal = fields.Boolean(
|
|
||||||
string="Show subtotal",
|
|
||||||
default=True
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from odoo import api, models
|
|||||||
|
|
||||||
|
|
||||||
class ContractLine(models.Model):
|
class ContractLine(models.Model):
|
||||||
_inherit = 'contract.line'
|
_inherit = "contract.line"
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _prepare_invoice_line(self, invoice_id=False, invoice_values=False):
|
def _prepare_invoice_line(self, invoice_id=False, invoice_values=False):
|
||||||
@@ -16,7 +16,6 @@ class ContractLine(models.Model):
|
|||||||
# 'vals' will be equal to {}
|
# 'vals' will be equal to {}
|
||||||
if vals:
|
if vals:
|
||||||
vals.update(
|
vals.update(
|
||||||
show_details=self.show_details,
|
show_details=self.show_details, show_subtotal=self.show_subtotal,
|
||||||
show_subtotal=self.show_subtotal,
|
|
||||||
)
|
)
|
||||||
return vals
|
return vals
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<record id="contract_abstract_contract_line_form_view" model="ir.ui.view">
|
<record id="contract_abstract_contract_line_form_view" model="ir.ui.view">
|
||||||
<field name="name">contract.abstract.contract.line.hide.details</field>
|
<field name="name">contract.abstract.contract.line.hide.details</field>
|
||||||
<field name="model">contract.abstract.contract.line</field>
|
<field name="model">contract.abstract.contract.line</field>
|
||||||
<field name="inherit_id" ref="contract.contract_abstract_contract_line_form_view"/>
|
<field
|
||||||
|
name="inherit_id"
|
||||||
|
ref="contract.contract_abstract_contract_line_form_view"
|
||||||
|
/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="name" position="after">
|
<field name="name" position="after">
|
||||||
<group attrs="{'invisible': [('display_type', '!=', 'line_section')]}">
|
<group attrs="{'invisible': [('display_type', '!=', 'line_section')]}">
|
||||||
<field name="show_details"/>
|
<field name="show_details" />
|
||||||
<field name="show_subtotal"
|
<field
|
||||||
attrs="{'invisible': [('show_details', '!=', True)]}"/>
|
name="show_subtotal"
|
||||||
|
attrs="{'invisible': [('show_details', '!=', True)]}"
|
||||||
|
/>
|
||||||
</group>
|
</group>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="contract_contract_form_view" model="ir.ui.view">
|
<record id="contract_contract_form_view" model="ir.ui.view">
|
||||||
<field name="name">contract.contract.form.hide.details</field>
|
<field name="name">contract.contract.form.hide.details</field>
|
||||||
<field name="model">contract.contract</field>
|
<field name="model">contract.contract</field>
|
||||||
<field name="inherit_id" ref="contract.contract_contract_form_view"/>
|
<field name="inherit_id" ref="contract.contract_contract_form_view" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='contract_line_ids']/tree" position="inside">
|
<xpath expr="//field[@name='contract_line_ids']/tree" position="inside">
|
||||||
<field name="show_details"
|
<field
|
||||||
widget="boolean_fa_icon"
|
name="show_details"
|
||||||
options="{
|
widget="boolean_fa_icon"
|
||||||
|
options="{
|
||||||
'show_in_line_section': true,
|
'show_in_line_section': true,
|
||||||
'fa_icons': {
|
'fa_icons': {
|
||||||
'icon_true': 'fa-eye',
|
'icon_true': 'fa-eye',
|
||||||
@@ -20,10 +20,12 @@
|
|||||||
'hover_false': 'Switch to: details shown',
|
'hover_false': 'Switch to: details shown',
|
||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
attrs="{'invisible': [('display_type', '!=', 'line_section')]}"/>
|
attrs="{'invisible': [('display_type', '!=', 'line_section')]}"
|
||||||
<field name="show_subtotal"
|
/>
|
||||||
widget="boolean_fa_icon"
|
<field
|
||||||
options="{
|
name="show_subtotal"
|
||||||
|
widget="boolean_fa_icon"
|
||||||
|
options="{
|
||||||
'show_in_line_section': true,
|
'show_in_line_section': true,
|
||||||
'fa_icons': {
|
'fa_icons': {
|
||||||
'icon_true': 'fa-plus-circle',
|
'icon_true': 'fa-plus-circle',
|
||||||
@@ -34,9 +36,9 @@
|
|||||||
'hover_false': 'Switch to: subtotal shown',
|
'hover_false': 'Switch to: subtotal shown',
|
||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
attrs="{'invisible': ['|', ('display_type', '!=', 'line_section'), ('show_details', '!=', True)]}"/>
|
attrs="{'invisible': ['|', ('display_type', '!=', 'line_section'), ('show_details', '!=', True)]}"
|
||||||
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../contract_layout_category_hide_detail
|
||||||
6
setup/contract_layout_category_hide_detail/setup.py
Normal file
6
setup/contract_layout_category_hide_detail/setup.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user