[MERGE]: lp:trunk-dev-addons2

bzr revid: rvo@tinyerp.co.in-20100915065845-dpo6qn1xyx6pjq3c
This commit is contained in:
Rvo (Open ERP) 2010-09-15 12:28:45 +05:30
commit cd26d7bf6b
49 changed files with 693 additions and 667 deletions

View File

@ -29,6 +29,25 @@ import decimal_precision as dp
class account_bank_statement(osv.osv):
def create(self, cr, uid, vals, context=None):
seq = 0
if 'line_ids' in vals:
for line in vals['line_ids']:
seq += 1
line[2]['sequence'] = seq
vals[seq - 1] = line
return super(account_bank_statement, self).create(cr, uid, vals, context=context)
def write(self, cr, uid, ids, vals, context=None):
res = super(account_bank_statement, self).write(cr, uid, ids, vals, context=context)
for statement in self.browse(cr, uid, ids, context):
seq = 0
for line in statement.line_ids:
seq += 1
if not line.sequence:
self.pool.get('account.bank.statement.line').write(cr, uid, [line.id], {'sequence': seq}, context=context)
return res
def button_import_invoice(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
if context is None:
@ -141,7 +160,7 @@ class account_bank_statement(osv.osv):
'balance_end_real': fields.float('Ending Balance', digits_compute=dp.get_precision('Account'),
states={'confirm':[('readonly', True)]}),
'balance_end': fields.function(_end_balance, method=True, string='Balance'),
'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, required=True),
'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
'line_ids': fields.one2many('account.bank.statement.line',
'statement_id', 'Statement lines',
states={'confirm':[('readonly', True)]}),
@ -711,13 +730,12 @@ class account_bank_statement_line(osv.osv):
'reconcile_amount': fields.function(_reconcile_amount,
string='Amount reconciled', method=True, type='float'),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of bank statement lines."),
'company_id': fields.related('statement_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, required=True),
'company_id': fields.related('statement_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True),
}
_defaults = {
'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'),
'date': lambda *a: time.strftime('%Y-%m-%d'),
'type': lambda *a: 'general',
'sequence': lambda *a: 10,
}
account_bank_statement_line()

View File

@ -204,7 +204,6 @@ class account_cash_statement(osv.osv):
return res
_columns = {
'company_id':fields.many2one('res.company', 'Company', required=True, states={'draft': [('readonly', False)]}, readonly=True,),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'draft': [('readonly', False)]}, readonly=True, domain=[('type', '=', 'cash')]),
'balance_end_real': fields.float('Closing Balance', digits_compute=dp.get_precision('Account'), states={'confirm':[('readonly', True)]}, help="closing balance entered by the cashbox verifier"),
'state': fields.selection(
@ -224,22 +223,18 @@ class account_cash_statement(osv.osv):
'state': lambda *a: 'draft',
'date': lambda *a:time.strftime("%Y-%m-%d %H:%M:%S"),
'user_id': lambda self, cr, uid, context=None: uid,
'company_id': _get_company,
'starting_details_ids':_get_cash_open_box_lines,
'ending_details_ids':_get_default_cash_close_box_lines
}
def create(self, cr, uid, vals, context=None):
company_id = vals and vals.get('company_id',False)
if company_id:
sql = [
('company_id', '=', vals['company_id']),
sql = [
('journal_id', '=', vals['journal_id']),
('state', '=', 'open')
]
open_jrnl = self.search(cr, uid, sql)
if open_jrnl:
raise osv.except_osv('Error', _('You can not have two open register for the same journal'))
]
open_jrnl = self.search(cr, uid, sql)
if open_jrnl:
raise osv.except_osv('Error', _('You can not have two open register for the same journal'))
if self.pool.get('account.journal').browse(cr, uid, vals['journal_id']).type == 'cash':
lines = end_lines = self._get_cash_close_box_lines(cr, uid, [], context)

View File

@ -14,7 +14,7 @@
<attribute name="string">Configure Your Accounting Chart</attribute>
</separator>
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">Configure your accounting system. By default, Chart of Account is matching to your country. If there are not chart of account certified for your county, you can install the generic chart of account.</attribute>
<attribute name="string">The default Chart of Accounts is matching your country selection. If no certified Chart of Accounts exists for your specified country, a generic one can be installed and will be selected by default.</attribute>
</xpath>
<xpath expr="//button[@string='Install Modules']" position="attributes">
<attribute name="string">Configure</attribute>
@ -73,7 +73,7 @@
</separator>
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">From this screen, you can install Other Addons in your accounting Application. Select the Addons to directly install them. If you do not think you need any of these right now, you can easily install them later.</attribute>
<attribute name="string">Add extra Accounting Addons to the ones already installed. Remember you can always install them at a later stage.</attribute>
</xpath>
<xpath expr="//button[@string='Install Modules']" position="attributes">
<attribute name="string">Configure</attribute>

View File

@ -1117,7 +1117,6 @@ class account_move_line(osv.osv):
context['period_id'] = m.period_id.id
self._update_journal_check(cr, uid, context['journal_id'], context['period_id'], context)
company_currency = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id
move_id = vals.get('move_id', False)
journal = self.pool.get('account.journal').browse(cr, uid, context['journal_id'])
is_new_move = False
@ -1156,7 +1155,10 @@ class account_move_line(osv.osv):
if a.id == vals['account_id']:
ok = True
break
if (account.currency_id) and 'amount_currency' not in vals and account.currency_id.id <> company_currency:
# Automatically convert in the account's secondary currency if there is one and
# the provided values were not already multi-currency
if account.currency_id and 'amount_currency' not in vals and account.currency_id.id != account.company_id.currency_id.id:
vals['currency_id'] = account.currency_id.id
cur_obj = self.pool.get('res.currency')
ctx = {}

View File

@ -524,15 +524,15 @@
<page string="Transaction">
<field colspan="4" name="line_ids" nolabel="1">
<tree editable="bottom" string="Statement lines">
<field name="sequence"/>
<field name="sequence" readonly="1"/>
<field name="date"/>
<field name="ref"/>
<field name="name"/>
<field name="type"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency, {'amount': amount})"/>
<field domain="[('journal_id','=',parent.journal_id)]" name="account_id"/>
<field name="analytic_account_id" groups="base.group_extended"/>
<field name="amount"/>
<field name="analytic_account_id"/>
<field context="{'partner_id': partner_id, 'amount': amount, 'account_id': account_id, 'currency_id': parent.currency, 'journal_id': parent.journal_id, 'date':date}" name="reconcile_id"/>
<field invisible="1" name="reconcile_amount"/>
</tree>
@ -546,7 +546,7 @@
<field name="amount"/>
<field context="{'partner_id':partner_id,'amount':amount,'account_id':account_id,'currency_id': parent.currency,'journal_id':parent.journal_id, 'date':date}" name="reconcile_id"/>
<field name="ref"/>
<field name="sequence"/>
<field name="sequence" readonly="0"/>
<separator colspan="4" string="Notes"/>
<field colspan="4" name="note" nolabel="1"/>
</form>

View File

@ -69,19 +69,19 @@ class account_balance(report_sxw.rml_parse, common_report_header):
return super(account_balance ,self)._get_account(data)
def lines(self, form, ids=[], done=None):#, level=1):
def _process_child(accounts,disp_acc,parent):
def _process_child(accounts, disp_acc, parent):
account_rec = [acct for acct in accounts if acct['id']==parent][0]
res = {
'id': account_rec['id'],
'type': account_rec['type'],
'type': account_rec['type'],
'code': account_rec['code'],
'name': account_rec['name'],
'level': account_rec['level'],
'debit': account_rec['debit'],
'credit': account_rec['credit'],
'balance': account_rec['balance'],
'parent_id':account_rec['parent_id'],
'bal_type':'',
'parent_id': account_rec['parent_id'],
'bal_type': '',
}
self.sum_debit += account_rec['debit']
self.sum_credit += account_rec['credit']
@ -96,7 +96,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
if account_rec['child_id']:
for child in account_rec['child_id']:
_process_child(accounts,disp_acc,child)
obj_account = self.pool.get('account.account')
if not ids:
ids = self.ids
@ -113,6 +113,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
elif form['filter'] == 'filter_date':
ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to']
ctx['state'] = form['target_move']
parents = ids
child_ids = obj_account._get_children_and_consol(self.cr, self.uid, ids, ctx)
if child_ids:

View File

@ -40,6 +40,9 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
new_ids = ids
self.sortby = data['form'].get('sortby', 'sort_date')
self.query = data['form'].get('query_line', '')
self.init_query = data['form']['initial_bal_query']
self.init_balance = data['form']['initial_balance']
self.display_account = data['form']['display_account']
if (data['model'] == 'ir.ui.menu'):
new_ids = [data['form']['chart_account_id']]
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
@ -79,10 +82,10 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s" %(account.id, self.query))
sum_currency = self.cr.fetchone()[0] or 0.0
if form.get('initial_balance', False):
if self.init_balance:
self.cr.execute("SELECT sum(l.amount_currency) AS tot_currency "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s "%(account.id, form['initial_bal_query']))
"WHERE l.account_id = %s AND %s "%(account.id, self.init_query))
sum_currency += self.cr.fetchone()[0] or 0.0
return str(sum_currency)
@ -99,10 +102,10 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
num_entry = self.cr.fetchone()[0] or 0
sold_account = self._sum_balance_account(child_account,form)
self.sold_accounts[child_account.id] = sold_account
if form['display_account'] == 'bal_movement':
if self.display_account == 'bal_movement':
if child_account.type != 'view' and num_entry <> 0 :
res.append(child_account)
elif form['display_account'] == 'bal_solde':
elif self.display_account == 'bal_solde':
if child_account.type != 'view' and num_entry <> 0 :
if ( sold_account <> 0.0):
res.append(child_account)
@ -150,7 +153,7 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
self.cr.execute(sql, (account.id,))
res_lines = self.cr.dictfetchall()
res_init = []
if res_lines and form['initial_balance']:
if res_lines and self.init_balance:
#FIXME: replace the label of lname with a string translatable
sql = """
SELECT 0 AS lid, '' AS ldate, '' AS lcode, COALESCE(SUM(l.amount_currency),0.0) AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id,
@ -165,7 +168,7 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
LEFT JOIN account_invoice i on (m.id =i.move_id)
JOIN account_journal j on (l.journal_id=j.id)
WHERE %s AND l.account_id = %%s
""" %(form['initial_bal_query'])
""" %(self.init_query)
self.cr.execute(sql, (account.id,))
res_init = self.cr.dictfetchall()
@ -193,10 +196,10 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s "%(account.id, self.query))
sum_debit = self.cr.fetchone()[0] or 0.0
if form.get('initial_balance', False):
if self.init_balance:
self.cr.execute("SELECT sum(debit) "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s "%(account.id, form['initial_bal_query']))
"WHERE l.account_id = %s AND %s "%(account.id, self.init_query))
# Add initial balance to the result
sum_debit += self.cr.fetchone()[0] or 0.0
return sum_debit
@ -206,10 +209,10 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s "%(account.id, self.query))
sum_credit = self.cr.fetchone()[0] or 0.0
if form.get('initial_balance', False):
if self.init_balance:
self.cr.execute("SELECT sum(credit) "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s "%(account.id, form['initial_bal_query']))
"WHERE l.account_id = %s AND %s "%(account.id, self.init_query))
# Add initial balance to the result
sum_credit += self.cr.fetchone()[0] or 0.0
return sum_credit
@ -219,10 +222,10 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s"%(account.id, self.query))
sum_balance = self.cr.fetchone()[0] or 0.0
if form.get('initial_balance', False):
if self.init_balance:
self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_balance "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s "%(account.id, form['initial_bal_query']))
"WHERE l.account_id = %s AND %s "%(account.id, self.init_query))
# Add initial balance to the result
sum_balance += self.cr.fetchone()[0] or 0.0
return sum_balance

View File

@ -99,12 +99,12 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
def set_context(self, objects, data, ids, report_type=None):
## Compute Code
#
self.initial_balance = data['form'].get('initial_balance', True)
self.display_partner = data['form'].get('display_partner', 'non-zero_balance')
# self.initial_balance = data['form'].get('initial_balance', True)
self.display_partner = data['form'].get('display_partner', 'non-zero_balance')
self.query = data['form'].get('query_line', '')
self.init_query = data['form'].get('initial_bal_query', '')
self.result_selection = data['form'].get('result_selection')
if (self.result_selection == 'customer' ):
self.ACCOUNT_TYPE = ('receivable',)
elif (self.result_selection == 'supplier'):
@ -150,81 +150,81 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
res = self.cr.dictfetchall()
#For include intial balance..
if self.initial_balance:
self.cr.execute(
"SELECT '1' AS type, '' AS ref, l.account_id AS account_id, '' AS account_name, '' AS code, '' AS name, sum(debit) AS debit, sum(credit) AS credit, " \
"CASE WHEN sum(debit) > sum(credit) " \
"THEN sum(debit) - sum(credit) " \
"ELSE 0 " \
"END AS sdebit, " \
"CASE WHEN sum(debit) < sum(credit) " \
"THEN sum(credit) - sum(debit) " \
"ELSE 0 " \
"END AS scredit, " \
"(SELECT sum(debit-credit) " \
"FROM account_move_line l " \
"WHERE partner_id = p.id " \
" AND " + self.init_query + " " \
"AND blocked = TRUE " \
") AS enlitige " \
"FROM account_move_line l LEFT JOIN res_partner p ON (l.partner_id=p.id) " \
"JOIN account_account ac ON (l.account_id = ac.id) " \
"WHERE ac.type IN %s " \
"AND " + self.init_query + "" \
"GROUP BY p.id, p.ref, p.name,l.account_id,ac.name,ac.code " \
"ORDER BY l.account_id, p.name",
(self.ACCOUNT_TYPE, ))
res1 = self.cr.dictfetchall()
final_init = {}
res_init = {}
debit = credit = 0
for r in res1:
if final_init.get(r['account_id'], False):
res_init = final_init[r['account_id']]
debit += final_init[r['account_id']]['debit']
credit += final_init[r['account_id']]['credit']
res_init['credit'] = credit
res_init['debit'] = debit
res_init['type'] = 3
res_init['ref'] = ''
res_init['code'] = ''
res_init['name'] = 'Initial Balance'
res_init['balance'] = debit - credit
res_init['enlitige'] = 0.0 # fix me
res_init['account_id'] = final_init[r['account_id']]['account_id']
else:
res_init = {}
debit = r['debit']
credit = r['credit']
res_init['credit'] = credit
res_init['debit'] = debit
res_init['type'] = 3
res_init['ref'] = ''
res_init['code'] = ''
res_init['name'] = 'Initial Balance'
res_init['balance'] = debit - credit
res_init['enlitige'] = 0.0 # fix me
res_init['account_id'] = r['account_id']
final_init[r['account_id']] = res_init
# if self.initial_balance:
# self.cr.execute(
# "SELECT '1' AS type, '' AS ref, l.account_id AS account_id, '' AS account_name, '' AS code, '' AS name, sum(debit) AS debit, sum(credit) AS credit, " \
# "CASE WHEN sum(debit) > sum(credit) " \
# "THEN sum(debit) - sum(credit) " \
# "ELSE 0 " \
# "END AS sdebit, " \
# "CASE WHEN sum(debit) < sum(credit) " \
# "THEN sum(credit) - sum(debit) " \
# "ELSE 0 " \
# "END AS scredit, " \
# "(SELECT sum(debit-credit) " \
# "FROM account_move_line l " \
# "WHERE partner_id = p.id " \
# " AND " + self.init_query + " " \
# "AND blocked = TRUE " \
# ") AS enlitige " \
# "FROM account_move_line l LEFT JOIN res_partner p ON (l.partner_id=p.id) " \
# "JOIN account_account ac ON (l.account_id = ac.id) " \
# "WHERE ac.type IN %s " \
# "AND " + self.init_query + "" \
# "GROUP BY p.id, p.ref, p.name,l.account_id,ac.name,ac.code " \
# "ORDER BY l.account_id, p.name",
# (self.ACCOUNT_TYPE, ))
# res1 = self.cr.dictfetchall()
# final_init = {}
# res_init = {}
# debit = credit = 0
# for r in res1:
# if final_init.get(r['account_id'], False):
# res_init = final_init[r['account_id']]
# debit += final_init[r['account_id']]['debit']
# credit += final_init[r['account_id']]['credit']
# res_init['credit'] = credit
# res_init['debit'] = debit
# res_init['type'] = 3
# res_init['ref'] = ''
# res_init['code'] = ''
# res_init['name'] = 'Initial Balance'
# res_init['balance'] = debit - credit
# res_init['enlitige'] = 0.0 # fix me
# res_init['account_id'] = final_init[r['account_id']]['account_id']
# else:
# res_init = {}
# debit = r['debit']
# credit = r['credit']
# res_init['credit'] = credit
# res_init['debit'] = debit
# res_init['type'] = 3
# res_init['ref'] = ''
# res_init['code'] = ''
# res_init['name'] = 'Initial Balance'
# res_init['balance'] = debit - credit
# res_init['enlitige'] = 0.0 # fix me
# res_init['account_id'] = r['account_id']
# final_init[r['account_id']] = res_init
if self.display_partner == 'non-zero_balance':
full_account = [r for r in res if r['sdebit'] > 0 or r['scredit'] > 0]
else:
full_account = [r for r in res]
## We will now compute Total
subtotal_row = self._add_subtotal(full_account)
if not self.initial_balance:
return subtotal_row
#If include initial balance is selected..
subtotal = copy.deepcopy(subtotal_row)
init_acnt = []
for row in subtotal_row:
if final_init and row.get('account_id', False) and not row['account_id'] in init_acnt and final_init.get(row['account_id'], False):
subtotal.insert(subtotal.index(row), final_init[row['account_id']])
init_acnt.append(row['account_id'])
return subtotal
# if not self.initial_balance:
# return subtotal_row
#
# #If include initial balance is selected..
# subtotal = copy.deepcopy(subtotal_row)
# init_acnt = []
# for row in subtotal_row:
# if final_init and row.get('account_id', False) and not row['account_id'] in init_acnt and final_init.get(row['account_id'], False):
# subtotal.insert(subtotal.index(row), final_init[row['account_id']])
# init_acnt.append(row['account_id'])
return subtotal_row
def _add_subtotal(self, cleanarray):
i = 0
@ -354,14 +354,14 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
"AND " + self.query + "" ,
(tuple(self.account_ids), ))
temp_res = float(self.cr.fetchone()[0] or 0.0)
if self.initial_balance:
self.cr.execute(
"SELECT sum(debit) " \
"FROM account_move_line AS l " \
"WHERE l.account_id IN %s " \
"AND " + self.init_query + "" ,
(tuple(self.account_ids), ))
temp_res += float(self.cr.fetchone()[0] or 0.0)
# if self.initial_balance:
# self.cr.execute(
# "SELECT sum(debit) " \
# "FROM account_move_line AS l " \
# "WHERE l.account_id IN %s " \
# "AND " + self.init_query + "" ,
# (tuple(self.account_ids), ))
# temp_res += float(self.cr.fetchone()[0] or 0.0)
return temp_res
def _sum_credit(self):
@ -375,14 +375,14 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
"AND " + self.query + "" ,
(tuple(self.account_ids),))
temp_res = float(self.cr.fetchone()[0] or 0.0)
if self.initial_balance:
self.cr.execute(
"SELECT sum(credit) " \
"FROM account_move_line AS l " \
"WHERE l.account_id IN %s " \
"AND " + self.init_query + "" ,
(tuple(self.account_ids),))
temp_res += float(self.cr.fetchone()[0] or 0.0)
# if self.initial_balance:
# self.cr.execute(
# "SELECT sum(credit) " \
# "FROM account_move_line AS l " \
# "WHERE l.account_id IN %s " \
# "AND " + self.init_query + "" ,
# (tuple(self.account_ids),))
# temp_res += float(self.cr.fetchone()[0] or 0.0)
return temp_res
def _sum_litige(self):
@ -397,15 +397,15 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
"AND l.blocked=TRUE ",
(tuple(self.account_ids), ))
temp_res = float(self.cr.fetchone()[0] or 0.0)
if self.initial_balance:
self.cr.execute(
"SELECT sum(debit-credit) " \
"FROM account_move_line AS l " \
"WHERE l.account_id IN %s " \
"AND l.blocked=TRUE "\
"AND " + self.init_query + "" ,
(tuple(self.account_ids), ))
temp_res += float(self.cr.fetchone()[0] or 0.0)
# if self.initial_balance:
# self.cr.execute(
# "SELECT sum(debit-credit) " \
# "FROM account_move_line AS l " \
# "WHERE l.account_id IN %s " \
# "AND l.blocked=TRUE "\
# "AND " + self.init_query + "" ,
# (tuple(self.account_ids), ))
# temp_res += float(self.cr.fetchone()[0] or 0.0)
return temp_res
def _sum_sdebit(self):

View File

@ -198,3 +198,8 @@
"access_account_analytic_line_accounting_accountant","account.analytic.line","analytic.model_account_analytic_line","account.group_accounting_accountant",1,0,0,0
"access_account_analytic_journal_accounting_accountant","account.analytic.journal","model_account_analytic_journal","account.group_accounting_accountant",1,0,0,0
"access_account_bank_statement_reconcile_accounting_accountant","account.bank.statement.reconcile","model_account_bank_statement_reconcile","account.group_accounting_accountant",1,1,1,1
"access_account_analytic_journal_analytic_accounting","account.analytic.journal","model_account_analytic_journal","analytic.group_analytic_accounting",1,1,1,1
"access_account_account_analytic_accounting","account.account","model_account_account","analytic.group_analytic_accounting",1,0,0,0
"access_product_product_analytic_accounting","product.product","product.model_product_product","analytic.group_analytic_accounting",1,0,0,0
"access_product_category_analytic_accounting","product.category","product.model_product_category","analytic.group_analytic_accounting",1,0,0,0
"access_product_template_analytic_accounting","product.template","product.model_product_template","analytic.group_analytic_accounting",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
198 access_account_analytic_line_accounting_accountant account.analytic.line analytic.model_account_analytic_line account.group_accounting_accountant 1 0 0 0
199 access_account_analytic_journal_accounting_accountant account.analytic.journal model_account_analytic_journal account.group_accounting_accountant 1 0 0 0
200 access_account_bank_statement_reconcile_accounting_accountant account.bank.statement.reconcile model_account_bank_statement_reconcile account.group_accounting_accountant 1 1 1 1
201 access_account_analytic_journal_analytic_accounting account.analytic.journal model_account_analytic_journal analytic.group_analytic_accounting 1 1 1 1
202 access_account_account_analytic_accounting account.account model_account_account analytic.group_analytic_accounting 1 0 0 0
203 access_product_product_analytic_accounting product.product product.model_product_product analytic.group_analytic_accounting 1 0 0 0
204 access_product_category_analytic_accounting product.category product.model_product_category analytic.group_analytic_accounting 1 0 0 0
205 access_product_template_analytic_accounting product.template product.model_product_template analytic.group_analytic_accounting 1 0 0 0

View File

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from osv import fields, osv
from tools.translate import _
@ -29,16 +29,55 @@ class account_chart(osv.osv_memory):
_name = "account.chart"
_description = "Account chart"
_columns = {
'fiscalyear': fields.many2one('account.fiscalyear', \
'fiscalyear': fields.many2one('account.fiscalyear', \
'Fiscal year', \
help = 'Keep empty for all open fiscal years'),
'target_move': fields.selection([('all', 'All Entries'),
'period_from': fields.many2one('account.period', 'Start period'),
'period_to': fields.many2one('account.period', 'End period'),
'target_move': fields.selection([('all', 'All Entries'),
('posted', 'All Posted Entries')], 'Target Moves', required = True),
}
def _get_fiscalyear(self, cr, uid, context=None):
"""Return default Fiscalyear value"""
return self.pool.get('account.fiscalyear').find(cr, uid)
now = time.strftime('%Y-%m-%d')
fiscalyears = self.pool.get('account.fiscalyear').search(cr, uid, [('date_start', '<', now), ('date_stop', '>', now)], limit=1 )
return fiscalyears and fiscalyears[0] or False
def _build_periods(self, cr, uid, period_from, period_to):
period_obj = self.pool.get('account.period')
period_date_start = period_obj.read(cr, uid, period_from, ['date_start'])['date_start']
period_date_stop = period_obj.read(cr, uid, period_to, ['date_stop'])['date_stop']
if period_date_start > period_date_stop:
raise osv.except_osv(_('Error'),_('Start period should be smaller then End period'))
return period_obj.search(cr, uid, [('date_start', '>=', period_date_start), ('date_stop', '<=', period_date_stop)])
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear_id=False, context=None):
res = {}
res['value'] = {'period_from': False, 'period_to': False}
if fiscalyear_id:
start_period = end_period = False
cr.execute('''
SELECT * FROM (SELECT p.id
FROM account_period p
LEFT JOIN account_fiscalyear f ON (p.fiscalyear_id = f.id)
WHERE f.id = %s
ORDER BY p.date_start ASC
LIMIT 1) AS period_start
UNION
SELECT * FROM (SELECT p.id
FROM account_period p
LEFT JOIN account_fiscalyear f ON (p.fiscalyear_id = f.id)
WHERE f.id = %s
AND p.date_start < NOW()
ORDER BY p.date_stop DESC
LIMIT 1) AS period_stop''', (fiscalyear_id, fiscalyear_id))
periods = [i[0] for i in cr.fetchall()]
if periods and len(periods) > 1:
start_period = periods[0]
end_period = periods[1]
res['value'] = {'period_from': start_period, 'period_to': end_period}
return res
def account_chart_open_window(self, cr, uid, ids, context=None):
"""
@ -56,7 +95,10 @@ class account_chart(osv.osv_memory):
result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id']
result = act_obj.read(cr, uid, [id], context=context)[0]
result['context'] = str({'fiscalyear': data['fiscalyear'], \
result['periods'] = []
if data['period_from'] and data['period_to']:
result['periods'] = self._build_periods(cr, uid, data['period_from'], data['period_to'])
result['context'] = str({'fiscalyear': data['fiscalyear'], 'periods': result['periods'], \
'state': data['target_move']})
if data['fiscalyear']:
result['name'] += ':' + self.pool.get('account.fiscalyear').read(cr, uid, [data['fiscalyear']], context=context)[0]['code']

View File

@ -7,16 +7,18 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account charts">
<group colspan="4" >
<field name="fiscalyear"/>
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
<group colspan="4">
<field name="fiscalyear" on_change="onchange_fiscalyear(fiscalyear)"/>
<label align="0.7" colspan="4" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
<separator string="Periods" colspan="4"/>
<field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear)]"/>
<field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear)]"/>
<field name="target_move"/>
</group>
<separator string="" colspan="4" />
<separator string="" colspan="4"/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button icon="gtk-cancel" special="cancel" string="Cancel" />
<button icon="terp-gtk-go-back-rtl" string="Open Charts" name="account_chart_open_window" type="object" />
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="terp-gtk-go-back-rtl" string="Open Charts" name="account_chart_open_window" type="object"/>
</group>
</form>
</field>

View File

@ -21,15 +21,21 @@
from lxml import etree
from osv import osv
from osv import osv, fields
class account_balance_report(osv.osv_memory):
_inherit = "account.common.account.report"
_name = 'account.balance.report'
_description = 'Account Balance Report'
_columns = {
'target_move': fields.selection([('all', 'All Entries'),
('posted', 'All Posted Entries')], 'Target Moves', required=True),
}
_defaults = {
'journal_ids': [],
'target_move': 'all'
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
@ -45,6 +51,7 @@ class account_balance_report(osv.osv_memory):
def _print_report(self, cr, uid, ids, data, query_line, context=None):
data = self.pre_print_report(cr, uid, ids, data, query_line, context=context)
data['form'].update(self.read(cr, uid, ids, ['target_move'])[0])
return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance', 'datas': data}
account_balance_report()

View File

@ -11,6 +11,7 @@
<field name="arch" type="xml">
<field name="fiscalyear_id" position="after">
<field name="display_account"/>
<field name="target_move"/>
<newline/>
</field>
</field>

View File

@ -37,7 +37,7 @@ class account_report_general_ledger(osv.osv_memory):
'landscape': True,
'amount_currency': True,
'sortby': 'sort_date',
'initial_balance': True,
'initial_balance': False,
}
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False, context=None):

View File

@ -29,13 +29,13 @@ class account_partner_balance(osv.osv_memory):
_name = 'account.partner.balance'
_description = 'Print Account Partner Balance'
_columns = {
'initial_balance': fields.boolean('Include Initial Balances'
,help='It adds initial balance row on report which display previous sum amount of debit/credit/balance'),
# 'initial_balance': fields.boolean('Include Initial Balances'
# ,help='It adds initial balance row on report which display previous sum amount of debit/credit/balance'),
'display_partner': fields.selection([('non-zero_balance', 'With balance is not equal to 0'), ('all', 'All Partners')]
,'Display Partners')
}
_defaults = {
'initial_balance': True,
# 'initial_balance': True,
'display_partner': 'non-zero_balance'
}
@ -43,7 +43,7 @@ class account_partner_balance(osv.osv_memory):
if context is None:
context = {}
data = self.pre_print_report(cr, uid, ids, data, query_line, context=context)
data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'display_partner'])[0])
data['form'].update(self.read(cr, uid, ids, ['display_partner'])[0])
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.partner.balance',

View File

@ -10,7 +10,7 @@
<field name="arch" type="xml">
<field name="fiscalyear_id" position="after">
<field name="result_selection"/>
<field name="initial_balance"/>
<!-- <field name="initial_balance"/> -->
<field name="display_partner"/>
<newline/>
</field>

View File

@ -7,7 +7,7 @@
<field name="type">form</field>
<field name="inherit_id" ref="account.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page/field[@name='property_account_expense']" position="after">
<xpath expr="/form/notebook/page/group/field[@name='property_account_expense']" position="after">
<field name="property_account_creditor_price_difference" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
<newline/>
</xpath>

View File

@ -41,7 +41,6 @@
"voucher_sequence.xml",
"voucher_workflow.xml",
"voucher_report.xml",
"wizard/account_voucher_open_view.xml",
"wizard/account_voucher_unreconcile_view.xml",
"voucher_view.xml",
"voucher_payment_receipt_view.xml",
@ -53,7 +52,6 @@
"test/sales_receipt.yml",
"test/sales_payment.yml",
],
'certificate': '0037580727101',
"active": False,
"installable": True,

View File

@ -54,7 +54,7 @@ class report_voucher(report_sxw.rml_parse):
voucher_line = self.pool.get('account.voucher.line').search(self.cr, self.uid, [('partner_id','=',move_ids.partner_id.id), ('voucher_id','=',voucher_id)])
if voucher_line:
voucher = self.pool.get('account.voucher.line').browse(self.cr, self.uid, voucher_line)[0]
return voucher.ref
return voucher.name
else:
return
report_sxw.report_sxw(

View File

@ -154,7 +154,7 @@
<images/>
</stylesheet>
<story>
<para style="P8">[[ repeatIn(objects,'voucher') ]]</para>
<para style="P8">[[ repeatIn(objects,'voucher') ]]</para>ref
<para style="terp_default_8">
<font color="white"> </font>
</para>
@ -167,7 +167,7 @@
<para style="terp_tblheader_Details">Journal:</para>
</td>
<td>
<para style="terp_default_9">[[ voucher.type ]]</para>
<para style="terp_default_9">[[ voucher.journal_id.name ]]</para>
</td>
<td>
<para style="terp_default_Bold_9">Number:</para>
@ -252,7 +252,7 @@
</tr>
<tr>
<td>
<para style="terp_default_8_Italic">[[ move_ids.name ]] - [[ get_ref(voucher.id,move_ids) ]]</para>
<para style="terp_default_8_Italic">[[ move_ids.name ]] - [[ voucher.reference or '' ]]</para>
</td>
<td>
<para style="terp_default_9_50">

View File

@ -122,7 +122,7 @@ class account_voucher(osv.osv):
\n* The \'Cancelled\' state is used when user cancel voucher.'),
'amount': fields.float('Total', digits=(16, 2), required=True, readonly=True, states={'draft':[('readonly',False)]}),
'tax_amount':fields.float('Tax Amount', digits=(14,2), readonly=True, states={'draft':[('readonly',False)]}),
'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)]}, help="Transaction referance number."),
'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)]}, help="Transaction reference number."),
'number': fields.related('move_id', 'name', type="char", readonly=True, string='Number'),
'move_id':fields.many2one('account.move', 'Account Entry'),
'move_ids': fields.related('move_id','line_id', type='many2many', relation='account.move.line', string='Journal Items', readonly=True),
@ -134,8 +134,7 @@ class account_voucher(osv.osv):
],'Payment', select=True, readonly=True, states={'draft':[('readonly',False)]}),
'tax_id':fields.many2one('account.tax', 'Tax', readonly=True, states={'draft':[('readonly',False)]}),
'pre_line':fields.boolean('Previous Payments ?', required=False),
'date_due': fields.date('Due Date'),
# 'term_id':fields.many2one('account.payment.term', 'Term', required=False),
'date_due': fields.date('Due Date', readonly=True, states={'draft':[('readonly',False)]}),
}
_defaults = {
'period_id': _get_period,
@ -166,6 +165,7 @@ class account_voucher(osv.osv):
voucher_line_pool.write(cr, uid, [line.id], {'amount':line.amount, 'untax_amount':line.untax_amount})
if not voucher.tax_id:
self.write(cr, uid, [voucher.id], {'amount':voucher_amount, 'tax_amount':0.0})
continue
tax = [tax_pool.browse(cr, uid, voucher.tax_id.id)]
@ -177,7 +177,7 @@ class account_voucher(osv.osv):
total_tax = 0.0
if not tax[0].price_include:
for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes'):
for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes',[]):
total_tax += tax_line.get('amount')
total += total_tax
else:
@ -186,7 +186,7 @@ class account_voucher(osv.osv):
line_total = 0.0
line_tax = 0.0
for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes'):
for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes',[]):
line_tax += tax_line.get('amount')
line_total += tax_line.get('price_unit')
total_tax += line_tax
@ -196,7 +196,6 @@ class account_voucher(osv.osv):
self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax})
return True
# TODO: review this code.
def onchange_price(self, cr, uid, ids, line_ids, tax_id, partner_id=False, context={}):
tax_pool = self.pool.get('account.tax')
partner_pool = self.pool.get('res.partner')
@ -215,17 +214,26 @@ class account_voucher(osv.osv):
for line in line_ids:
line_amount = 0.0
if line[1]:
line_amount = voucher_line_pool.browse(cr, uid, line[1]).untax_amount
else:
line_amount = line[2].get('amount')
line_amount = line[2].get('amount')
voucher_line_ids += [line[1]]
voucher_total += line_amount
total = voucher_total
total_tax = 0.0
if tax_id:
tax = [tax_pool.browse(cr, uid, tax_id)]
if partner_id:
partner = partner_pool.browse(cr, uid, partner_id) or False
taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
tax = tax_pool.browse(cr, uid, taxes)
if not tax[0].price_include:
for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes',[]):
total_tax += tax_line.get('amount')
total += total_tax
res.update({
'amount':total,
'amount':total or voucher_total,
'tax_amount':total_tax
})
return {
@ -246,6 +254,44 @@ class account_voucher(osv.osv):
})
return {'value':default}
def onchange_journal_voucher(self, cr, uid, ids, partner_id=False, journal_id=False, context={}):
"""price
Returns a dict that contains new values and context
@param partner_id: latest value from user input for field partner_id
@param args: other arguments
@param context: context arguments, like lang, time zone
@return: Returns a dict which contains new values, and context
"""
default = {
'value':{},
}
if not partner_id or not journal_id:
return default
partner_pool = self.pool.get('res.partner')
journal_pool = self.pool.get('account.journal')
journal = journal_pool.browse(cr, uid, journal_id)
partner = partner_pool.browse(cr, uid, partner_id)
account_id = False
tr_type = False
if journal.type in ('sale','sale_refund'):
account_id = partner.property_account_receivable.id
tr_type = 'sale'
elif journal.type in ('purchase', 'purchase_refund','expense'):
account_id = partner.property_account_payable.id
tr_type = 'purchase'
else:
account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
tr_type = 'receipt'
default['value']['account_id'] = account_id
default['value']['type'] = tr_type
return default
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id=False, price=0.0, currency_id=False, ttype=False, context={}):
"""price
Returns a dict that contains new values and context
@ -281,17 +327,14 @@ class account_voucher(osv.osv):
journal = journal_pool.browse(cr, uid, journal_id)
partner = partner_pool.browse(cr, uid, partner_id)
account_id = False
term_id = False
if journal.type in ('sale','sale_refund'):
account_id = partner.property_account_receivable.id
elif journal.type in ('purchase', 'purchase_refund','expense'):
account_id = partner.property_account_payable.id
else:
account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
default['value'].update({
'account_id':account_id,
'term_id':term_id
})
default['value']['account_id'] = account_id
if journal.type not in ('cash', 'bank'):
return default
@ -314,17 +357,22 @@ class account_voucher(osv.osv):
total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit)
elif company_currency != currency_id and ttype == 'receipt':
total_credit = currency_pool.compute(cr, uid, currency_id, company_currency, total_credit)
for line in moves:
if line.credit and line.reconcile_partial_id:
if line.credit and line.reconcile_partial_id and ttype == 'receipt':
continue
if line.debit and line.reconcile_partial_id and ttype == 'payment':
continue
total_credit += line.credit or 0.0
total_debit += line.debit or 0.0
for line in moves:
if line.credit and line.reconcile_partial_id:
if line.credit and line.reconcile_partial_id and ttype == 'receipt':
continue
if line.debit and line.reconcile_partial_id and ttype == 'payment':
continue
rs = {
'name':line.move_id.name,
'type': line.credit and 'dr' or 'cr',
@ -354,7 +402,6 @@ class account_voucher(osv.osv):
default['value']['pre_line'] = 1
elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0:
default['value']['pre_line'] = 1
return default
def onchange_date(self, cr, user, ids, date, context={}):
@ -374,7 +421,7 @@ class account_voucher(osv.osv):
}
}
def onchange_journal(self, cr, uid, ids, journal_id):
def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context={}):
if not journal_id:
return False
journal_pool = self.pool.get('account.journal')
@ -383,8 +430,10 @@ class account_voucher(osv.osv):
tax_id = False
if account_id and account_id.tax_ids:
tax_id = account_id.tax_ids[0].id
return {'value':{'tax_id':tax_id}}
vals = self.onchange_price(cr, uid, ids, line_ids, tax_id, partner_id, context)
vals['value'].update({'tax_id':tax_id})
return vals
def proforma_voucher(self, cr, uid, ids):
self.action_move_line_create(cr, uid, ids)
@ -428,7 +477,7 @@ class account_voucher(osv.osv):
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Voucher(s) which are already opened or paid !'))
return super(account_voucher, self).unlink(cr, uid, ids, context=context)
# TODO
# TODO: may be we can remove this method if not used anyware
def onchange_payment(self, cr, uid, ids, pay_now, journal_id, partner_id, ttype='sale'):
res = {}
if not partner_id:
@ -500,7 +549,7 @@ class account_voucher(osv.osv):
if credit < 0:
debit = -credit
credit = 0.0
move_line = {
'name':inv.name or '/',
'debit':debit,
@ -514,7 +563,9 @@ class account_voucher(osv.osv):
'date':inv.date,
'date_maturity':inv.date_due
}
master_line = move_line_pool.create(cr, uid, move_line)
if (debit == 0.0 or credit == 0.0 or debit+credit > 0) and (debit > 0.0 or credit > 0.0):
master_line = move_line_pool.create(cr, uid, move_line)
rec_list_ids = []
line_total = debit - credit
@ -528,6 +579,7 @@ class account_voucher(osv.osv):
if not line.amount:
continue
amount = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, line.amount)
move_line = {
'journal_id':inv.journal_id.id,
'period_id':inv.period_id.id,
@ -536,6 +588,7 @@ class account_voucher(osv.osv):
'move_id':move_id,
'partner_id':inv.partner_id.id,
'currency_id':inv.currency_id.id,
'amount_currency':line.amount,
'analytic_account_id':line.account_analytic_id and line.account_analytic_id.id or False,
'quantity':1,
'credit':0.0,
@ -556,11 +609,10 @@ class account_voucher(osv.osv):
line_total -= amount
move_line['credit'] = amount
if inv.tax_id:
if inv.tax_id and inv.type in ('sale', 'purchase'):
move_line.update({
'account_tax_id':inv.tax_id.id,
})
master_line = move_line_pool.create(cr, uid, move_line)
if line.move_line_id.id:
rec_ids = [master_line, line.move_line_id.id]
@ -578,7 +630,8 @@ class account_voucher(osv.osv):
'debit':diff<0 and -diff or 0.0,
}
account_id = False
if inv.journal_id.type in ('sale','sale_refund', 'cash','bank'):
if inv.type in ('sale', 'receipt'):
# if inv.journal_id.type in ('sale','sale_refund', 'cash', 'bank'):
account_id = inv.partner_id.property_account_receivable.id
else:
account_id = inv.partner_id.property_account_payable.id
@ -589,7 +642,7 @@ class account_voucher(osv.osv):
'move_id': move_id,
'state':'posted'
})
move_pool.post(cr, uid, [move_id], context={})
#move_pool.post(cr, uid, [move_id], context={})
for rec_ids in rec_list_ids:
if len(rec_ids) >= 2:
move_line_pool.reconcile_partial(cr, uid, rec_ids)
@ -608,49 +661,6 @@ class account_voucher(osv.osv):
default['date'] = time.strftime('%Y-%m-%d')
return super(account_voucher, self).copy(cr, uid, id, default, context)
# TODO
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
"""
Returns views and fields for current model where view will depend on {view_type}.
@param view_id: list of fields, which required to read signatures
@param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx)
@param context: context arguments, like lang, time zone
@param toolbar: contains a list of reports, wizards, and links related to current model
@return: Returns a dict that contains definition for fields, views, and toolbars
"""
data_pool = self.pool.get('ir.model.data')
journal_pool = self.pool.get('account.journal')
voucher_type = {
'sale':'view_sale_receipt_form',
'purchase':'view_purchase_receipt_form',
'payment':'view_vendor_payment_form',
'receipt':'view_vendor_receipt_form'
}
if view_type == 'form':
tview = voucher_type.get(context.get('type'))
tview = tview or 'view_voucher_form'
result = data_pool._get_id(cr, uid, 'account_voucher', tview)
view_id = data_pool.browse(cr, uid, result, context=context).res_id
res = super(account_voucher, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
#Restrict the list of journal view in search view
if view_type == 'search':
type_search = {
'bank':[('type','in',['bank','cash'])],
'cash':[('type','in',['bank','cash'])],
'sale':[('type','in',['sale','purchase_refund'])],
'purchase':[('type','in',['purchase','sale_refund'])],
'expense':[('type','in',['purchase'])],
'sale_refund':[('type','in',['sale','purchase_refund'])],
'purchase_refund':[('type','in',['purchase','sale_refund'])]
}
domain = type_search.get(context.get('journal_type'))
journal_list = journal_pool.name_search(cr, uid, '', domain)
res['fields']['journal_id']['selection'] = journal_list
return res
account_voucher()
class account_voucher_line(osv.osv):
@ -737,9 +747,10 @@ class account_voucher_line(osv.osv):
journal = journal_pool.browse(cr, user, journal_id)
account_id = False
ttype = 'cr'
if journal.type in ('sale', 'purchase_refund'):
if journal.type in ('sale', 'sale_refund'):
account_id = journal.default_credit_account_id and journal.default_credit_account_id.id or False
elif journal.type in ('purchase', 'expense', 'sale_refund'):
ttype = 'cr'
elif journal.type in ('purchase', 'expense', 'purchase_refund'):
account_id = journal.default_debit_account_id and journal.default_debit_account_id.id or False
ttype = 'dr'
elif partner_id:

View File

@ -1,6 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="view_voucher_filter_customer_pay" model="ir.ui.view">
<field name="name">account.voucher.customer.pay.select</field>
<field name="model">account.voucher</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Vouchers">
<group col='8' colspan='4'>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
<separator orientation="vertical"/>
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
<separator orientation="vertical"/>
<field name="date"/>
<field name="number"/>
<field name="partner_id" string="Customer"/>
</group>
<newline/>
<group col='8' colspan='4'>
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
<field name="period_id" groups="base.group_extended"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10">
<filter string="Customer" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
<record id="view_voucher_filter_vendor_pay" model="ir.ui.view">
<field name="name">account.voucher.purchase.pay.select</field>
<field name="model">account.voucher</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Vouchers">
<group col='8' colspan='4'>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
<separator orientation="vertical"/>
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
<separator orientation="vertical"/>
<field name="date"/>
<field name="number"/>
<field name="partner_id" string="Supplier"/>
</group>
<newline/>
<group col='8' colspan='4'>
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
<field name="period_id" groups="base.group_extended"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10">
<filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
<record model="ir.ui.view" id="view_vendor_payment_form">
<field name="name">account.voucher.payment.form</field>
<field name="model">account.voucher</field>
@ -18,9 +98,7 @@
<field name="reference" select="1" string="Payment Ref"/>
<field name="name" colspan="4"/>
<field name="account_id"
domain="[('type','=','other')]"
widget="selection"
on_change="onchange_account(account_id)"
invisible="True"/>
<field name="pre_line" invisible="1"/>
<field name="type" invisible="True"/>
@ -28,7 +106,7 @@
<notebook colspan="4">
<page string="Payment Information">
<field name="line_dr_ids" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="140">
<tree string="Payment Lines" editable="bottom">
<tree string="Vendor Invoices and Outstanding transactions" editable="bottom">
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
on_change="onchange_move_line_id(move_line_id)"
domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
@ -87,13 +165,27 @@
<record id="action_vendor_payment" model="ir.actions.act_window">
<field name="name">Vendor Payment</field>
<field name="res_model">account.voucher.open</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')]</field>
<field name="context">{'journal_type':'bank', 'type':'payment'}</field>
<field name="view_id" ref="account_open_vouchers_view"/>
<field name="target">new</field>
<field name="context">{'type':'payment'}</field>
<field name="view_id" eval="False"/>
<field name="search_view_id" ref="view_voucher_filter_vendor_pay"/>
<field name="target">current</field>
</record>
<record id="action_vendor_payment_tree" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="act_window_id" ref="action_vendor_payment"/>
</record>
<record id="action_vendor_payment_form" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_vendor_payment_form"/>
<field name="act_window_id" ref="action_vendor_payment"/>
</record>
<menuitem action="action_vendor_payment" icon="STOCK_JUSTIFY_FILL" sequence="12"
id="menu_action_vendor_payment" parent="account.menu_finance_payables"/>
@ -115,9 +207,7 @@
<field name="reference" select="1" string="Payment Ref"/>
<field name="name" colspan="4"/>
<field name="account_id"
domain="[('type','=','other')]"
widget="selection"
on_change="onchange_account(account_id)"
invisible="True"/>
<field name="pre_line" invisible="1"/>
<field name="type" invisible="True"/>
@ -181,13 +271,26 @@
<record id="action_vendor_receipt" model="ir.actions.act_window">
<field name="name">Sales Payment</field>
<field name="res_model">account.voucher.open</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt')]</field>
<field name="context">{'journal_type':'bank', 'type':'receipt'}</field>
<field name="view_id" ref="account_open_vouchers_view"/>
<field name="target">new</field>
<field name="context">{'type':'receipt'}</field>
<field name="search_view_id" ref="view_voucher_filter_customer_pay"/>
<field name="view_id" eval="False"/>
<field name="target">current</field>
</record>
<record id="action_vendor_receipt_tree" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="act_window_id" ref="action_vendor_receipt"/>
</record>
<record id="action_vendor_receipt_form" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_vendor_receipt_form"/>
<field name="act_window_id" ref="action_vendor_receipt"/>
</record>
<menuitem action="action_vendor_receipt" icon="STOCK_JUSTIFY_FILL" sequence="12"
id="menu_action_vendor_receipt" parent="account.menu_finance_receivables"/>
</data>

View File

@ -1,16 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="view_voucher_filter_vendor" model="ir.ui.view">
<field name="name">account.voucher.purchase.select</field>
<field name="model">account.voucher</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Vouchers">
<group col='8' colspan='4'>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
<separator orientation="vertical"/>
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
<separator orientation="vertical"/>
<field name="date"/>
<field name="number"/>
<field name="partner_id" string="Supplier"/>
</group>
<newline/>
<group col='8' colspan='4'>
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('purchase','purchase_refund'))]"/>
<field name="period_id" groups="base.group_extended"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10">
<filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
<record id="view_voucher_filter_sale" model="ir.ui.view">
<field name="name">account.voucher.sale.select</field>
<field name="model">account.voucher</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Vouchers">
<group col='8' colspan='4'>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
<separator orientation="vertical"/>
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
<separator orientation="vertical"/>
<field name="date"/>
<field name="number"/>
<field name="partner_id" string="Customer"/>
</group>
<newline/>
<group col='8' colspan='4'>
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('sale','sale_refund'))]"/>
<field name="period_id" groups="base.group_extended"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10">
<filter string="Customer" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
<record id="act_pay_voucher" model="ir.actions.act_window">
<field name="name">Sales Payment</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt'), ('partner_id','=',partner_id)]</field>
<field name="context">{'journal_type':'bank', 'type':'receipt', 'partner_id': partner_id}</field>
<field name="context">{'type':'receipt', 'partner_id': partner_id, 'default_reference':reference}</field>
<field name="view_id" ref="view_vendor_receipt_form"/>
<field name="target">new</field>
</record>
<record model="ir.ui.view" id="view_sale_receipt_form">
<field name="name">account.voucher.sale.form</field>
<field name="model">account.voucher</field>
@ -19,7 +99,7 @@
<form string="Sales Receipt">
<group col="6" colspan="4">
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id)" string="Customer"/>
<field name="journal_id" domain="[('type','in',['sale','purchase_refund'])]" widget="selection" on_change="onchange_journal(journal_id)"/>
<field name="journal_id" domain="[('type','in',['sale','sale_refund'])]" widget="selection" on_change="onchange_journal(journal_id, line_cr_ids, tax_id, partner_id)"/>
<field name="number"/>
<field name="name" colspan="4"/>
<field name="date" on_change="onchange_date(date)"/>
@ -50,10 +130,11 @@
<field name="reference"
attrs="{'invisible':[('pay_now','!=','pay_now')]}"
/>
<field name="date_due" attrs="{'invisible':[('pay_now','=','pay_now')]}"/>
</group>
<group col="4" colspan="1">
<separator string="Total" colspan="4"/>
<field name="tax_id" on_change="onchange_price(line_cr_ids, tax_id, partner_id)" widget="selection" domain="[('type_tax_use','in',('sale','all'))]"/><field name="tax_amount" on_change="onchange_price(line_ids, tax_id, partner_id)" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
<field name="tax_id" on_change="onchange_price(line_cr_ids, tax_id, partner_id)" widget="selection" domain="[('type_tax_use','in',('sale','all'))]"/><field name="tax_amount" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" groups="base.group_extended" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
<label colspan="1" string=""/><field name="amount" string="Total"/>
</group>
</group>
@ -73,7 +154,7 @@
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
<button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to confirm this record ?"/>
<button name="proforma_voucher" string="Post" states="draft" icon="terp-camera_test"/>
<button icon="terp-dolar_ok!" name="%(act_pay_voucher)d" context="{'title':'Sales Payment', 'journal_type':'bank', 'type':'receipt', 'partner_id': partner_id}" type="action" string="Pay" attrs="{'invisible':[('pay_now','!=','pay_now'),('state','!=','posted')]}"/>
<button icon="terp-dolar_ok!" name="%(act_pay_voucher)d" context="{'title':'Sales Payment', 'type':'receipt', 'partner_id': partner_id}" type="action" string="Pay" attrs="{'invisible':[('pay_now','!=','pay_now'),('state','!=','posted')]}"/>
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
</group>
</form>
@ -83,23 +164,38 @@
<!-- Sales Voucher -->
<record id="action_sale_receipt" model="ir.actions.act_window">
<field name="name">Sales Receipt</field>
<field name="res_model">account.voucher.open</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="domain">[('journal_id.type','in',['sale','purchase_refund']), ('type','=','sale')]</field>
<field name="context">{'journal_type':'sale', 'type':'sale'}</field>
<field name="view_id" ref="account_open_vouchers_view"/>
<field name="target">new</field>
<field name="domain">[('journal_id.type','in',['sale','sale_refund']), ('type','=','sale')]</field>
<field name="context">{'type':'sale'}</field>
<field name="view_id" eval="False"/>
<field name="search_view_id" ref="view_voucher_filter_sale"/>
<field name="target">current</field>
</record>
<record id="action_sale_receipt_tree" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="act_window_id" ref="action_sale_receipt"/>
</record>
<record id="action_sale_receipt_form" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_sale_receipt_form"/>
<field name="act_window_id" ref="action_sale_receipt"/>
</record>
<menuitem id="menu_action_sale_receipt" icon="STOCK_JUSTIFY_FILL"
action="action_sale_receipt" parent="account.menu_finance_receivables" sequence="10"/>
action="action_sale_receipt"
parent="account.menu_finance_receivables"
sequence="10"/>
<!-- Purchase Vouchers -->
<record id="act_pay_bills" model="ir.actions.act_window">
<field name="name">Bill Payment</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment'), ('partner_id','=',partner_id)]</field>
<field name="context">{'journal_type':'bank', 'type':'payment', 'partner_id': partner_id}</field>
<field name="context">{'type':'payment', 'partner_id': partner_id, 'default_reference':reference}</field>
<field name="view_id" ref="view_vendor_payment_form"/>
<field name="target">new</field>
</record>
@ -111,10 +207,10 @@
<form string="Vendor Bills">
<group col="6" colspan="4">
<field name="partner_id" required="1" string="Vendor" on_change="onchange_partner_id(partner_id, journal_id, amount)"/>
<field name="journal_id" domain="[('type','in',['purchase','sale_refund'])]" widget="selection" select="1" on_change="onchange_journal(journal_id)"/>
<field name="reference" select="1"/>
<field name="name" colspan="4"/>
<field name="journal_id" domain="[('type','in',['purchase','purchase_refund'])]" widget="selection" select="1" on_change="onchange_journal(journal_id, line_dr_ids, tax_id, partner_id)"/>
<field name="number"/>
<field name="name" colspan="4"/>
<field name="reference" select="1"/>
<field name="account_id" domain="[('type','=','other')]" invisible="True"/>
<field name="type" invisible="True"/>
</group>
@ -137,11 +233,10 @@
<separator string="Payment Terms" colspan="2"/>
<field name="date" string="Bill Date" select="1" on_change="onchange_date(date)"/>
<field name="date_due"/>
<field name="amount" required="0" string="Amount Due"/>
</group>
<group col="4" colspan="1">
<separator string="Total" colspan="4"/>
<field name="tax_id" on_change="onchange_price(line_dr_ids, tax_id, partner_id)" widget="selection" domain="[('type_tax_use','in',('purchase','all'))]"/><field name="tax_amount" on_change="onchange_price(line_ids, tax_id, partner_id)" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
<field name="tax_id" on_change="onchange_price(line_dr_ids, tax_id, partner_id)" widget="selection" domain="[('type_tax_use','in',('purchase','all'))]"/><field name="tax_amount" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" string="Compute Tax" groups="base.group_extended" attrs="{'invisible': [('state','!=','draft')]}"/>
<label colspan="1" string=""/><field name="amount" string="Total"/>
</group>
</group>
@ -161,7 +256,7 @@
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
<button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to confirm this record ?"/>
<button name="proforma_voucher" string="Post" states="draft" icon="terp-camera_test"/>
<button icon="terp-dolar_ok!" name="%(act_pay_bills)d" context="{'title':'Bill Payment', 'journal_type':'bank', 'type':'payment', 'partner_id': partner_id}" type="action" string="Pay Bill" attrs="{'invisible':[('state','!=','posted')]}"/>
<button icon="terp-dolar_ok!" name="%(act_pay_bills)d" context="{'title':'Bill Payment', 'type':'payment', 'partner_id': partner_id}" type="action" string="Pay Bill" attrs="{'invisible':[('state','!=','posted')]}"/>
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
</group>
</form>
@ -169,13 +264,26 @@
</record>
<record id="action_purchase_receipt" model="ir.actions.act_window">
<field name="name">Vendor Bills</field>
<field name="res_model">account.voucher.open</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="domain">[('journal_id.type','in',['purchase','sale_refund']), ('type','=','purchase')]</field>
<field name="context">{'journal_type':'purchase', 'type':'purchase'}</field>
<field name="view_id" ref="account_open_vouchers_view"/>
<field name="target">new</field>
<field name="domain">[('journal_id.type','in',['purchase','purchase_refund']), ('type','=','purchase')]</field>
<field name="context">{'type':'purchase'}</field>
<field name="view_id" eval="False"/>
<field name="search_view_id" eval="view_voucher_filter_vendor"/>
<field name="target">current</field>
</record>
<record id="action_purchase_receipt_tree" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="act_window_id" ref="action_purchase_receipt"/>
</record>
<record id="action_purchase_receipt_form" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_purchase_receipt_form"/>
<field name="act_window_id" ref="action_purchase_receipt"/>
</record>
<menuitem id="menu_action_purchase_receipt" icon="STOCK_JUSTIFY_FILL"
action="action_purchase_receipt" parent="account.menu_finance_payables" sequence="10"/>

View File

@ -20,7 +20,7 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_voucher_form">
<field name="name">account.voucher.form</field>
<field name="model">account.voucher</field>
@ -28,22 +28,22 @@
<field name="arch" type="xml">
<form string="Accounting Voucher">
<group col="6" colspan="4">
<field name="partner_id" required="1" on_change="onchange_journal_voucher(partner_id, journal_id)"/>
<field name="journal_id" widget="selection" select="1" on_change="onchange_journal_voucher(partner_id, journal_id)"/>
<field name="type" required="1"/>
<field name="name" colspan="4"/>
<field name="reference" select="1"/>
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id)"/>
<field name="type" on_change="onchange_partner_id(partner_id, journal_id)"/>
<field name="journal_id" widget="selection" select="1" on_change="onchange_partner_id(partner_id, journal_id)"/>
<field name="account_id" widget="selection" invisible="True"/>
</group>
<notebook colspan="4">
<page string="Voucher Entry">
<field name="line_ids" on_change="onchange_price(line_ids, False, partner_id)" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="180">
<tree string="Voucher Lines" editable="top">
<field name="line_ids" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="180">
<tree string="Voucher Items" editable="bottom">
<field name="account_id"/>
<field name="name"/>
<field name="amount"/>
<field name="amount" sum="Total Amount"/>
<field name="type"/>
<field name="account_analytic_id" domain="[('parent_id','!=',False)]"/>
<field name="account_analytic_id" groups="base.group_extended"/>
</tree>
</field>
<group col="2" colspan="3">
@ -51,16 +51,22 @@
<field name="narration" colspan="2" nolabel="1"/>
</group>
<group col="2" colspan="1">
<separator string="Other Information" colspan="2"/>
<field name="amount" string="Total"/>
<field name="number"/>
<field name="date" select="1" on_change="onchange_date(date)"/>
<field name="currency_id" select="1" attrs="{'readonly':[('type','in',['sale', 'purchase'])]}"/>
<group col="2" colspan="1" >
<separator string="Other Information" colspan="2"/>
<field name="number"/>
<field name="date" on_change="onchange_date(date)"/>
<field name="currency_id" attrs="{'readonly':[('type','in',['sale', 'purchase'])]}"/>
</group>
<group col="4" colspan="1" attrs="{'invisible':[('type','in',['payment', 'receipt', False])]}">
<separator string="Total" colspan="4"/>
<field name="tax_id" on_change="onchange_price(line_cr_ids, tax_id, partner_id)" widget="selection" domain="[('type_tax_use','in',('sale','all'))]"/><field name="tax_amount" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" groups="base.group_extended" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
<label colspan="1" string=""/><field name="amount" string="Total"/>
</group>
</group>
</page>
<page string="Journal Items" groups="base.group_extended" attrs="{'invisible': [('state','!=','posted')]}">
<group col="6" colspan="4">
<field name="company_id" select="1" widget="selection" groups="base.group_multi_company"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="period_id"/>
<field name="audit"/>
</group>
@ -73,7 +79,7 @@
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
<button name="proforma_voucher" string="Post" states="draft" icon="terp-camera_test"/>
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
<button name="%(action_view_account_voucher_unreconcile)d" string="Cancel" type="action" states="posted" icon="terp-stock_effects-object-colorize"/>
<button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/>
</group>
</form>
</field>
@ -83,48 +89,7 @@
<field name="name">account.voucher.select</field>
<field name="model">account.voucher</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Vouchers">
<group col='8' colspan='4'>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
<filter icon="terp-check" string="Proforma" domain="[('state','=','proforma')]" help="Proforma Vouchers"/>
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
<separator orientation="vertical"/>
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
<filter icon="gtk-cancel" string="Cancel" domain="[('state','=','cancel')]" help="Cancel Vouchers" groups="base.group_extended"/>
<separator orientation="vertical"/>
<field name="number" select='1'/>
<field name="account_id" select="1"/>
<field name="partner_id" select='1'/>
<field name="date" select='1'/>
</group>
<newline/>
<group col='8' colspan='4'>
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" />
<field name="period_id" context="{'period_id': self}" groups="base.group_extended"/>
</group>
<newline/>
<group expand="0" string="Group By..." col='8' colspan='4'>
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type', 'set_visible':True}"/>
<filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference" select="1"/>
<field name="name" select='1'/>
<field name="narration" select="1"/>
</group>
</search>
</field>
</record>
<record id="view_voucher_filter_new" model="ir.ui.view">
<field name="name">account.voucher.select</field>
<field name="model">account.voucher</field>
<field name="type">search</field>
<field name="priority">1</field>
<field name="arch" type="xml">
<search string="Search Vouchers">
<group col='8' colspan='4'>
@ -133,9 +98,9 @@
<separator orientation="vertical"/>
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
<separator orientation="vertical"/>
<field name="date" select='1'/>
<field name="number" select='1'/>
<field name="partner_id" select='1'/>
<field name="date"/>
<field name="number"/>
<field name="partner_id"/>
</group>
<newline/>
<group col='8' colspan='4'>
@ -143,18 +108,19 @@
<field name="period_id" groups="base.group_extended"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="12" col="10">
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10">
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
<filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference" select="1"/>
<field name="name" select='1'/>
<field name="narration" select="1"/>
</group>
</search>
</field>
</record>
@ -199,7 +165,7 @@
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('state','=','posted')]</field>
<field name="context">{'state':'posted'}</field>
<field name="search_view_id" ref="view_voucher_filter_new"/>
<field name="search_view_id" ref="view_voucher_filter"/>
</record>
</data>

View File

@ -19,5 +19,4 @@
#
##############################################################################
import account_voucher_open
import account_voucher_unreconcile

View File

@ -1,147 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
import tools
class account_voucher_open(osv.osv_memory):
_name = "account.voucher.open"
_description = "Account Voucher"
def _get_period(self, cr, uid, context={}):
"""
Return default account period value
"""
ids = self.pool.get('account.period').find(cr, uid, context=context)
period_id = False
if len(ids):
period_id = ids[0]
return period_id
def _get_journal(self, cr, uid, context={}):
"""
Return journal based on the journal type
"""
journal_id = False
journal_pool = self.pool.get('account.journal')
if context.get('journal_type', False):
jids = journal_pool.search(cr, uid, [('type','=', context.get('journal_type'))])
journal_id = jids[0]
return journal_id
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
"""
Returns views and fields for current model where view will depend on {view_type}.
@param cr: A database cursor
@param user: ID of the user currently logged in
@param view_id: list of fields, which required to read signatures
@param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx)
@param context: context arguments, like lang, time zone
@param toolbar: contains a list of reports, wizards, and links related to current model
@return: Returns a dict that contains definition for fields, views, and toolbars
"""
res = super(account_voucher_open, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
if not view_id:
return res
period_pool = self.pool.get('account.period')
journal_pool = self.pool.get('account.journal')
journal_id = self._get_journal(cr, uid, context)
period_id = self._get_period(cr, uid, context)
journal = False
if journal_id:
journal = journal_pool.read(cr, uid, [journal_id], ['name'])[0]['name']
else:
journal = "All"
period = False
if period_id:
period = period_pool.browse(cr, uid, [period_id], ['name'])[0]['name']
menu = self.pool.get('ir.ui.menu').browse(cr, uid, context.get('active_id'))
name = menu.name
view = """<?xml version="1.0" encoding="utf-8"?>
<form string="Standard entries">
<separator string="Open %s !" colspan="4"/>
<group colspan="4" >
<label width="300" string="Journal : %s"/>
<newline/>
<label width="300" string="Period : %s"/>
</group>
<group colspan="4" col="4">
<label string ="" colspan="2"/>
<button icon="terp-gtk-go-back-rtl" string="Ok" name="action_open_window" type="object"/>
</group>
</form>""" % (str(name), str(journal), str(period))
res.update({
'arch':view
})
return res
def action_open_window(self, cr, uid, ids, context=None):
"""
This function Open action move line window on given period and Journal/Payment Mode
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: account move journals ID or list of IDs
@return: dictionary of Open action move line window on given period and Journal/Payment Mode
"""
period_pool = self.pool.get('account.journal.period')
data_pool = self.pool.get('ir.model.data')
journal_pool = self.pool.get('account.journal')
if context is None:
context = {}
journal_id = self._get_journal(cr, uid, context)
period_id = self._get_period(cr, uid, context)
menu = self.pool.get('ir.ui.menu').browse(cr, uid, context.get('active_id'))
name = context.get('title', menu.name)
result = data_pool._get_id(cr, uid, 'account_voucher', 'view_voucher_filter_new')
res_id = data_pool.browse(cr, uid, result, context=context).res_id
res = {
'domain':menu.action.domain,
'name': name,
'view_type': 'form',
'view_mode': 'tree,graph,form',
'res_model': 'account.voucher',
'view_id': False,
'context': "{'search_default_journal_id':%d, 'search_default_period_id':%d, 'partner_id':%s}" % (journal_id, period_id, context.get('partner_id',False)),
'type': 'ir.actions.act_window',
'search_view_id': res_id
}
return res
account_voucher_open()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="account_open_vouchers_view" model="ir.ui.view">
<field name="name">Open Vouchers</field>
<field name="model">account.voucher.open</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Open Vouchers">
<separator string="Open Vouchers !" colspan="4"/>
<group colspan="4" >
<label width="300" string="Journal :"/>
<newline/>
<label width="300" string="Period :"/>
</group>
<group colspan="4" col="4">
<label string ="" colspan="2"/>
<button icon="terp-gtk-go-back-rtl" string="Ok" name="action_open_window" type="object"/>
</group>
</form>
</field>
</record>
</data>
</openerp>

View File

@ -70,7 +70,7 @@ class account_analytic_account(osv.osv):
where_date += " AND l.date >= '" + context['from_date'] + "'"
if context.get('to_date', False):
where_date += " AND l.date <= '" + context['to_date'] + "'"
cr.execute("SELECT a.id, COALESCE(SUM(l.amount_currency),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE l.amount_currency<0 and a.id IN %s GROUP BY a.id",(tuple(parent_ids),))
cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE l.amount<0 and a.id IN %s GROUP BY a.id",(tuple(parent_ids),))
r = dict(cr.fetchall())
return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, r, context)
@ -90,7 +90,7 @@ class account_analytic_account(osv.osv):
where_date += " AND l.date >= '" + context['from_date'] + "'"
if context.get('to_date',False):
where_date += " AND l.date <= '" + context['to_date'] + "'"
cr.execute("SELECT a.id, COALESCE(SUM(l.amount_currency),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE l.amount_currency>0 and a.id IN %s GROUP BY a.id" ,(tuple(parent_ids),))
cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE l.amount>0 and a.id IN %s GROUP BY a.id" ,(tuple(parent_ids),))
r = dict(cr.fetchall())
return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, r, context=context)
@ -111,11 +111,10 @@ class account_analytic_account(osv.osv):
where_date += " AND l.date >= '" + context['from_date'] + "'"
if context.get('to_date',False):
where_date += " AND l.date <= '" + context['to_date'] + "'"
cr.execute("SELECT a.id, COALESCE(SUM(l.amount_currency),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE a.id IN %s GROUP BY a.id",(tuple(parent_ids),))
cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE a.id IN %s GROUP BY a.id",(tuple(parent_ids),))
for account_id, sum in cr.fetchall():
res[account_id] = sum
return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
def _quantity_calc(self, cr, uid, ids, name, arg, context=None):
@ -182,10 +181,10 @@ class account_analytic_account(osv.osv):
'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', select=2),
'child_ids': fields.one2many('account.analytic.account', 'parent_id', 'Child Accounts'),
'line_ids': fields.one2many('account.analytic.line', 'account_id', 'Analytic Entries'),
'balance' : fields.function(_balance_calc, method=True, type='float', string='Balance',store=True),
'debit' : fields.function(_debit_calc, method=True, type='float', string='Debit',store=True),
'credit' : fields.function(_credit_calc, method=True, type='float', string='Credit',store=True),
'quantity': fields.function(_quantity_calc, method=True, type='float', string='Quantity',store=True),
'balance' : fields.function(_balance_calc, method=True, type='float', string='Balance'),
'debit' : fields.function(_debit_calc, method=True, type='float', string='Debit'),
'credit' : fields.function(_credit_calc, method=True, type='float', string='Credit'),
'quantity': fields.function(_quantity_calc, method=True, type='float', string='Quantity'),
'quantity_max': fields.float('Maximum Quantity', help='Sets the higher limit of quantity of hours.'),
'partner_id' : fields.many2one('res.partner', 'Associated Partner'),
'contact_id' : fields.many2one('res.partner.address', 'Contact'),
@ -216,7 +215,7 @@ class account_analytic_account(osv.osv):
'user_id' : lambda self, cr, uid, ctx : uid,
'partner_id': lambda self, cr, uid, ctx: ctx.get('partner_id', False),
'contact_id': lambda self, cr, uid, ctx: ctx.get('contact_id', False),
'date_start': time.strftime('%Y-%m-%d')
'date_start': time.strftime('%Y-%m-%d')
}
def check_recursion(self, cr, uid, ids, parent=None):

View File

@ -1,8 +1,4 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_account_analytic_line_analytic_accounting","account.analytic.line","analytic.model_account_analytic_line","analytic.group_analytic_accounting",1,1,1,1
"access_account_analytic_account_analytic_accounting","account.analytic.account","analytic.model_account_analytic_account","analytic.group_analytic_accounting",1,1,1,1
"access_account_analytic_journal_analytic_accounting","account.analytic.journal","account.model_account_analytic_journal","analytic.group_analytic_accounting",1,1,1,1
"access_account_account_analytic_accounting","account.account","account.model_account_account","analytic.group_analytic_accounting",1,0,0,0
"access_product_template_analytic_accounting","product.template","product.model_product_template","analytic.group_analytic_accounting",1,0,0,0
"access_product_product_analytic_accounting","product.product","product.model_product_product","analytic.group_analytic_accounting",1,0,0,0
"access_product_category_analytic_accounting","product.category","product.model_product_category","analytic.group_analytic_accounting",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_account_analytic_line_analytic_accounting account.analytic.line analytic.model_account_analytic_line analytic.group_analytic_accounting 1 1 1 1
3 access_account_analytic_account_analytic_accounting account.analytic.account analytic.model_account_analytic_account analytic.group_analytic_accounting 1 1 1 1
4
access_account_account_analytic_accounting account.account account.model_account_account analytic.group_analytic_accounting 1 0 0 0
access_product_template_analytic_accounting product.template product.model_product_template analytic.group_analytic_accounting 1 0 0 0
access_product_product_analytic_accounting product.product product.model_product_product analytic.group_analytic_accounting 1 0 0 0
access_product_category_analytic_accounting product.category product.model_product_category analytic.group_analytic_accounting 1 0 0 0

View File

@ -16,7 +16,7 @@
</xpath>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">Install more applications. A few applications are proposed according to the Association Profile you selected. You will be able to install them based on our requirements.</attribute>
<attribute name="string">Here are specific applications related to the Association Profile you selected.</attribute>
</xpath>
<xpath expr="//button[@string='Install Modules']" position="attributes">
<attribute name="string">Configure</attribute>

View File

@ -208,7 +208,7 @@ class audittrail_objects_proxy(osv_pool):
else:
field_ids = field_pool.search(cr, uid, [('name', '=', field_name), ('model_id', '=', model.id)])
field_id = field_ids and field_ids[0] or False
assert field_id, _("'%s' field is not exits in '%s' model" %(field_name, model.model))
assert field_id, _("'%s' field does not exist in '%s' model" %(field_name, model.model))
field = field_pool.read(cr, uid, field_id)
relation_model = field['relation']
@ -254,7 +254,7 @@ class audittrail_objects_proxy(osv_pool):
else:
field_ids = field_pool.search(cr, uid, [('name', '=', line['name']), ('model_id', '=', model.id)])
field_id = field_ids and field_ids[0] or False
assert field_id, _("'%s' field is not exits in '%s' model" %(line['name'], model.model))
assert field_id, _("'%s' field does not exist in '%s' model" %(line['name'], model.model))
field = field_pool.read(cr, uid, field_id)
old_value = 'old_value' in line and line['old_value'] or ''
@ -303,7 +303,7 @@ class audittrail_objects_proxy(osv_pool):
model_ids = model_pool.search(cr, uid, [('model', '=', model)])
model_id = model_ids and model_ids[0] or False
assert model_id, _("'%s' Model is not exits..." %(model))
assert model_id, _("'%s' Model does not exist..." %(model))
model = model_pool.browse(cr, uid, model_id)
if method in ('create'):

View File

@ -10,9 +10,15 @@
<form position="attributes">
<attribute name="string">Install Applications</attribute>
</form>
<<<<<<< TREE
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">Select the Applications you want your system to cover. If you are not sure about your exact needs at this stage, you can easily install them later.</xpath>
=======
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">Select the Applications you want your system to cover. If you are not sure about your exact needs at this stage, you can easily install them later.</attribute>
</xpath>
>>>>>>> MERGE-SOURCE
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='string'></attribute>
<attribute name='rowspan'>15</attribute>
@ -25,6 +31,7 @@
</separator>
<group colspan="8">
<<<<<<< TREE
<field name="crm" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/> <field name="sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/>
<field name="project" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/> <field name="knowledge" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/>
<field name="stock" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/> <field name="mrp" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/>
@ -32,10 +39,25 @@
<field name="hr" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/> <field name="point_of_sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/>
<field name="marketing" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/> <field name="profile_tools" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/>
<field name="report_designer" groups="base.group_extended" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/>
=======
<field name="crm" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/> <field name="sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/>
<field name="project" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/> <field name="knowledge" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/>
<field name="stock" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/> <field name="mrp" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/>
<field name="account" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/> <field name="purchase" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/>
<field name="hr" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/> <field name="point_of_sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/>
<field name="marketing" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/> <field name="profile_tools" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/>
<field name="report_designer" groups="base.group_extended" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/>
>>>>>>> MERGE-SOURCE
<separator string="Install Specific Industry Sector Applications" colspan="4"/>
<<<<<<< TREE
<field name="association" attrs="{'readonly':['|', ('auction','=',True), ('product_expiry','=',True)]}" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/>
<field name="auction" attrs="{'readonly':['|', ('association','=',True), ('product_expiry','=',True)]}" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/>
<field name="product_expiry" attrs="{'readonly':['|', ('association','=',True), ('auction','=',True)]}" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction)"/>
=======
<field name="association" attrs="{'readonly':['|',('auction','=',True),('product_expiry','=',True)]}" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/>
<field name="auction" attrs="{'readonly':['|',('association','=',True),('product_expiry','=',True)]}" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/>
<field name="product_expiry" attrs="{'readonly':['|',('association','=',True),('auction','=',True)]}" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,profile_tools,report_designer,association,auction,product_expiry)"/>
>>>>>>> MERGE-SOURCE
</group>
</data>
</field>

View File

@ -1,20 +1,20 @@
<openerp>
<data>
<record id="view_base_setup_company" model="ir.ui.view">
<field name="name">Setup company information</field>
<field name="name">Company Configuration</field>
<field name="model">base.setup.company</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.res_config_view_base"/>
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Main Company Setup</attribute>
<attribute name="string">Company Configuration</attribute>
</form>
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">Information of your company will be used to customize your documents like Invoices, Sale Orders and many more.</attribute>
<attribute name="string">Your company information will be used to personalize documents issued with OpenERP such as invoices, sales orders and much more.</attribute>
</xpath>
<xpath expr='//separator[@string="title"]' position='attributes'>
<attribute name='string'>Configure Your Company</attribute>
<attribute name='string'>Configure Your Company Information</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='rowspan'>25</attribute>
@ -55,7 +55,7 @@
</record>
<record id="action_base_setup_company" model="ir.actions.act_window">
<field name="name">Setup company information</field>
<field name="name">Company Configuration</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">base.setup.company</field>
<field name="view_id" ref="view_base_setup_company"/>

View File

@ -107,11 +107,13 @@ class base_setup_installer(osv.osv_memory):
return ['account_voucher']
return None
def onchange_moduleselection(self, cr, uid, ids, *args):
def onchange_moduleselection(self, cr, uid, ids, *args, **kargs):
value = {}
# Calculate progress
closed, total = self.get_current_progress(cr, uid)
progress = round(100. * closed / (total + len(filter(None, args))))
value.update({'progress':progress})
if progress < 10.:
progress = 10.
return {'value':{'progress':progress}}
return {'value':value}
base_setup_installer()

View File

@ -86,7 +86,6 @@ Create dashboard for CRM that includes:
'wizard/crm_send_email_view.xml',
'wizard/crm_add_note_view.xml',
'wizard/crm_forward_to_partner_view.xml',
'wizard/crm_custom_create_menu_view.xml',
'wizard/crm_merge_opportunities_view.xml',
'crm_view.xml',

View File

@ -499,10 +499,14 @@ class crm_case_section(osv.osv):
_name = "crm.case.section"
_description = "Sales Teams"
_order = "name"
_order = "complete_name"
def get_full_name(self, cr, uid, ids, field_name, arg, context={}):
return dict(self.name_get(cr, uid, ids, context))
_columns = {
'name': fields.char('Sales Team', size=64, required=True, translate=True),
'complete_name': fields.function(get_full_name, method=True, type='char', size=256, readonly=True, store=True),
'code': fields.char('Code', size=8),
'active': fields.boolean('Active', help="If the active field is set to "\
"true, it will allow you to hide the sales team without removing it."),

View File

@ -16,7 +16,7 @@
</separator>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">You can enhance OpenERP's basic CRM support with a few additional OpenERP modules</attribute>
<attribute name="string">Enhance your CRM basic Application with additional Addons.</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='rowspan'>13</attribute>

View File

@ -65,7 +65,6 @@
string="Convert to Opportunity"
help="Convert to Opportunity"
icon="gtk-index"
colspan="2"
type="object"/>
<newline />
<field name="section_id" widget="selection" />

View File

@ -31,7 +31,6 @@ import crm_phonecall_to_partner
import crm_phonecall_to_opportunity
import crm_partner_to_opportunity
import crm_custom_create_menu
import crm_merge_opportunities

View File

@ -1,78 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields,osv
class crm_case_custom_create_menu(osv.osv_memory):
'''
Create menu for custom Cases
'''
_name = 'crm.custom.create.menu'
_description = 'Create menu for custom Cases'
_columns = {
'name': fields.char('Menu Name', size=64, required=True),
'menu_parent_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True),
'section_id': fields.many2one('crm.case.section.custom', 'Section', required=True),
'view_form': fields.many2one('ir.ui.view', 'Form View', domain=[('type','=','form'),('model','=','crm.case.custom')]),
'view_tree': fields.many2one('ir.ui.view', 'Tree View', domain=[('type','=','tree'),('model','=','crm.case.custom')]),
'view_calendar': fields.many2one('ir.ui.view', 'Calendar View', domain=[('type','=','calendar'),('model','=','crm.case.custom')]),
'view_search': fields.many2one('ir.ui.view', 'Search View', domain=[('type','=','search'),('model','=','crm.case.custom')]),
}
def menu_create(self, cr, uid, ids, context=None):
"""
Creates Menus for selected custom section
"""
data_obj = self.pool.get('ir.model.data')
for this in self.browse(cr, uid, ids, context=context):
domain = [('section_id', '=', this.section_id.id)]
view_mode = [this.view_tree and 'tree', this.view_form and 'form', this.view_calendar and 'calendar']
view_mode = filter(None , view_mode)
action_id = self.pool.get('ir.actions.act_window').create(cr,uid, {
'name': this.name,
'res_model': 'crm.case.custom',
'domain': domain,
'view_type': 'form',
'view_mode': ','.join(view_mode),
'search_view_id': this.view_search.id or False,
'context': {'default_section_id': this.section_id.id, 'default_user_id': uid}
})
menu_id=self.pool.get('ir.ui.menu').create(cr, uid, {
'name': this.name,
'parent_id': this.menu_parent_id.id,
'icon': 'STOCK_JUSTIFY_FILL'
})
self.pool.get('ir.values').create(cr, uid, {
'name': 'Custom Cases',
'key2': 'tree_but_open',
'model': 'ir.ui.menu',
'res_id': menu_id,
'value': 'ir.actions.act_window,%d'%action_id,
'object': True
})
return {}
crm_case_custom_create_menu()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="crm_custom_create_menu_form">
<field name="name">crm.custom.create.menu.form</field>
<field name="model">crm.custom.create.menu</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Create Menu for Custom Cases">
<separator string="Menu Information" colspan="4"/>
<field name="name"/>
<field name="menu_parent_id"/>
<field name="section_id"/>
<separator string="Select Views (Empty for Default)" colspan="4"/>
<field name="view_form"/>
<field name="view_tree"/>
<field name="view_calendar"/>
<field name="view_search"/>
<separator string="" colspan="4"/>
<label string="" colspan="2"/>
<button special="cancel" string="_Cancel" icon="gtk-cancel"/>
<button name="menu_create" string="Create _Menu" type="object" icon='gtk-ok'/>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="crm_custom_create_menu_action">
<field name="name">Create Menu</field>
<field name="res_model">crm.custom.create.menu</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -30,9 +30,13 @@
<group string="res_config_contents" position="replace">
<field name="host"/>
</group>
<<<<<<< TREE
<xpath expr="//button[@string='Install Modules']" position="attributes">
<attribute name="string">Configure</attribute>
</xpath>
=======
<xpath expr="//button[@name='action_skip']" position="replace"/>
>>>>>>> MERGE-SOURCE
</data>
</field>
</record>

View File

@ -16,7 +16,7 @@
</separator>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">After having installed the core manufacturing application, you can extend it depending on the needs of your MRP's organization</attribute>
<attribute name="string">Add more functionalities to the core Manufacturing Application with the following addons.</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='string'></attribute>

View File

@ -27,6 +27,8 @@ from tools.translate import _
from osv import fields, osv
from tools import email_send as email
from operator import itemgetter
class project_task_type(osv.osv):
_name = 'project.task.type'
_description = 'Task Stage'
@ -395,7 +397,7 @@ class task(osv.osv):
if task['date_start'] > task['date_end']:
return False
return True
def _is_template(self, cr, uid, ids, field_name, arg, context=None):
res = {}
for task in self.browse(cr, uid, ids, context=context):
@ -451,9 +453,34 @@ class task(osv.osv):
}
_order = "sequence, priority, date_start, id"
def _check_recursion(self, cr, uid, ids):
obj_task = self.browse(cr, uid, ids[0])
parent_ids = [x.id for x in obj_task.parent_ids]
children_ids = [x.id for x in obj_task.child_ids]
if (obj_task.id in children_ids) or (obj_task.id in parent_ids):
return False
while(ids):
cr.execute('SELECT DISTINCT task_id '\
'FROM project_task_parent_rel '\
'WHERE parent_id IN %s', (tuple(ids),))
child_ids = map(itemgetter(0), cr.fetchall())
c_ids = child_ids
if (list(set(parent_ids).intersection(set(c_ids)))) or (obj_task.id in c_ids):
return False
while len(c_ids):
s_ids = self.search(cr, uid, [('parent_ids', 'in', c_ids)])
if (list(set(parent_ids).intersection(set(s_ids)))):
return False
c_ids = s_ids
ids = child_ids
return True
_constraints = [
(_check_dates, 'Error! Task start-date must be lower then task end-date.', ['date_start', 'date_end'])
(_check_dates, 'Error! Task start-date must be lower then task end-date.', ['date_start', 'date_end']),
(_check_recursion, _('Error ! You cannot create recursive tasks.'), ['parent_ids'])
]
#
# Override view according to the company definition

View File

@ -116,7 +116,7 @@ class project_phase(osv.osv):
'sequence': 10,
'product_uom': lambda self,cr,uid,c: self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Day'))], context=c)[0]
}
_order = "name"
_order = "project_id, date_start, sequence, name"
_constraints = [
(_check_recursion,'Loops in phases not allowed',['next_phase_ids', 'previous_phase_ids']),
(_check_dates, 'Phase start-date must be lower than phase end-date.', ['date_start', 'date_end']),

View File

@ -10,7 +10,7 @@
<xpath expr="//page[@string='Tasks Stages']" position="after">
<page string="Messages" groups="base.group_extended">
<field name="message_ids" nolabel="1" colspan="4">
<tree editable="1">
<tree editable="1" string="Messages">
<field name="message" attrs="{'readonly':[('from_id', '!=', uid)]}"/>
<field name="from_id"/>
<field name="to_id" attrs="{'readonly':[('from_id', '!=', uid)]}"/>

View File

@ -20,7 +20,7 @@
</separator>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">In this page, you can extend your purchases Application with purchase requisition facility and analytic distribution of purchase orders.</attribute>
<attribute name="string">Extend your Purchases Management Application with purchase requisition facility and analytic distribution of purchase orders.</attribute>
</xpath>
<xpath expr="//button[@string='Install Modules']" position="attributes">
<attribute name="string">Configure</attribute>

View File

@ -16,7 +16,7 @@
</separator>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">After having installed the core sales application, you can extend it depending on the needs of your sale's organization.</attribute>
<attribute name="string">Add more functionalities to the core Sales Application with the following addons.</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='string'></attribute>

View File

@ -524,7 +524,7 @@ to your configuration: from the sales order, from the pickings, etc.
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Sales Configuration</attribute>
<attribute name="string">Sales Application Configuration</attribute>
</form>
<separator string="title" position="attributes">
<attribute name="string"
@ -545,6 +545,7 @@ to your configuration: from the sales order, from the pickings, etc.
<field name="step"/>
</group>
<xpath expr='//button[@name="action_skip"]' position='replace'/>
</data>
</field>
</record>