Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tryton
Tryton
Commits
bd7b1e764e0b
Commit
bd7b1e76
authored
Dec 26, 2022
by
Cédric Krier
Browse files
Add invoice party and description to invoice line list
Closes
#11904
parent
4d53c859589c
Pipeline
#60085
passed with stages
in 1 minute and 46 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
modules/account_invoice/invoice.py
View file @
bd7b1e76
...
...
@@ -1926,6 +1926,18 @@
'invisible'
:
Bool
(
Eval
(
'context'
,
{}).
get
(
'standalone'
)),
'readonly'
:
_states
[
'readonly'
]
&
Bool
(
Eval
(
'invoice'
)),
})
invoice_party
=
fields
.
Function
(
fields
.
Many2One
(
'party.party'
,
"Party"
,
context
=
{
'company'
:
Eval
(
'company'
,
-
1
),
},
depends
=
[
'company'
]),
'on_change_with_invoice_party'
,
searcher
=
'search_invoice_party'
)
invoice_description
=
fields
.
Function
(
fields
.
Char
(
"Invoice Description"
),
'on_change_with_invoice_description'
,
searcher
=
'search_invoice_description'
)
invoice_state
=
fields
.
Function
(
fields
.
Selection
(
'get_invoice_states'
,
"Invoice State"
),
'on_change_with_invoice_state'
)
...
...
@@ -2180,6 +2192,30 @@
def
default_type
():
return
'line'
@
fields
.
depends
(
'party'
,
'invoice'
,
'_parent_invoice.party'
)
def
on_change_with_invoice_party
(
self
,
name
=
None
):
if
self
.
invoice
and
self
.
invoice
.
party
:
return
self
.
invoice
.
party
.
id
elif
self
.
party
:
return
self
.
party
.
id
@
classmethod
def
search_invoice_party
(
cls
,
name
,
clause
):
nested
=
clause
[
0
][
len
(
name
)
+
1
:]
return
[
'OR'
,
(
'invoice.party'
+
nested
,
*
clause
[
1
:]),
(
'party'
+
nested
,
*
clause
[
1
:]),
]
@
fields
.
depends
(
'invoice'
,
'_parent_invoice.description'
)
def
on_change_with_invoice_description
(
self
,
name
=
None
):
if
self
.
invoice
:
return
self
.
invoice
.
description
@
classmethod
def
search_invoice_description
(
cls
,
name
,
clause
):
return
[(
'invoice.description'
,
*
clause
[
1
:])]
@
classmethod
def
default_invoice_state
(
cls
):
return
'draft'
...
...
modules/account_invoice/view/invoice_line_tree.xml
View file @
bd7b1e76
...
...
@@ -3,6 +3,7 @@
this repository contains the full copyright notices and license terms. -->
<tree>
<field
name=
"invoice"
expand=
"1"
/>
<field
name=
"invoice_party"
expand=
"1"
optional=
"0"
/>
<field
name=
"type"
optional=
"1"
/>
<field
name=
"product"
expand=
"1"
optional=
"0"
/>
<field
name=
"summary"
expand=
"1"
optional=
"1"
/>
...
...
@@ -6,5 +7,5 @@
<field
name=
"type"
optional=
"1"
/>
<field
name=
"product"
expand=
"1"
optional=
"0"
/>
<field
name=
"summary"
expand=
"1"
optional=
"1"
/>
<field
name=
"account"
expand=
"1"
optional=
"
0
"
/>
<field
name=
"account"
expand=
"1"
optional=
"
1
"
/>
<field
name=
"quantity"
symbol=
"unit"
/>
...
...
@@ -10,4 +11,4 @@
<field
name=
"quantity"
symbol=
"unit"
/>
<field
name=
"unit_price"
/>
<field
name=
"taxes"
optional=
"
0
"
/>
<field
name=
"unit_price"
optional=
"1"
/>
<field
name=
"taxes"
optional=
"
1
"
/>
<field
name=
"amount"
/>
...
...
@@ -13,2 +14,3 @@
<field
name=
"amount"
/>
<field
name=
"invoice_description"
expand=
"1"
optional=
"1"
/>
</tree>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment