Enable notes for invoices
- Add notebook on invoice line form - Add notes to invoice lines - Add spellcheck for text fields
This commit is contained in:
1 parent
0411c83f1b
commit
4fa06143a6
2 files changed
+75
-21
No files matched your search
+31
@@ -58,6 +58,8 @@ class Invoice(OSV):
|
||||
party = fields.Many2One('party.party', 'Party', change_default=True,
|
||||
required=True, states=_STATES, on_change=['party', 'payment_term',
|
||||
'type', 'company'])
|
||||
party_lang = fields.Function('get_party_language', type='char',
|
||||
string='Party Language', on_change_with=['party'])
|
||||
invoice_address = fields.Many2One('party.address', 'Invoice Address',
|
||||
required=True, states=_STATES, domain="[('party', '=', party)]")
|
||||
currency = fields.Many2One('currency.currency', 'Currency', required=True,
|
||||
@@ -264,6 +266,34 @@ class Invoice(OSV):
|
||||
res[invoice.id] = invoice.currency.digits
|
||||
return res
|
||||
|
||||
def on_change_with_party_lang(self, cursor, user, ids, vals, context=None):
|
||||
party_obj = self.pool.get('party.party')
|
||||
if vals.get('party'):
|
||||
party = party_obj.browse(cursor, user, vals['party'],
|
||||
context=context)
|
||||
if party.lang:
|
||||
return party.lang.code
|
||||
return 'en_US'
|
||||
|
||||
def get_party_language(self, cursor, user, ids, name, arg, context=None):
|
||||
'''
|
||||
Return the language code of the party of each invoice
|
||||
|
||||
:param cursor: the database cursor
|
||||
:param user: the user id
|
||||
:param ids: the ids of the invoices
|
||||
:param context: the context
|
||||
:return: a dictionary with invoice id as key and
|
||||
language code as value
|
||||
'''
|
||||
res = {}
|
||||
for invoice in self.browse(cursor, user, ids, context=context):
|
||||
if invoice.party.lang:
|
||||
res[invoice.id] = invoice.party.lang.code
|
||||
else:
|
||||
res[invoice.id] = 'en_US'
|
||||
return res
|
||||
|
||||
def get_type_name(self, cursor, user, ids, name, arg, context=None):
|
||||
res = {}
|
||||
type2name = {}
|
||||
@@ -1144,6 +1174,7 @@ class InvoiceLine(OSV):
|
||||
}, on_change_with=['type', 'quantity', 'unit_price',
|
||||
'_parent_invoice.currency', 'currency'])
|
||||
description = fields.Text('Description', size=None, required=True)
|
||||
note = fields.Text('Note')
|
||||
taxes = fields.Many2Many('account.tax', 'account_invoice_line_account_tax',
|
||||
'line', 'tax', 'Taxes', domain=[('parent', '=', False)],
|
||||
states={
|
||||
|
||||
+44
-21
@@ -122,7 +122,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<label name="invoice_report"/>
|
||||
<field name="invoice_report"/>
|
||||
<separator name="comment" colspan="4"/>
|
||||
<field name="comment" colspan="4"/>
|
||||
<field name="comment" colspan="4" spell="party_lang"/>
|
||||
</page>
|
||||
<page string="Payment" id="payment">
|
||||
<label name="amount_to_pay_today"/>
|
||||
@@ -145,6 +145,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
</page>
|
||||
</notebook>
|
||||
<field name="currency_digits" invisible="1" colspan="6"/>
|
||||
<field name="party_lang" invisible="1" colspan="6"/>
|
||||
</form>
|
||||
]]>
|
||||
</field>
|
||||
@@ -707,26 +708,48 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<form string="Invoice Line" cursor="product">
|
||||
<label name="invoice"/>
|
||||
<field name="invoice" colspan="3"/>
|
||||
<label name="type"/>
|
||||
<field name="type"/>
|
||||
<label name="sequence"/>
|
||||
<field name="sequence"/>
|
||||
<label name="product"/>
|
||||
<field name="product"/>
|
||||
<label name="account"/>
|
||||
<field name="account"/>
|
||||
<label name="description"/>
|
||||
<field name="description" colspan="3"/>
|
||||
<label name="quantity"/>
|
||||
<field name="quantity"/>
|
||||
<label name="unit"/>
|
||||
<field name="unit"/>
|
||||
<label name="unit_price"/>
|
||||
<field name="unit_price"/>
|
||||
<label name="amount"/>
|
||||
<field name="amount"/>
|
||||
<separator name="taxes" colspan="4"/>
|
||||
<field name="taxes" colspan="4"/>
|
||||
<notebook colspan="4">
|
||||
<page string="General" id="general">
|
||||
<label name="type"/>
|
||||
<field name="type"/>
|
||||
<label name="sequence"/>
|
||||
<field name="sequence"/>
|
||||
<label name="product"/>
|
||||
<field name="product">
|
||||
<tree string="Products">
|
||||
<field name="name" select="1"/>
|
||||
<field name="code" select="1"/>
|
||||
<field name="list_price_uom" select="2"/>
|
||||
<field name="cost_price_uom" select="2"/>
|
||||
<field name="quantity" select="2"/>
|
||||
<field name="forecast_quantity" select="2"/>
|
||||
<field name="default_uom" select="2"/>
|
||||
<field name="active" select="2"/>
|
||||
</tree>
|
||||
</field>
|
||||
<label name="account"/>
|
||||
<field name="account"/>
|
||||
<newline/>
|
||||
<label name="description"/>
|
||||
<field name="description" colspan="3"
|
||||
spell="_parent_invoice.party_lang"/>
|
||||
<label name="quantity"/>
|
||||
<field name="quantity"/>
|
||||
<label name="unit"/>
|
||||
<field name="unit"/>
|
||||
<label name="unit_price"/>
|
||||
<field name="unit_price"/>
|
||||
<label name="amount"/>
|
||||
<field name="amount"/>
|
||||
<separator name="taxes" colspan="4"/>
|
||||
<field name="taxes" colspan="4"/>
|
||||
</page>
|
||||
<page string="Notes" id="notes">
|
||||
<separator name="note" colspan="4"/>
|
||||
<field name="note" colspan="4"
|
||||
spell="_parent_invoice.party_lang"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<field name="unit_digits" invisible="1" colspan="4"/>
|
||||
<field name="currency_digits" invisible="1" colspan="4"/>
|
||||
</form>
|
||||
|
||||
Reference in new issue
Block a user