summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorMantavya Gajjar <mga@tinyerp.com>2010-07-27 20:03:07 +0530
committerMantavya Gajjar <mga@tinyerp.com>2010-07-27 20:03:07 +0530
commit08855162c67d6df7d063e4069cbb2e533da4e38e (patch)
treed08862996ef07390a911688cda3aeb42c594e641 /addons
parentc79fba05924b98ed17bc8ae52bf0a9685e8e672c (diff)
[IMP]: improvement in to the account
* invoice * journal * account move * accout move lines bzr revid: mga@tinyerp.com-20100727143307-sz4f7tb86mkzfs8g
Diffstat (limited to 'addons')
-rw-r--r--addons/account/__openerp__.py2
-rw-r--r--addons/account/account.py18
-rw-r--r--addons/account/account_move_line.py2
-rw-r--r--addons/account/account_view.xml145
-rw-r--r--addons/account/invoice.py68
-rw-r--r--addons/account/wizard/__init__.py4
-rw-r--r--addons/account/wizard/account_move_line_select_view.xml24
7 files changed, 166 insertions, 97 deletions
diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index 187b803cf8b..1792177ed49 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -79,7 +79,7 @@ module named account_vouchers
'wizard/account_invoice_state_view.xml',
'wizard/account_partner_balance_report_view.xml',
'wizard/account_balance_report_view.xml',
- 'wizard/account_move_line_select_view.xml',
+# 'wizard/account_move_line_select_view.xml',
'wizard/account_aged_trial_balance_view.xml',
'wizard/account_compare_account_balance_report_view.xml',
'wizard/account_third_party_ledger.xml',
diff --git a/addons/account/account.py b/addons/account/account.py
index b01f659a70d..67abf8b4520 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -629,8 +629,8 @@ class account_journal(osv.osv):
'currency': fields.many2one('res.currency', 'Currency', help='The currency used to enter statement'),
'entry_posted': fields.boolean('Skip \'Draft\' State for Created Entries', help='Check this box if you don\'t want new account moves to pass through the \'draft\' state and instead goes directly to the \'posted state\' without any manual validation.'),
'company_id': fields.many2one('res.company', 'Company', required=True, select=1, help="Company related to this journal"),
- 'invoice_sequence_id': fields.many2one('ir.sequence', 'Invoice Sequence', \
- help="The sequence used for invoice numbers in this journal."),
+# 'invoice_sequence_id': fields.many2one('ir.sequence', 'Invoice Sequence', \
+# help="The sequence used for invoice numbers in this journal."),
'allow_date':fields.boolean('Check Date not in the Period', help= 'If set to True then do not accept the entry if the entry date is not into the period dates'),
}
@@ -695,13 +695,13 @@ class account_journal(osv.osv):
'sequence_id':seq_id
})
- if journal.type in journal_type and not journal.invoice_sequence_id:
- res_ids = date_pool.search(cr, uid, [('model','=','ir.sequence'), ('name','=',journal_seq.get(journal.type, 'sale'))])
- inv_seq_id = date_pool.browse(cr, uid, res_ids[0]).res_id
- inv_seq_id
- res.update({
- 'invoice_sequence_id':inv_seq_id
- })
+# if journal.type in journal_type and not journal.invoice_sequence_id:
+# res_ids = date_pool.search(cr, uid, [('model','=','ir.sequence'), ('name','=',journal_seq.get(journal.type, 'sale'))])
+# inv_seq_id = date_pool.browse(cr, uid, res_ids[0]).res_id
+# inv_seq_id
+# res.update({
+# 'invoice_sequence_id':inv_seq_id
+# })
result = self.write(cr, uid, [journal.id], res)
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 192b4dc7ff2..9dfb5fe1e6a 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -400,7 +400,7 @@ class account_move_line(osv.osv):
'credit': fields.float('Credit', digits_compute=dp.get_precision('Account')),
'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", domain=[('type','<>','view'), ('type', '<>', 'closed')], select=2),
'move_id': fields.many2one('account.move', 'Move', ondelete="cascade", states={'valid':[('readonly',True)]}, help="The move of this entry line.", select=2),
-
+ 'narration': fields.related('move_id','narration', type='text', relation='account.move', string='Narration'),
'ref': fields.char('Ref.', size=64),
'statement_id': fields.many2one('account.bank.statement', 'Statement', help="The bank statement used for bank reconciliation", select=1),
'reconcile_id': fields.many2one('account.move.reconcile', 'Reconcile', readonly=True, ondelete='set null', select=2),
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 77267fb18cc..8ae66ba34b7 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -395,15 +395,14 @@
<field name="centralisation" groups="base.group_extended"/>
<field name="entry_posted"/>
</group>
- <group colspan="2" col="2">
- <separator string="Invoicing Data" colspan="4"/>
- <field name="invoice_sequence_id" groups="base.group_extended"/>
- <field name="group_invoice_lines"/>
- </group>
<group colspan="2" col="2" groups="base.group_extended">
<separator string="Sequence" colspan="4"/>
<field name="sequence_id"/>
</group>
+ <group colspan="2" col="2">
+ <separator string="Invoicing Data" colspan="4"/>
+ <field name="group_invoice_lines"/>
+ </group>
</page>
<page string="Entry Controls" groups="base.group_extended">
<separator colspan="4" string="Accounts Type Allowed (empty for no control)"/>
@@ -977,7 +976,8 @@
<separator colspan="2" string="Analytic"/>
<field name="analytic_account_id"/>
</group>
-
+ <separator string="Narration" colspan="4"/>
+ <field name="narration" colspan="4" nolabel="1"/>
</page>
<page string="Analytic Lines">
<field colspan="4" name="analytic_lines" nolabel="1" context="{'default_general_account_id':account_id, 'default_name': name, 'default_date':date, 'amount': (debit or 0.0)-(credit or 0.0)}"/>
@@ -1055,22 +1055,27 @@
<search string="Search Entry Lines">
<group col='10' colspan='4'>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Entry Lines"/>
- <separator orientation="vertical"/>
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','valid')]" help="Posted Entry Lines"/>
- <filter icon="terp-stock_symbol-selection" string="Unposted" domain="[('move_id.state','=','draft')]" help="Unposted Entry Lines"/>
<separator orientation="vertical"/>
+ <filter icon="terp-stock_symbol-selection" string="Unposted" domain="[('move_id.state','=','draft')]" help="Unposted Entry Lines"/>
<filter icon="terp-stock_symbol-selection" string="Unreconciled" domain="[('reconcile_id','=',False), ('account_id.type','in',['receivable', 'payable'])]" help="Unreconciled Entry Lines"/>
- <field name="date" select='1'/>
+ <separator orientation="vertical"/>
+ <field name="ref" select="1" string="Reference"/>
+ <field name="move_id" select="1" string="Number (Move)"/>
+ <field name="name" select="1"/>
<field name="account_id" select='1'/>
<field name="partner_id" select='1'>
<filter help="Next Partner Entries to reconcile" name="next_partner" string="Next Partner to reconcile" context="{'next_partner_only': 1}" icon="terp-partner" domain="[('account_id.reconcile','=',True),('reconcile_id','=',False)]"/>
</field>
- <field name="balance" string="Debit/Credit" select='1'/>
</group>
<newline/>
<group col="10" colspan="4">
<field name="journal_id" required="1" widget="selection" context="{'journal_id':self, 'visible_id':self or 0, 'normal_view':False}"/>
<field name="period_id" required="1" widget="selection" context="{'period_id':self}"/>
+ <separator orientation="vertical"/>
+ <field name="narration" select="1"/>
+ <field name="date" select='1'/>
+ <field name="balance" string="Debit/Credit" select='1'/>
</group>
</search>
</field>
@@ -1096,6 +1101,23 @@
<field name="search_view_id" ref="view_account_move_line_filter"/>
</record>
+ <record id="action_move_line_select" model="ir.actions.act_window">
+ <field name="name">Journal Items</field>
+ <field name="res_model">account.move.line</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ <field name="view_id" ref="view_move_line_tree"/>
+ <field name="search_view_id" ref="view_account_move_line_filter"/>
+ <field name="domain">[('account_id', 'child_of', active_id)]</field>
+ </record>
+
+ <record id="ir_account_move_line_select" model="ir.values">
+ <field name="key2">tree_but_open</field>
+ <field name="model">account.account</field>
+ <field name="name">Open Journal Items</field>
+ <field eval="'ir.actions.act_window,%d'%action_move_line_select" name="value"/>
+ <field eval="True" name="object"/>
+ </record>
<!--
Account.Entry Edition
-->
@@ -1152,28 +1174,75 @@
<page string="Journal Entries Lines">
<field colspan="4" name="line_id" nolabel="1" height="250" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
<form string="Account Entry Line">
- <separator colspan="4" string="General Information"/>
- <field name="name" select="1"/>
- <field name="account_id" domain="[('journal_id','=',parent.journal_id)]"/>
- <field name="partner_id" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,parent.date,parent.journal_id)"/>
-
- <field name="debit" select="1"/>
- <field name="credit" select="1"/>
- <field name="date" select="1"/>
-
- <separator colspan="4" string="Optional Information"/>
- <field name="currency_id"/>
- <field name="amount_currency"/>
- <field name="quantity" select="1"/>
- <newline/>
- <field name="date_maturity"/>
- <field name="date_created"/>
-
- <separator colspan="4" string="State"/>
- <field name="reconcile_id"/>
- <field name="reconcile_partial_id"/>
- <field name="statement_id"/>
- <field name="state"/>
+ <group col="6" colspan="4">
+ <field name="name" select="1"/>
+ <field name="ref"/>
+ <field name="partner_id" select="1" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,date)"/>
+
+ <field name="journal_id"/>
+ <field name="period_id"/>
+ <field name="company_id" required="1" groups="base.group_multi_company"/>
+ </group>
+ <notebook colspan="4">
+ <page string="Information">
+ <group col="2" colspan="2">
+ <separator colspan="2" string="Amount"/>
+ <field name="account_id" select="1" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
+ <field name="debit"/>
+ <field name="credit"/>
+ <field name="quantity"/>
+ </group>
+
+ <group col="2" colspan="2">
+ <separator colspan="2" string="Accounting Documents"/>
+ <field name="invoice"/>
+ <field name="move_id" required="False"/>
+ <field name="statement_id"/>
+ </group>
+
+ <group col="2" colspan="2">
+ <separator colspan="2" string="Dates"/>
+ <field name="date" select="1"/>
+ <field name="date_maturity"/>
+ <field name="date_created"/>
+ </group>
+
+ <group col="2" colspan="2">
+ <separator colspan="2" string="Taxes"/>
+ <field name="tax_code_id"/>
+ <field name="tax_amount"/>
+ <field name="account_tax_id" domain="[('parent_id','=',False)]"/>
+ </group>
+
+ <group col="2" colspan="2">
+ <separator colspan="2" string="Currency"/>
+ <field name="currency_id"/>
+ <field name="amount_currency"/>
+ </group>
+
+ <group col="2" colspan="2">
+ <separator colspan="2" string="Reconciliation"/>
+ <field name="reconcile_id"/>
+ <field name="reconcile_partial_id"/>
+ </group>
+
+ <group col="2" colspan="2">
+ <separator colspan="2" string="States"/>
+ <field name="state"/>
+ <field name="blocked"/>
+ </group>
+
+ <group col="2" colspan="2">
+ <separator colspan="2" string="Analytic"/>
+ <field name="analytic_account_id"/>
+ </group>
+ <separator string="Narration" colspan="4"/>
+ <field name="narration" colspan="4" nolabel="1"/>
+ </page>
+ <page string="Analytic Lines">
+ <field colspan="4" name="analytic_lines" nolabel="1" context="{'default_general_account_id':account_id, 'default_name': name, 'default_date':date, 'amount': (debit or 0.0)-(credit or 0.0)}"/>
+ </page>
+ </notebook>
</form>
<tree colors="blue:state in ('draft');black:state in ('posted')" editable="top" string="Account Entry Line">
<field name="ref"/>
@@ -1217,11 +1286,13 @@
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Entries"/>
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Entries"/>
<separator orientation="vertical"/>
- <filter icon="terp-camera_test" string="To Review" domain="[('to_check','=',True)]" groups="base.group_extended" help="To Review"/>
+ <filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('to_check','=',True)]" groups="base.group_extended" help="To Review"/>
<separator orientation="vertical"/>
- <field name="date" select='1'/>
- <field name="name" select='1'/>
- <field name="partner_id" select='1'/>
+ <field name="ref" select="1"/>
+ <field name="name" select="1"/>
+ <field name="partner_id" select='1'/>
+ <field name="date" select='1'/>
+ <field name="narration" select="1"/>
</group>
<newline/>
<group col='8' colspan='4'>
@@ -1828,7 +1899,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_move_line_tax_tree"/>
- <field name="domain">[('tax_code_id','=',active_id),('state','&lt;&gt;','draft')]</field>
+ <field name="domain">[('tax_code_id','child_of',active_id),('state','&lt;&gt;','draft')]</field>
</record>
<record id="ir_open_tax_move_line" model="ir.values">
<field name="key2">tree_but_open</field>
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index 03e4b844b36..ef056e454a9 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -219,7 +219,7 @@ class account_invoice(osv.osv):
_name = "account.invoice"
_description = 'Invoice'
- _order = "number"
+ _order = "id"
_columns = {
'name': fields.char('Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}),
@@ -231,7 +231,8 @@ class account_invoice(osv.osv):
('in_refund','Supplier Refund'),
],'Type', readonly=True, select=True, change_default=True),
- 'number': fields.char('Invoice Number', size=32, readonly=True, help="Unique number of the invoice, computed automatically when the invoice is created."),
+ 'number': fields.related('move_id','name', type='char', readonly=True, size=64, relation='account.move', store=True, string='Number'),
+ #'number': fields.char('Invoice Number', size=32, readonly=True, help="Unique number of the invoice, computed automatically when the invoice is created."),
'reference': fields.char('Invoice Reference', size=64, help="The partner reference of this invoice."),
'reference_type': fields.selection(_get_reference_type, 'Reference Type',
required=True, readonly=True, states={'draft':[('readonly',False)]}),
@@ -768,8 +769,8 @@ class account_invoice(osv.osv):
cur_obj = self.pool.get('res.currency')
context = {}
for inv in self.browse(cr, uid, ids):
- if not inv.journal_id.invoice_sequence_id:
- raise osv.except_osv(_('Error !'), _('Please define invoice sequence on invoice journal'))
+ if not inv.journal_id.sequence_id:
+ raise osv.except_osv(_('Error !'), _('Please define sequence on invoice journal'))
if not inv.invoice_line:
raise osv.except_osv(_('No Invoice Lines !'), _('Please create some invoice lines.'))
if inv.move_id:
@@ -875,7 +876,14 @@ class account_invoice(osv.osv):
line = self.finalize_invoice_move_lines(cr, uid, inv, line)
- move = {'ref': inv.number, 'line_id': line, 'journal_id': journal_id, 'date': date, 'type': entry_type}
+ move = {
+ 'ref': inv.number,
+ 'line_id': line,
+ 'journal_id': journal_id,
+ 'date': date,
+ 'type': entry_type,
+ 'narration':inv.comment
+ }
period_id=inv.period_id and inv.period_id.id or False
if not period_id:
period_ids= self.pool.get('account.period').search(cr, uid, [('date_start','<=',inv.date_invoice or time.strftime('%Y-%m-%d')),('date_stop','>=',inv.date_invoice or time.strftime('%Y-%m-%d'))])
@@ -919,44 +927,32 @@ class account_invoice(osv.osv):
}
def action_number(self, cr, uid, ids, *args):
+ #TODO: not correct fix but required a frech values before reading it.
+ self.write(cr, uid, ids, {})
+
for obj_inv in self.browse(cr, uid, ids):
id = obj_inv.id
invtype = obj_inv.type
number = obj_inv.number
move_id = obj_inv.move_id and obj_inv.move_id.id or False
reference = obj_inv.reference or ''
- if not number:
- tmp_context = {
- 'fiscalyear_id': obj_inv.period_id.fiscalyear_id.id
- }
- if obj_inv.journal_id.invoice_sequence_id:
- sequence_id = obj_inv.journal_id.invoice_sequence_id.id
- number = self.pool.get('ir.sequence').get_id(cr, uid,
- sequence_id,
- 'id',
- context=tmp_context)
- else:
- number = self.pool.get('ir.sequence').get_id(cr, uid,
- 'account.invoice.%s' % invtype,
- 'code',
- context=tmp_context)
- if invtype in ('in_invoice', 'in_refund'):
- ref = reference
- else:
- ref = self._convert_ref(cr, uid, number)
- cr.execute('UPDATE account_invoice SET number=%s ' \
- 'WHERE id=%s', (number, id))
- cr.execute('UPDATE account_move SET ref=%s ' \
- 'WHERE id=%s AND (ref is null OR ref = \'\')',
- (ref, move_id))
- cr.execute('UPDATE account_move_line SET ref=%s ' \
- 'WHERE move_id=%s AND (ref is null OR ref = \'\')',
+
+ if invtype in ('in_invoice', 'in_refund'):
+ ref = reference
+ else:
+ ref = self._convert_ref(cr, uid, number)
+
+ cr.execute('UPDATE account_move SET ref=%s ' \
+ 'WHERE id=%s AND (ref is null OR ref = \'\')',
+ (ref, move_id))
+ cr.execute('UPDATE account_move_line SET ref=%s ' \
+ 'WHERE move_id=%s AND (ref is null OR ref = \'\')',
+ (ref, move_id))
+ cr.execute('UPDATE account_analytic_line SET ref=%s ' \
+ 'FROM account_move_line ' \
+ 'WHERE account_move_line.move_id = %s ' \
+ 'AND account_analytic_line.move_id = account_move_line.id',
(ref, move_id))
- cr.execute('UPDATE account_analytic_line SET ref=%s ' \
- 'FROM account_move_line ' \
- 'WHERE account_move_line.move_id = %s ' \
- 'AND account_analytic_line.move_id = account_move_line.id',
- (ref, move_id))
for inv_id, name in self.name_get(cr, uid, [id]):
message = _('Invoice ') + " '" + name + "' "+ _("is validated.")
self.log(cr, uid, inv_id, message)
diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py
index 1dea8e8d4f3..3f6bd126251 100644
--- a/addons/account/wizard/__init__.py
+++ b/addons/account/wizard/__init__.py
@@ -45,7 +45,9 @@ import account_open_closed_fiscalyear
import account_compare_account_balance_report
import account_invoice_state
import account_chart
-import account_move_line_select
+#TODO: remove this file no moe used
+# also remove related view fiel
+#import account_move_line_select
import account_validate_account_move
import account_use_model
diff --git a/addons/account/wizard/account_move_line_select_view.xml b/addons/account/wizard/account_move_line_select_view.xml
index bf3831baea0..8c462318271 100644
--- a/addons/account/wizard/account_move_line_select_view.xml
+++ b/addons/account/wizard/account_move_line_select_view.xml
@@ -7,12 +7,12 @@
<field name="model">account.move.line.select</field>
<field name="type">form</field>
<field name="arch" type="xml">
- <form string="Account Select">
- <label string="Are you sure you want to open Account move line entries!" colspan="4"/>
- <separator string="" colspan="4" />
+ <form string="Account Select">
+ <label string="Are you sure you want to open Account move line entries!" colspan="4"/>
+ <separator string="" colspan="4" />
<group colspan="4" col="6">
- <button icon="terp-gtk-stop" special="cancel" string="Cancel"/>
- <button icon="terp-gtk-go-back-rtl" string="Open Entries" name="open_window" type="object" default_focus="1"/>
+ <button icon="terp-gtk-stop" special="cancel" string="Cancel"/>
+ <button icon="terp-gtk-go-back-rtl" string="Open Entries" name="open_window" type="object" default_focus="1"/>
</group>
</form>
</field>
@@ -27,13 +27,13 @@
<field name="target">new</field>
</record>
- <record id="ir_account_move_line_select" model="ir.values">
- <field name="key2">tree_but_open</field>
- <field name="model">account.account</field>
- <field name="name">Open Account</field>
- <field eval="'ir.actions.act_window,%d'%action_account_move_line_select_button" name="value"/>
- <field eval="True" name="object"/>
- </record>
+<!-- <record id="ir_account_move_line_select" model="ir.values">-->
+<!-- <field name="key2">tree_but_open</field>-->
+<!-- <field name="model">account.account</field>-->
+<!-- <field name="name">Open Account</field>-->
+<!-- <field eval="'ir.actions.act_window,%d'%action_account_move_line_select_button" name="value"/>-->
+<!-- <field eval="True" name="object"/>-->
+<!-- </record>-->
</data>
</openerp>