Commit bd7b1e76 authored by Cédric Krier's avatar 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
......@@ -1926,6 +1926,18 @@
'invisible': Bool(Eval('context', {}).get('standalone')),
'readonly': _states['readonly'] & Bool(Eval('invoice')),
invoice_party = fields.Function(
'', "Party",
'company': Eval('company', -1),
'on_change_with_invoice_party', searcher='search_invoice_party')
invoice_description = fields.Function(
fields.Char("Invoice Description"),
invoice_state = fields.Function(
fields.Selection('get_invoice_states', "Invoice State"),
......@@ -2180,6 +2192,30 @@
def default_type():
return 'line'
@fields.depends('party', 'invoice', '')
def on_change_with_invoice_party(self, name=None):
if self.invoice and
def search_invoice_party(cls, name, clause):
nested = clause[0][len(name) + 1:]
return ['OR',
('' + 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
def search_invoice_description(cls, name, clause):
return [('invoice.description', *clause[1:])]
def default_invoice_state(cls):
return 'draft'
......@@ -3,6 +3,7 @@
this repository contains the full copyright notices and license terms. -->
<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"/>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment