bzr revid: jni@tinyerp.co.in-20100426061109-265si9a0gk6opfo8
This commit is contained in:
Jni (Open ERP)
2010-04-26 11:41:09 +05:30
83 changed files with 2703 additions and 1488 deletions
+13 -7
View File
@@ -46,14 +46,18 @@ module named account_voucherss
'security/account_security.xml',
'security/ir.model.access.csv',
'account_menuitem.xml',
'account_wizard.xml',
'wizard/account_statement_from_invoice_view.xml',
'wizard/account_move_bank_reconcile_view.xml',
'wizard/account_use_model_view.xml',
'account_view.xml',
'account_report.xml',
'wizard/account_invoice_refund_view.xml',
'wizard/account_period_close_view.xml',
'wizard/account_fiscalyear_close_state.xml',
'wizard/account_chart_view.xml',
'wizard/account_move_bank_reconcile_view.xml',
'wizard/account_move_line_reconcile_select_view.xml',
'wizard/account_move_journal_view.xml',
'account_wizard.xml',
'wizard/account_move_line_reconcile_select_view.xml',
'wizard/account_open_closed_fiscalyear_view.xml',
'wizard/account_move_line_unreconcile_select_view.xml',
'wizard/account_vat_view.xml',
@@ -66,17 +70,19 @@ module named account_voucherss
'wizard/account_journal_select_view.xml',
'wizard/account_change_currency_view.xml',
'wizard/account_validate_move_view.xml',
'wizard/account_statement_from_invoice_view.xml',
'wizard/account_pay_invoice_view.xml',
'wizard/account_unreconcile_view.xml',
'wizard/account_general_ledger_report_view.xml',
'wizard/account_invoice_state_view.xml',
'wizard/account_use_model_view.xml',
'wizard/account_partner_balance_report_view.xml',
'wizard/account_balance_report_view.xml',
'wizard/account_move_line_select_view.xml',
'wizard/account_aged_trial_balance_view.xml',
'wizard/account_compare_account_balance_report_view.xml',
'wizard/account_third_party_ledger.xml',
'project/wizard/project_account_analytic_line_view.xml',
'account_view.xml',
'account_end_fy.xml',
'account_invoice_view.xml',
'account_report.xml',
'partner_view.xml',
'data/account_invoice.xml',
'data/account_data2.xml',
+18 -12
View File
@@ -291,7 +291,7 @@ class account_account(osv.osv):
"special effects in Open ERP: view can not have entries, consolidation are accounts that "\
"can have children accounts for multi-company consolidations, payable/receivable are for "\
"partners accounts (for debit/credit computations), closed for depreciated accounts."),
'user_type': fields.many2one('account.account.type', 'Account Type', required=True,
'user_type': fields.many2one('account.account.type', 'Account Type', required=True,
help="These types are defined according to your country. The type contains more information "\
"about the account and its specificities."),
'parent_id': fields.many2one('account.account', 'Parent', ondelete='cascade'),
@@ -437,18 +437,18 @@ class account_account(osv.osv):
elif method == 'unlink':
raise osv.except_osv(_('Error !'), _('You cannot remove an account which has account entries!. '))
return True
def write(self, cr, uid, ids, vals, context=None):
if not context:
context = {}
if 'active' in vals and not vals['active']:
self._check_moves(cr, uid, ids, "write", context)
return super(account_account, self).write(cr, uid, ids, vals, context=context)
def unlink(self, cr, uid, ids, context={}):
self._check_moves(cr, uid, ids, "unlink", context)
return super(account_account, self).unlink(cr, uid, ids, context)
account_account()
class account_journal_view(osv.osv):
@@ -791,7 +791,7 @@ class account_move(osv.osv):
for id in ids:
result.setdefault(id, 0.0)
return result
def _search_amount(self, cr, uid, obj, name, args, context):
ids = []
cr.execute('select move_id,sum(debit) from account_move_line group by move_id')
@@ -801,10 +801,10 @@ class account_move(osv.osv):
if item[1] == '>=':
res = [('id', 'in', [k for k,v in result.iteritems() if v >= item[2]])]
else:
res = [('id', 'in', [k for k,v in result.iteritems() if v <= item[2]])]
res = [('id', 'in', [k for k,v in result.iteritems() if v <= item[2]])]
ids += res
if not ids:
if not ids:
return [('id', '>', '0')]
return ids
@@ -1056,7 +1056,13 @@ class account_move(osv.osv):
if line.account_id.currency_id.id != line.currency_id.id and (line.account_id.currency_id.id != line.account_id.company_id.currency_id.id or line.currency_id):
raise osv.except_osv(_('Error'), _("""Couldn't create move with currency different from the secondary currency of the account "%s - %s". Clear the secondary currency field of the account definition if you want to accept all currencies.""" % (line.account_id.code, line.account_id.name)))
if abs(amount) < 0.0001:
# Check that the move balances, the tolerance for debit/credit must
# be smaller than the smallest value according to price accuracy
# (hence the +1 below)
# Example:
# difference == 0.01 is OK iff price_accuracy <= 1!
# difference == 0.0001 is OK iff price_accuracy <= 3!
if abs(amount) < 10 ** -(int(config['price_accuracy'])):
if not len(line_draft_ids):
continue
self.pool.get('account.move.line').write(cr, uid, line_draft_ids, {
@@ -1126,7 +1132,7 @@ class account_move_reconcile(osv.osv):
'name': lambda self,cr,uid,ctx={}: self.pool.get('ir.sequence').get(cr, uid, 'account.reconcile') or '/',
}
def reconcile_partial_check(self, cr, uid, ids, type='auto', context={}):
total = 0.0
total = 0.0
for rec in self.browse(cr, uid, ids, context):
for line in rec.line_partial_ids:
total += (line.debit or 0.0) - (line.credit or 0.0)
@@ -1880,7 +1886,7 @@ account_account_template()
class account_add_tmpl_wizard(osv.osv_memory):
"""Add one more account from the template.
With the 'nocreate' option, some accounts may not be created. Use this to add them later."""
_name = 'account.addtmpl.wizard'
@@ -1906,7 +1912,7 @@ class account_add_tmpl_wizard(osv.osv_memory):
_defaults = {
'cparent_id': _get_def_cparent,
}
def action_create(self,cr,uid,ids,context=None):
acc_obj=self.pool.get('account.account')
tmpl_obj=self.pool.get('account.account.template')
@@ -1933,7 +1939,7 @@ class account_add_tmpl_wizard(osv.osv_memory):
# print "Creating:", vals
new_account = acc_obj.create(cr,uid,vals)
return {'type':'state', 'state': 'end' }
def action_cancel(self,cr,uid,ids,context=None):
return { 'type': 'state', 'state': 'end' }
+8 -8
View File
@@ -1382,14 +1382,14 @@
<field name="domain">[('account_id','child_of', [active_id]),('state','&lt;&gt;','draft')]</field>
<field name="context">{'account_id':active_id}</field>
</record>
<wizard id="wizard_move_line_select" menu="False" model="account.move.line" name="account.move.line.select" string="Move line select"/>
<record id="ir_open_account_account" model="ir.values">
<field eval="'tree_but_open'" name="key2"/>
<field eval="'account.account'" name="model"/>
<field name="name">Account Entries</field>
<field eval="'ir.actions.wizard,%d'%wizard_move_line_select" name="value"/>
<field eval="True" name="object"/>
</record>
<!-- <wizard id="wizard_move_line_select" menu="False" model="account.move.line" name="account.move.line.select" string="Move line select"/>-->
<!-- <record id="ir_open_account_account" model="ir.values">-->
<!-- <field eval="'tree_but_open'" name="key2"/>-->
<!-- <field eval="'account.account'" name="model"/>-->
<!-- <field name="name">Account Entries</field>-->
<!-- <field eval="'ir.actions.wizard,%d'%wizard_move_line_select" name="value"/>-->
<!-- <field eval="True" name="object"/>-->
<!-- </record>-->
<record id="view_move_line_tax_tree" model="ir.ui.view">
+19 -17
View File
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<wizard
string="Account balance-Compare Years"
model="account.account"
name="account.balance.account.balance.report"
keyword="client_print_multi"
id="wizard_account_balance_compare_report"/>
<!-- <wizard-->
<!-- string="Account balance-Compare Years"-->
<!-- model="account.account"-->
<!-- name="account.balance.account.balance.report"-->
<!-- keyword="client_print_multi"-->
<!-- id="wizard_account_balance_compare_report"/>-->
<!-- <wizard id="wizard_invoice_refund" model="account.invoice" name="account.invoice.refund" string="Credit Note" groups="base.group_user"/> -->
@@ -71,19 +71,21 @@
<menuitem action="wizard_generate_subscription" id="menu_generate_subscription" parent="account.menu_finance_periodical_processing" type="wizard"/>
-->
<!-- Aged partner balance -->
<wizard id="wizard_aged_trial_balance" menu="False" model="res.partner" name="account.aged.trial.balance" string="Aged Partner Balance"/>
<menuitem id="next_id_22" name="Partner Accounts" parent="menu_finance_generic_reporting" sequence="1"/>
<menuitem icon="STOCK_PRINT" action="wizard_aged_trial_balance" id="menu_aged_trial_balance" parent="next_id_22" type="wizard"/>
<!-- <wizard id="wizard_aged_trial_balance" menu="False" model="res.partner" name="account.aged.trial.balance" string="Aged Partner Balance"/>
<menuitem icon="STOCK_PRINT" action="wizard_aged_trial_balance" id="menu_aged_trial_balance" parent="next_id_22" type="wizard"/>-->
<!-- report-related wizards -->
<!-- <wizard id="wizard_partner_balance_report" menu="False" model="res.partner" name="account.partner.balance.report" string="Partner Balance"/>
<menuitem icon="STOCK_PRINT" action="wizard_partner_balance_report" id="menu_partner_balance" parent="account.next_id_22" type="wizard"/> -->
<!-- <menuitem id="next_id_22" name="Partner Accounts" parent="menu_finance_generic_reporting" sequence="1"/>
<wizard id="wizard_third_party_ledger" menu="False" model="res.partner" name="account.third_party_ledger.report" string="Partner Ledger"/>
<menuitem icon="STOCK_PRINT" action="wizard_third_party_ledger" id="menu_third_party_ledger" parent="account.next_id_22" type="wizard"/>
<menuitem icon="STOCK_PRINT" action="wizard_third_party_ledger" id="menu_third_party_ledger" parent="account.next_id_22" type="wizard"/> -->
<!-- <wizard id="wizard_general_ledger_report" keyword="client_print_multi" model="account.account" name="account.general.ledger.report" string="General Ledger"/>-->
<!-- <wizard id="wizard_balance_report" keyword="client_print_multi" model="account.account" name="account.account.balance.report" string="Account Balance"/>-->
<wizard id="wizard_balance_report" keyword="client_print_multi" model="account.account" name="account.account.balance.report" string="Account Balance"/>
<wizard id="wizard_general_ledger_report" keyword="client_print_multi" model="account.account" name="account.general.ledger.report" string="General Ledger"/>
<!-- <wizard id="wizard_invoice_state_confirm" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.confirm" string="Confirm draft invoices" groups="base.group_user"/>-->
<!-- <wizard id="wizard_invoice_state_cancel" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.cancel" string="Cancel selected invoices" groups="base.group_user"/>-->
@@ -105,11 +107,11 @@
<!-- <wizard string="Open State" model="account.invoice" name="account.wizard_paid_open" menu="False" id="wizard_paid_open" groups="base.group_user"/> -->
<!-- generic report wizard -->
<wizard id="wizard_account_balance_report" menu="False" model="account.account" name="account.account.balance.report" string="Account Balance"/>
<menuitem icon="STOCK_PRINT" action="wizard_account_balance_report" id="menu_account_balance_report" parent="account.menu_generic_report" type="wizard"/>
<!-- <wizard id="wizard_account_balance_report" menu="False" model="account.account" name="account.account.balance.report" string="Account Balance"/>-->
<!-- <menuitem icon="STOCK_PRINT" action="wizard_account_balance_report" id="menu_account_balance_report" parent="account.menu_generic_report" type="wizard"/>-->
<wizard id="wizard_general_ledger" menu="False" model="account.account" name="account.general.ledger.report" string="General Ledger"/>
<menuitem icon="STOCK_PRINT" action="wizard_general_ledger" id="menu_general_ledger" parent="account.menu_generic_report" type="wizard"/>
<!-- <wizard id="wizard_general_ledger" menu="False" model="account.account" name="account.general.ledger.report" string="General Ledger"/>
<menuitem icon="STOCK_PRINT" action="wizard_general_ledger" id="menu_general_ledger" parent="account.menu_generic_report" type="wizard"/>-->
<!-- <wizard id="wizard_print_journal" menu="False" model="account.journal.period" name="account.print.journal.report" string="Print Journal" />
<menuitem icon="STOCK_PRINT" action="wizard_print_journal" id="menu_print_journal" parent="account.menu_generic_report" type="wizard" />
+10 -10
View File
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2010-04-11 12:31+0000\n"
"PO-Revision-Date: 2010-04-25 17:34+0000\n"
"Last-Translator: Grzegorz Grzelak (Cirrus.pl) <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-17 04:07+0000\n"
"X-Launchpad-Export-Date: 2010-04-26 03:42+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
@@ -1121,7 +1121,7 @@ msgstr "Wylicz kod dla cen z podatkiem"
#: model:ir.actions.act_window,name:account.action_tax_code_list
#: model:ir.ui.menu,name:account.menu_action_tax_code_list
msgid "Tax codes"
msgstr "Prawa podatkowe"
msgstr "Rejestr podatkowy"
#. module: account
#: field:account.fiscal.position.template,chart_template_id:0
@@ -1151,7 +1151,7 @@ msgstr "Szablony obszarów podatkowych"
#: rml:account.invoice:0
#: field:account.invoice.line,price_unit:0
msgid "Unit Price"
msgstr "Cena jednostkowa"
msgstr "Cena jedn."
#. module: account
#: rml:account.analytic.account.journal:0
@@ -1562,7 +1562,7 @@ msgstr "Szablony planu kont"
#. module: account
#: field:account.invoice,move_id:0
msgid "Invoice Movement"
msgstr "Zapisy faktury"
msgstr "Nr zapisu faktury"
#. module: account
#: model:ir.actions.act_window,name:account.action_wizard_multi_chart
@@ -2042,7 +2042,7 @@ msgstr "Dziennik - nazwa okresu"
#: field:account.tax.code,name:0
#: field:account.tax.code.template,name:0
msgid "Tax Case Name"
msgstr ""
msgstr "Nazwa rejestru"
#. module: account
#: help:account.journal,entry_posted:0
@@ -3077,7 +3077,7 @@ msgstr "Zapis dla tej pozycji."
#. module: account
#: field:account.invoice.line,uos_id:0
msgid "Unit of Measure"
msgstr "Jednostka miary"
msgstr "Jedn. miary"
#. module: account
#: field:account.chart.template,property_account_receivable:0
@@ -4095,7 +4095,7 @@ msgstr "Kwota opodatkowana"
#. module: account
#: field:account.invoice.line,price_subtotal:0
msgid "Subtotal w/o tax"
msgstr "Suma częściowa bez podatku"
msgstr "Wartość"
#. module: account
#: field:account.invoice.line,invoice_id:0
@@ -5041,7 +5041,7 @@ msgstr "Opis podatku"
#. module: account
#: help:account.invoice,move_id:0
msgid "Link to the automatically generated account moves."
msgstr "Łącznik do automatycznie wygenerowanych zapisów konta."
msgstr "Numer automatycznie wygenerowanego zapisu konta."
#. module: account
#: wizard_field:account.automatic.reconcile,reconcile,reconciled:0
@@ -5771,7 +5771,7 @@ msgstr ""
#: field:account.tax.code,code:0
#: field:account.tax.code.template,code:0
msgid "Case Code"
msgstr ""
msgstr "Kod rejestru"
#. module: account
#: selection:account.automatic.reconcile,init,power:0
+4 -4
View File
@@ -8,19 +8,19 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2009-09-08 15:51+0000\n"
"Last-Translator: Fabien (Open ERP) <fp@tinyerp.com>\n"
"PO-Revision-Date: 2010-04-25 12:11+0000\n"
"Last-Translator: Dragan Životić <dragan_zivotic@yahoo.com>\n"
"Language-Team: Serbian <sr@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-17 04:07+0000\n"
"X-Launchpad-Export-Date: 2010-04-26 03:42+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
#: field:account.tax.template,description:0
msgid "Internal Name"
msgstr "Interni naziv"
msgstr "Interno ime"
#. module: account
#: view:account.tax.code:0
+3 -2
View File
@@ -29,6 +29,7 @@ from report import report_sxw
class account_balance(report_sxw.rml_parse):
_name = 'report.account.account.balance'
def __init__(self, cr, uid, name, context):
print " KKKKKKKKKKKKKKKKKKKKKKKK"
super(account_balance, self).__init__(cr, uid, name, context=context)
self.sum_debit = 0.00
self.sum_credit = 0.00
@@ -95,12 +96,12 @@ class account_balance(report_sxw.rml_parse):
ctx['state'] = form['context'].get('state','all')
ctx['fiscalyear'] = form['fiscalyear']
if form['state']=='byperiod' :
ctx['periods'] = form['periods'][0][2]
ctx['periods'] = form['periods']
elif form['state']== 'bydate':
ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to']
elif form['state'] == 'all' :
ctx['periods'] = form['periods'][0][2]
ctx['periods'] = form['periods']
ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to']
# accounts = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx)
@@ -368,15 +368,15 @@ class account_balance_landscape(rml_parse.rml_parse):
self.total_for_perc=self.linesForTotal(form,ids={},doneAccount={},level=1)
self.done_total=0
for t1 in range(0,len(form['fiscalyear'][0][2])):
for t1 in range(0,len(form['fiscalyear'])):
locale.setlocale(locale.LC_ALL, '')
self.result_total["sum_credit" + str(t1)]=locale.format("%.2f", self.result_total["sum_credit" + str(t1)], grouping=True)
self.result_total["sum_debit" + str(t1)]=locale.format("%.2f", self.result_total["sum_debit" + str(t1)], grouping=True)
# self.flag=1
# self.result_total = {}
for temp in range(0,len(form['fiscalyear'][0][2])):
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][0][2][temp])
for temp in range(0,len(form['fiscalyear'])):
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][temp])
years["year"+str(temp)]=fy[0][1][12:16]
return [years]
@@ -396,11 +396,11 @@ class account_balance_landscape(rml_parse.rml_parse):
ctx = self.context.copy()
result_total_parent=[]
for id in form['fiscalyear'][0][2]:
for id in form['fiscalyear']:
tmp=[]
ctx['fiscalyear'] = id
ctx['periods'] = form['periods'][0][2]
ctx['periods'] = form['periods']
ctx['period_manner'] = form['period_manner']
ctx['state'] = form['context'].get('state','all')
tmp = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
@@ -456,10 +456,10 @@ class account_balance_landscape(rml_parse.rml_parse):
result = []
ctx = self.context.copy()
tmp1=[]
for id in form['fiscalyear'][0][2]:
for id in form['fiscalyear']:
ctx['fiscalyear'] = id
ctx['periods'] = form['periods'][0][2]
ctx['periods'] = form['periods']
ctx['period_manner']=form['period_manner']
ctx['state'] = form['context'].get('state','all')
tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids,ctx.copy())
@@ -575,7 +575,7 @@ class account_balance_landscape(rml_parse.rml_parse):
if entry[0].child_id:
for q in range(0,len(form['fiscalyear'][0][2])):
for q in range(0,len(form['fiscalyear'])):
self.baldiv["baldiv"+str(level)+str(q)]=entry[q].balance
ids2 = [(x.code,x.id) for x in entry[0].child_id]
@@ -583,7 +583,7 @@ class account_balance_landscape(rml_parse.rml_parse):
dir=[]
dir += self.lines(form, [x[1] for x in ids2], done, level+1)
if dir==[]:
for w in range(0,len(form['fiscalyear'][0][2])):
for w in range(0,len(form['fiscalyear'])):
if entry[w].credit <> 0.0 or entry[w].debit <> 0.0 or entry[w].balance<>0.00:
dont_pop=1
break
@@ -601,9 +601,9 @@ class account_balance_landscape(rml_parse.rml_parse):
def get_years(self,form):
result =[]
res={}
for temp in range(0,len(form['fiscalyear'][0][2])):
for temp in range(0,len(form['fiscalyear'])):
res={}
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][0][2][temp])
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][temp])
res['year']=fy[0][1]
res['last_str']=temp
+1 -2
View File
@@ -18,8 +18,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import pooler
import rml_parse
from report import report_sxw
@@ -45,7 +45,6 @@ class aged_trial_report(rml_parse.rml_parse):
def _get_lines(self, form):
if (form['result_selection'] == 'customer' ):
self.ACCOUNT_TYPE = ['receivable']
elif (form['result_selection'] == 'supplier'):
@@ -368,15 +368,15 @@ class account_balance(report_sxw.rml_parse):
self.total_for_perc=self.linesForTotal(form,ids={},doneAccount={},level=1)
self.done_total=0
for t1 in range(0,len(form['fiscalyear'][0][2])):
for t1 in range(0,len(form['fiscalyear'])):
locale.setlocale(locale.LC_ALL, '')
self.result_total["sum_credit" + str(t1)]=locale.format("%.2f", self.result_total["sum_credit" + str(t1)], grouping=True)
self.result_total["sum_debit" + str(t1)]=locale.format("%.2f", self.result_total["sum_debit" + str(t1)], grouping=True)
# self.flag=1
# self.result_total = {}
for temp in range(0,len(form['fiscalyear'][0][2])):
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][0][2][temp])
for temp in range(0,len(form['fiscalyear'])):
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][temp])
years["year"+str(temp)]=fy[0][1][12:16]
return [years]
@@ -395,11 +395,11 @@ class account_balance(report_sxw.rml_parse):
ctx = self.context.copy()
result_total_parent=[]
for id in form['fiscalyear'][0][2]:
for id in form['fiscalyear']:
tmp=[]
ctx['fiscalyear'] = id
ctx['periods'] = form['periods'][0][2]
ctx['periods'] = form['periods']
ctx['period_manner'] = form['period_manner']
ctx['state'] = form['context'].get('state','all')
tmp = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
@@ -453,10 +453,10 @@ class account_balance(report_sxw.rml_parse):
result = []
ctx = self.context.copy()
tmp1=[]
for id in form['fiscalyear'][0][2]:
for id in form['fiscalyear']:
ctx['fiscalyear'] = id
ctx['periods'] = form['periods'][0][2]
ctx['periods'] = form['periods']
ctx['period_manner']=form['period_manner']
ctx['state'] = form['context'].get('state','all')
tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids,ctx.copy())
@@ -571,7 +571,7 @@ class account_balance(report_sxw.rml_parse):
if entry[0].child_id:
for q in range(0,len(form['fiscalyear'][0][2])):
for q in range(0,len(form['fiscalyear'])):
self.baldiv["baldiv"+str(level)+str(q)]=entry[q].balance
ids2 = [(x.code,x.id) for x in entry[0].child_id]
@@ -579,7 +579,7 @@ class account_balance(report_sxw.rml_parse):
dir=[]
dir += self.lines(form, [x[1] for x in ids2], done, level+1)
if dir==[]:
for w in range(0,len(form['fiscalyear'][0][2])):
for w in range(0,len(form['fiscalyear'])):
if entry[w].credit <> 0.0 or entry[w].debit <> 0.0 or entry[w].balance<>0.00:
dont_pop=1
break
@@ -597,9 +597,9 @@ class account_balance(report_sxw.rml_parse):
def get_years(self,form):
result =[]
res={}
for temp in range(0,len(form['fiscalyear'][0][2])):
for temp in range(0,len(form['fiscalyear'])):
res={}
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][0][2][temp])
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][temp])
res['year']=fy[0][1]
res['last_str']=temp
+11 -8
View File
@@ -41,7 +41,7 @@ class general_ledger(rml_parse.rml_parse):
##
new_ids = []
if (data['model'] == 'account.account'):
new_ids = ids
new_ids = 'active_ids' in data['form']['context'] and data['form']['context']['active_ids'] or []
else:
new_ids.append(data['form']['Account_list'])
@@ -117,7 +117,7 @@ class general_ledger(rml_parse.rml_parse):
borne_max = res[0]['stop_date']
if form['state'] == 'byperiod':
## This function will return the most aged date
periods = form['periods'][0][2]
periods = form['periods']
if not periods:
self.cr.execute("""
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = %s""",(form['fiscalyear'],))
@@ -131,13 +131,16 @@ class general_ledger(rml_parse.rml_parse):
borne_min = form['date_from']
borne_max = form['date_to']
elif form['state'] == 'all':
periods = form['periods'][0][2]
periods = form['periods']
if not periods:
self.cr.execute("""
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = %s""",(form['fiscalyear'],))
if form['fiscalyear'] == False:
fiscalyears = self.pool.get('account.fiscalyear').search(self.cr, self.uid, [('state', '=', 'draft')])
else:
fiscalyears = [form['fiscalyear']]
self.cr.execute("select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id =ANY(%s)" ,(fiscalyears,))
else:
self.cr.execute("""
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id =ANY(%s)""",(periods,))
self.cr.execute("""
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id =ANY(%s)""",(periods,))
res = self.cr.dictfetchall()
period_min = res[0]['start_date']
period_max = res[0]['stop_date']
@@ -180,7 +183,7 @@ class general_ledger(rml_parse.rml_parse):
ctx['state'] = form['context'].get('state','all')
if form.has_key('fiscalyear'):
ctx['fiscalyear'] = form['fiscalyear']
ctx['periods'] = form['periods'][0][2]
ctx['periods'] = form['periods']
else:
ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to']
@@ -42,12 +42,10 @@ class general_ledger_landscape(rml_parse.rml_parse):
##
new_ids = []
if (data['model'] == 'account.account'):
new_ids = ids
new_ids = 'active_ids' in data['form']['context'] and data['form']['context']['active_ids'] or []
else:
new_ids.append(data['form']['Account_list'])
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
super(general_ledger_landscape, self).set_context(objects, data, new_ids,report_type)
def __init__(self, cr, uid, name, context):
@@ -118,7 +116,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
borne_max = res[0]['stop_date']
if form['state'] == 'byperiod':
## This function will return the most aged date
periods = form['periods'][0][2]
periods = form['periods']
if not periods:
self.cr.execute("""
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = %s""" ,(form['fiscalyear'],))
@@ -133,11 +131,13 @@ class general_ledger_landscape(rml_parse.rml_parse):
borne_min = form['date_from']
borne_max = form['date_to']
elif form['state'] == 'all':
periods = form['periods'][0][2]
periods = form['periods']
if not periods:
self.cr.execute("""
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = = %s""" ,(form['fiscalyear'],))
if form['fiscalyear'] == False:
fiscalyears = self.pool.get('account.fiscalyear').search(self.cr, self.uid, [('state', '=', 'draft')])
else:
fiscalyears = [form['fiscalyear']]
self.cr.execute("select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id =ANY(%s)" ,(fiscalyears,))
else:
self.cr.execute("""
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id =ANY(%s)""",(periods,))
@@ -182,7 +182,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
ctx['state'] = form['context'].get('state','all')
if form.has_key('fiscalyear'):
ctx['fiscalyear'] = form['fiscalyear']
ctx['periods'] = form['periods'][0][2]
ctx['periods'] = form['periods']
else:
ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to']
+4 -4
View File
@@ -59,10 +59,10 @@ class third_party_ledger(rml_parse.rml_parse):
#
def transform_period_into_date_array(self,data):
## Get All Period Date
if not data['form']['periods'][0][2] :
if not data['form']['periods']:
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
else:
periods_id = data['form']['periods'][0][2]
periods_id = data['form']['periods']
date_array = []
for period_id in periods_id:
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
@@ -77,10 +77,10 @@ class third_party_ledger(rml_parse.rml_parse):
def transform_both_into_date_array(self,data):
if not data['form']['periods'][0][2] :
if not data['form']['periods']:
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
else:
periods_id = data['form']['periods'][0][2]
periods_id = data['form']['periods']
date_array = []
for period_id in periods_id:
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
+6 -6
View File
@@ -30,21 +30,21 @@ import account_move_journal
import account_journal_select
import account_move_bank_reconcile
import account_subscription_generate
import wizard_aged_trial_balance
import wizard_general_ledger_report
import wizard_third_party_ledger
import account_aged_trial_balance
import account_general_ledger_report
import account_third_party_ledger
import account_partner_balance_report
import account_balance_report
import account_period_close
import account_fiscalyear_close
import account_fiscalyear_close_state
import account_vat
import account_open_closed_fiscalyear
import wizard_compare_account_balance_report
import account_compare_account_balance_report
import account_invoice_state
import wizard_account_duplicate
import account_chart
import wizard_move_line_select
import account_move_line_select
import account_validate_account_move
import account_use_model
+106
View File
@@ -0,0 +1,106 @@
# -*- 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/>.
#
##############################################################################
import time
import datetime
from mx.DateTime import *
from osv import osv, fields
from tools.translate import _
class account_aged_trial_balance(osv.osv_memory):
_name = 'account.aged.trial.balance'
_description = 'Account Aged Trial balance Report'
_columns = {
'company_id': fields.many2one('res.company', 'Company', required=True),
'period_length':fields.integer('Period length (days)', required=True),
'date1': fields.date('Start of period', required=True),
'result_selection': fields.selection([('customer','Receivable'),
('supplier','Payable'),
('all','Receivable and Payable')],
'Filter on Partners', required=True),
'direction_selection': fields.selection([('past','Past'),
('future','Future')],
'Analysis Direction', required=True),
}
def _get_company(self, cr, uid, ids, context=None):
user_obj = self.pool.get('res.users')
company_obj = self.pool.get('res.company')
if context is None:
context = {}
user = user_obj.browse(cr, uid, uid, context=context)
if user.company_id:
return user.company_id.id
else:
return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
_defaults = {
'company_id' : _get_company,
'period_length' : 30,
'date1' : time.strftime('%Y-%m-%d'),
'result_selection' : 'all',
'direction_selection' : 'past',
}
def calc_dates(self, cr, uid, ids, context=None):
fiscalyear_obj = self.pool.get('account.fiscalyear')
data={}
res = {}
if context is None:
context = {}
data['ids'] = context.get('active_ids',[])
data['model'] = 'res.partner'
data['form'] = self.read(cr, uid, ids, [])[0]
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
period_length = data['form']['period_length']
if period_length<=0:
raise osv.except_osv(_('UserError'), _('You must enter a period length that cannot be 0 or below !'))
start = datetime.date.fromtimestamp(time.mktime(time.strptime(data['form']['date1'],"%Y-%m-%d")))
start = DateTime(int(start.year),int(start.month),int(start.day))
if data['form']['direction_selection'] == 'past':
for i in range(5)[::-1]:
stop = start - RelativeDateTime(days=period_length)
res[str(i)] = {
'name' : str((5-(i+1))*period_length) + '-' + str((5-i)*period_length),
'stop': start.strftime('%Y-%m-%d'),
'start' : stop.strftime('%Y-%m-%d'),
}
start = stop - RelativeDateTime(days=1)
else:
for i in range(5):
stop = start + RelativeDateTime(days=period_length)
res[str(5-(i+1))] = {
'name' : str((i)*period_length)+'-'+str((i+1)*period_length),
'start': start.strftime('%Y-%m-%d'),
'stop' : stop.strftime('%Y-%m-%d'),
}
start = stop + RelativeDateTime(days=1)
data['form'].update(res)
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.aged_trial_balance',
'datas': data,
}
account_aged_trial_balance()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<menuitem id="next_id_22"
name="Partner Accounts"
parent="menu_finance_generic_reporting"
sequence="1"/>
<record id="account_aged_balance_view" model="ir.ui.view">
<field name="name">Aged Partner Balance</field>
<field name="model">account.aged.trial.balance</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Print Aged Trial Balance">
<field name="company_id"/>
<newline/>
<field name="date1"/>
<field name="period_length"/>
<newline/>
<field name="result_selection"/>
<newline/>
<field name="direction_selection"/>
<newline/>
<group colspan="4" col="6">
<separator colspan="6"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="calc_dates" string="Print" type="object" icon="gtk-print" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_aged_balance_view" model="ir.actions.act_window">
<field name="name">Aged Partner Balance</field>
<field name="res_model">account.aged.trial.balance</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="account_aged_balance_view"/>
<field name="context">{'record_id':active_id}</field>
<field name="target">new</field>
</record>
<menuitem
icon="STOCK_PRINT"
name="Aged Partner Balance"
action="action_account_aged_balance_view"
id="menu_aged_trial_balance"
parent="next_id_22"/>
</data>
</openerp>
@@ -0,0 +1,136 @@
# -*- 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/>.
#
##############################################################################
import time
from osv import osv, fields
from tools.translate import _
class account_balance_report(osv.osv_memory):
"""
This wizard will provide the account balance report by periods, between any two dates.
"""
_name = 'account.balance.report'
_description = 'Account Balance Report'
_columns = {
'Account_list': fields.many2one('account.account', 'Chart account',
required=True, domain = [('parent_id','=',False)]),
'company_id': fields.many2one('res.company', 'Company', required=True),
'display_account': fields.selection([('bal_mouvement','With movements'),
('bal_all','All'),
('bal_solde','With balance is not equal to 0'),
],'Display accounts'),
'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
'state': fields.selection([('bydate','By Date'),
('byperiod','By Period'),
('all','By Date and Period'),
('none','No Filter')
],'Date/Period Filter'),
'periods': fields.many2many('account.period', 'period_account_balance_rel',
'report_id', 'period_id', 'Periods',
help='Keep empty for all open fiscal year'),
'date_from': fields.date('Start date', required=True),
'date_to': fields.date('End date', required=True),
}
def _get_company(self, cr, uid, ids, context=None):
user_obj = self.pool.get('res.users')
company_obj = self.pool.get('res.company')
user = user_obj.browse(cr, uid, uid, context=context)
if user.company_id:
return user.company_id.id
else:
return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
_defaults={
'state' : 'none',
'date_from' : time.strftime('%Y-01-01'),
'date_to' : time.strftime('%Y-%m-%d'),
'company_id' : _get_company,
'fiscalyear' : False,
'display_account': 'bal_all',
}
def next_view(self, cr, uid, ids, context=None):
obj_model = self.pool.get('ir.model.data')
if context is None:
context = {}
data = self.read(cr, uid, ids, [])[0]
context.update({'Account_list': data['Account_list']})
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','account_balance_report_view')])
resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'account.balance.report',
'views': [(resource_id,'form')],
'type': 'ir.actions.act_window',
'target': 'new',
'context': context
}
def check_state(self, cr, uid, ids, context=None):
if context is None:
context = {}
data={}
data['ids'] = context['active_ids']
data['form'] = self.read(cr, uid, ids, ['date_from', 'company_id', 'state', 'periods', 'date_to', 'display_account', 'fiscalyear'])[0]
data['form']['Account_list'] = context.get('Account_list',[])
data['form']['context'] = context
if data['form']['Account_list']:
data['model'] = 'ir.ui.menu'
else:
data['model'] = 'account.account'
if data['form']['state'] == 'bydate' :
return self._check_date(cr, uid, data, context)
elif data['form']['state'] == 'byperiod':
if not data['form']['periods']:
raise osv.except_osv(_('Warning'),_('Please Enter Periods ! '))
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.account.balance',
'datas': data,
}
def _check_date(self, cr, uid, data, context=None):
if context is None:
context = {}
sql = """
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
cr.execute(sql,(data['form']['date_from'],))
res = cr.dictfetchall()
if res:
if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (res[0]['date_start'], res[0]['date_stop']))
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.account.balance',
'datas': data,
}
else:
raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
account_balance_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_balance_report_view" model="ir.ui.view">
<field name="name">Select period</field>
<field name="model">account.balance.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select period">
<field name="company_id"/>
<field name="display_account" required = "True"/>
<newline/>
<field name="fiscalyear"/>
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
<newline/>
<separator string="Filters" colspan="4"/>
<field name="state" required="True"/>
<newline/>
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
<separator string="Date Filter" colspan="4"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
<separator string="Filter on Periods" colspan="4"/>
<field name="periods" colspan="4" nolabel="1"/>
</group>
</group>
<newline/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_state" string="Print" type="object" icon="gtk-print" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_balance_report" model="ir.actions.act_window">
<field name="name">Account Balance</field>
<field name="res_model">account.balance.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_balance_report_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="action_account_balance_report_values">
<field name="model_id" ref="account.model_account_account" />
<field name="object" eval="1" />
<field name="name">Account Balance</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_balance_report'))" />
<field name="key">action</field>
<field name="model">account.account</field>
</record>
<record id="account_balance_report_account_view" model="ir.ui.view">
<field name="name">Account Balance</field>
<field name="model">account.balance.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Chart">
<field name="Account_list"/>
<separator colspan="4"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button name="next_view" string="Next" type="object" icon="gtk-go-forward" default_focus="1"/>
</form>
</field>
</record>
<record id="action_account_balance_account_report" model="ir.actions.act_window">
<field name="name">Select Account</field>
<field name="res_model">account.balance.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="account_balance_report_account_view"/>
<field name="context">{'record_id':active_id}</field>
<field name="target">new</field>
</record>
<menuitem icon="STOCK_PRINT"
name="Account Balance"
action="action_account_balance_account_report"
id="menu_account_balance_report"
parent="account.menu_generic_report"/>
</data>
</openerp>
@@ -0,0 +1,136 @@
# -*- 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/>.
#
##############################################################################
import time
from osv import osv, fields
from tools.translate import _
class account_compare_account_balance_report(osv.osv_memory):
"""
This wizard will provide the account balance comparision report by fiscal years.
"""
_name = 'account.compare.account.balance.report'
_description = 'Account Balance Report'
_columns = {
'fiscalyear': fields.many2many('account.fiscalyear', 'account_fiscalyear_rel','account_id','fiscalyear_id','Fiscal year', help='Keep empty for all open fiscal year'),
'select_account': fields.many2one('account.account','Select Reference Account(for % comparision)',help='Keep empty for comparision to its parent'),
'account_choice': fields.selection([('all','All accounts'),
('bal_zero','With balance is not equal to 0'),
('moves','With movements')],'Show Accounts'),
'show_columns': fields.boolean('Show Debit/Credit Information'),
'landscape': fields.boolean('Show Report in Landscape Form'),
'format_perc': fields.boolean('Show Comparision in %'),
'compare_pattern': fields.selection([('bal_cash','Cash'),
('bal_perc','Percentage'),
('none','Don'+ "'" +'t Compare')],'Compare Selected Years In Terms Of'),
'period_manner': fields.selection([('actual','Financial Period'),('created','Creation Date')],'Entries Selection Based on'),
'periods': fields.many2many('account.period', 'period_account_balance_rel',
'report_id', 'period_id', 'Periods',
help='Keep empty for all open fiscal year'),
}
_defaults={
'compare_pattern': 'none',
'account_choice': 'moves',
'period_manner': 'actual',
}
def check(self, cr, uid, ids, context=None):
data={}
if context is None:
context = {}
data = {
'ids':context['active_ids'],
'form': self.read(cr, uid, ids, ['fiscalyear', 'select_account', 'account_choice', 'periods', 'show_columns', 'landscape', 'format_perc','compare_pattern','period_manner'])[0],
}
data['form']['context'] = context
if (len(data['form']['fiscalyear'])==0) or (len(data['form']['fiscalyear'])>1 and (data['form']['compare_pattern']!='none') and (data['form']['format_perc']==1) and (data['form']['show_columns']==1) and (data['form']['landscape']!=1)):
raise osv.except_osv(_('Warning !'), _('You have to select at least 1 Fiscal Year. \nYou may have selected the compare options with more than 1 year with credit/debit columns and % option.This can lead contents to be printed out of the paper.Please try again.'))
if ((len(data['form']['fiscalyear'])==3) and (data['form']['format_perc']!=1) and (data['form']['show_columns']!=1)):
if data['form']['landscape']==1:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.account.balance.landscape',
'datas': data,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.balance.account.balance',
'datas': data,
}
if data['form']['format_perc']==1:
if len(data['form']['fiscalyear'])<=2:
if data['form']['landscape']==1:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.account.balance.landscape',
'datas': data,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.balance.account.balance',
'datas': data,
}
else:
if len(data['form']['fiscalyear'])==3:
if data['form']['landscape']==1:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.account.balance.landscape',
'datas': data,
}
else:
raise osv.except_osv(_('Warning !'), _('You might have done following mistakes. Please correct them and try again. \n 1. You have selected more than 3 years in any case. \n 2. You have not selected Percentage option, but you have selected more than 2 years. \n You can select maximum 3 years. Please check again. \n 3. You have selected Percentage option with more than 2 years, but you have not selected landscape format. You have to select Landscape option. Please Check it.'))
else:
raise osv.except_osv(_('Warning !'), _('You might have done following mistakes. Please correct them and try again. \n 1. You have selected more than 3 years in any case. \n 2. You have not selected Percentage option, but you have selected more than 2 years. \n You can select maximum 3 years. Please check again. \n 3. You have selected Percentage option with more than 2 years, but you have not selected landscape format. You have to select Landscape option. Please Check it.'))
else:
if len(data['form']['fiscalyear'])>2:
if data['form']['landscape']==1:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.account.balance.landscape',
'datas': data,
}
else:
raise osv.except_osv(_('Warning !'), _('You might have done following mistakes. Please correct them and try again. \n 1. You have selected more than 3 years in any case. \n 2. You have not selected Percentage option, but you have selected more than 2 years. \n You can select maximum 3 years. Please check again. \n 3. You have selected Percentage option with more than 2 years, but you have not selected landscape format. You have to select Landscape option. Please Check it.'))
else:
if data['form']['landscape']==1:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.account.balance.landscape',
'datas': data,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.balance.account.balance',
'datas': data,
}
account_compare_account_balance_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_compare_account_balance_report_view" model="ir.ui.view">
<field name="name">account.compare.account.balance.report.form</field>
<field name="model">account.compare.account.balance.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Customize Report">
<notebook tabpos="up">
<page string="Report Options">
<separator string="Select Fiscal Year(s)(Maximum Three Years)" colspan="4"/>
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
<field name="fiscalyear" colspan="5" nolabel="1"/>
<field name="landscape" colspan="4"/>
<field name="show_columns" colspan="4"/>
<field name="format_perc" colspan="4"/>
<field name="select_account" colspan="4"/>
<field name="account_choice" colspan="4"/>
<field name="compare_pattern" colspan="4"/>
</page>
<page string="Select Period">
<field name="period_manner" colspan="4"/>
<separator string="Select Period(s)" colspan="4"/>
<field name="periods" colspan="4" nolabel="1"/>
</page>
</notebook>
<newline/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check" string="Print" type="object" icon="gtk-print" default_focus="1"/>
</group>
</form>
</field>
</record>
<act_window name="Account balance-Compare Years"
res_model="account.compare.account.balance.report"
src_model="account.account"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_view_account_compare_account_balance_report"/>
</data>
</openerp>
@@ -0,0 +1,151 @@
# -*- 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/>.
#
##############################################################################
import time
from osv import fields, osv
from tools.translate import _
import tools
class account_general_ledger_report(osv.osv_memory):
_name = "account.general.ledger.report"
_description = "General Ledger Report"
_columns = {
'Account_list': fields.many2one('account.account', 'Chart account', required=True, domain = [('parent_id','=',False)]),
'company_id': fields.many2one('res.company', 'Company', required=True),
'state': fields.selection([('bydate','By Date'),
('byperiod','By Period'),
('all','By Date and Period'),
('none','No Filter')],"Date/Period Filter"),
'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
'periods': fields.many2many('account.period', 'ledger_period_rel', 'ledger_id', 'period_id', 'Periods', help='All periods if empty' ),
'sortbydate': fields.selection([('sort_date','Date'),
('sort_mvt','Movement')],"Sort by:"),
'display_account': fields.selection([('bal_mouvement','With movements'),
('bal_all','All'),
('bal_solde','With balance is not equal to 0')],"Display accounts"),
'landscape': fields.boolean("Landscape Mode"),
'soldeinit': fields.boolean("Include initial balances"),
'amount_currency': fields.boolean("With Currency"),
'date_from': fields.date("Start date", required=True),
'date_to': fields.date("End date", required=True)
}
def _get_company(self, cr, uid, ids, context=None):
user_obj = self.pool.get('res.users')
company_obj = self.pool.get('res.company')
if context is None:
context = {}
user = user_obj.browse(cr, uid, uid, context=context)
if user.company_id:
return user.company_id.id
else:
return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
_defaults = {
'state' : 'none',
'date_from' : lambda *a: time.strftime('%Y-01-01'),
'date_to' : lambda *a: time.strftime('%Y-%m-%d'),
'company_id' : _get_company,
'display_account' : 'bal_all',
'sortbydate' : 'sort_date',
'fiscalyear' : False,
'landscape': True,
'amount_currency' : True,
}
def next_view(self, cr, uid, ids, context=None):
obj_model = self.pool.get('ir.model.data')
if context is None:
context = {}
data = self.read(cr, uid, ids, [])[0]
context.update({'Account_list': data['Account_list']})
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','account_general_ledger_report_view')])
resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'account.general.ledger.report',
'views': [(resource_id,'form')],
'type': 'ir.actions.act_window',
'target': 'new',
'context': context
}
def _check_date(self, cr, uid, data, context=None):
if context is None:
context = {}
sql = """
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
cr.execute(sql,(data['form']['date_from'],))
res = cr.dictfetchall()
if res:
if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']), str(res[0]['date_stop'])))
else:
if data['form']['landscape'] == True:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.general.ledger_landscape',
'datas': data,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.general.ledger',
'datas': data,
}
else:
raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
def check_report(self, cr, uid, ids, context=None):
if context is None:
context = {}
data={}
data['ids'] = context.get('active_ids',[])
data['form'] = self.read(cr, uid, ids, ['date_from', 'sortbydate', 'company_id', 'soldeinit', 'state', 'periods', 'date_to', 'amount_currency', 'display_account', 'landscape', 'fiscalyear'])[0]
data['form']['Account_list'] = context.get('Account_list',[])
if data['form']['Account_list']:
data['model'] = 'ir.ui.menu'
else:
data['model'] = 'account.account'
data['form']['context'] = context
if data['form']['state'] == 'bydate':
return self._check_date(cr, uid, data, context)
elif data['form']['state'] == 'byperiod':
if not data['form']['periods']:
raise osv.except_osv(_('Data Insufficient !'),_('Please select periods.'))
if data['form']['landscape'] == True:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.general.ledger_landscape',
'datas': data,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.general.ledger',
'datas': data,
}
account_general_ledger_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_general_ledger_report_view" model="ir.ui.view">
<field name="name">General Ledger</field>
<field name="model">account.general.ledger.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Date-Period">
<field name="company_id" colspan="4"/>
<newline/>
<field name="fiscalyear"/>
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
<newline/>
<field name="display_account" required="True"/>
<field name="sortbydate" required="True"/>
<field name="soldeinit" invisible="1"/>
<field name="landscape"/>
<field name="amount_currency"/>
<newline/>
<separator string="Filters" colspan="4"/>
<field name="state" required="True"/>
<newline/>
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
<separator string="Date Filter" colspan="4"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
<separator string="Filter on Periods" colspan="4"/>
<field name="periods" colspan="4" nolabel="1"/>
</group>
</group>
<newline/>
<group colspan="4" col="6">
<separator colspan="4"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_report" string="Print" type="object" icon="gtk-print"/>
</group>
</form>
</field>
</record>
<record id="action_account_general_ledger_report" model="ir.actions.act_window">
<field name="name">General Ledger</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.general.ledger.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_general_ledger_report_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="account_general_ledger_report_values">
<field name="model_id" ref="account.model_account_account" />
<field name="object" eval="1" />
<field name="name">Account General Ledger</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_general_ledger_report'))" />
<field name="key">action</field>
<field name="model">account.account</field>
</record>
<record id="account_general_ledger_report_view1" model="ir.ui.view">
<field name="name">General Ledger</field>
<field name="model">account.general.ledger.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Chart">
<field name="Account_list"/>
<separator colspan="4"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button name="next_view" string="Next" type="object" icon="gtk-go-forward" default_focus="1"/>
</form>
</field>
</record>
<record id="action_account_general_ledger_menu" model="ir.actions.act_window">
<field name="name">Select Chart</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.general.ledger.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_general_ledger_report_view1"/>
<field name="target">new</field>
</record>
<menuitem
icon="STOCK_PRINT"
name="General Ledger"
parent="account.menu_generic_report"
action="action_account_general_ledger_menu"
id="menu_general_ledger"
/>
</data>
</openerp>
@@ -31,9 +31,6 @@
<field name="target">new</field>
</record>
<menuitem id="next_id_20" name="Reconciliation"
parent="menu_finance_periodical_processing" />
<menuitem action="action_account_reconcile_select"
id="menu_reconcile_select" parent="account.next_id_20" />
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,54 +15,61 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import pooler
from osv import fields, osv
from tools.translate import _
class wizard_move_line_select(wizard.interface):
def _open_window(self, cr, uid, data, context):
mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
account_obj = pooler.get_pool(cr.dbname).get('account.account')
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
class account_move_line_select(osv.osv_memory):
"""
Account move line select
"""
_name = "account.move.line.select"
_description = "Account move line select"
if not context.get('fiscalyear', False):
def open_window(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')
account_obj = self.pool.get('account.account')
fiscalyear_obj = self.pool.get('account.fiscalyear')
if context is None:
context = {}
if 'fiscalyear' not in context:
fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')])
else:
fiscalyear_ids = [context['fiscalyear']]
fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')])
fiscalyears = fiscalyear_obj.browse(cr, uid, fiscalyear_ids)
period_ids = []
for fiscalyear in fiscalyears:
for period in fiscalyear.period_ids:
period_ids.append(period.id)
domain = str(('period_id', 'in', period_ids))
if fiscalyears :
for fiscalyear in fiscalyears:
for period in fiscalyear.period_ids:
period_ids.append(period.id)
domain = str(('period_id', 'in', period_ids))
result = mod_obj._get_id(cr, uid, 'account', 'action_move_line_tree1')
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
result = act_obj.read(cr, uid, [id])[0]
result['context'] = {
'fiscalyear': context.get('fiscalyear', False),
'account_id': data['id']
'fiscalyear': False ,
'account_id': context['active_id'],
'active_id': context['active_id'],
}
if data['id']:
acc_data = account_obj.browse(cr, uid, data['id']).child_consol_ids
if context['active_id']:
acc_data = account_obj.browse(cr, uid, context['active_id']).child_consol_ids
if acc_data:
result['context'].update({'consolidate_childs': True})
result['domain']=result['domain'][0:-1]+','+domain+result['domain'][-1]
return result
states = {
'init': {
'actions': [],
'result': {'type': 'action', 'action': _open_window, 'state': 'end'}
}
}
wizard_move_line_select('account.move.line.select')
account_move_line_select()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_move_line_select_button_view" model="ir.ui.view">
<field name="name">Open Move Line Button</field>
<field name="model">account.move.line.select</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account Select">
<label string="Are you sure you want to open Account move line entries!" colspan="4"/>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-open" string="Open Entries" name="open_window" type="object" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_account_move_line_select_button" model="ir.actions.act_window">
<field name="name">Open Account</field>
<field name="res_model">account.move.line.select</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_move_line_select_button_view"/>
<field name="target">new</field>
</record>
<record id="ir_account_move_line_select" model="ir.values">
<field name="key2">tree_but_open</field>
<field name="model">account.account</field>
<field name="name">Open Account</field>
<field eval="'ir.actions.act_window,%d'%action_account_move_line_select_button" name="value"/>
<field eval="True" name="object"/>
</record>
</data>
</openerp>
+129
View File
@@ -0,0 +1,129 @@
# -*- 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/>.
#
##############################################################################
import time
from tools.translate import _
from osv import fields, osv
class account_partner_ledger(osv.osv_memory):
"""
This wizard will provide the partner Ledger report by periods, between any two dates.
"""
_name = 'account.partner.ledger'
_description = 'Account Partner Ledger'
_columns = {
'company_id': fields.many2one('res.company', 'Company', required=True),
'state': fields.selection([('bydate','By Date'),
('byperiod','By Period'),
('all','By Date and Period'),
('none','No Filter')
],'Date/Period Filter'),
'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
'periods': fields.many2many('account.period', 'period_ledger_rel', 'report_id', 'period_id', 'Periods', help='All periods if empty', states={'none':[('readonly',True)],'bydate':[('readonly',True)]}),
'result_selection': fields.selection([('customer','Receivable Accounts'),
('supplier','Payable Accounts'),
('all','Receivable and Payable Accounts')],
'Partner', required=True),
'soldeinit': fields.boolean('Include initial balances'),
'reconcil': fields.boolean('Include Reconciled Entries'),
'page_split': fields.boolean('One Partner Per Page'),
'date1': fields.date('Start date', required=True),
'date2': fields.date('End date', required=True),
}
def _get_company(self, cr, uid, ids, context=None):
user_obj = self.pool.get('res.users')
company_obj = self.pool.get('res.company')
if context is None:
context = {}
user = user_obj.browse(cr, uid, uid, context=context)
if user.company_id:
return user.company_id.id
else:
return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
_defaults={
'state' : 'none',
'date1' : time.strftime('%Y-01-01'),
'date2' : time.strftime('%Y-%m-%d'),
'result_selection' : 'all',
'reconcile' : True,
'soldeinit' : True,
'page_split' : False,
'company_id' : _get_company,
'fiscalyear' : False,
}
def check_state(self, cr, uid, ids, context=None):
obj_fiscalyear = self.pool.get('account.fiscalyear')
obj_periods = self.pool.get('account.period')
if context is None:
context = {}
data={}
data['ids'] = context.get('active_ids',[])
data['form'] = self.read(cr, uid, ids, [])[0]
data['form']['fiscalyear'] = obj_fiscalyear.find(cr, uid)
data['form']['periods'] = obj_periods.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
data['form']['display_account']='bal_all'
data['model'] = 'ir.ui.menu'
acc_id = self.pool.get('account.invoice').search(cr, uid, [('state','=','open')])
if not acc_id:
raise osv.except_osv(_('No Data Available'), _('No records found for your selection!'))
if data['form']['state'] == 'bydate' or data['form']['state'] == 'all':
data['form']['fiscalyear'] = False
else :
data['form']['fiscalyear'] = True
return self._check_date(cr, uid, data, context)
if data['form']['page_split']:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.third_party_ledger',
'datas': data,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.third_party_ledger_other',
'datas': data,
}
def _check_date(self, cr, uid, data, context=None):
if context is None:
context = {}
sql = """
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
cr.execute(sql,(data['form']['date1'],))
res = cr.dictfetchall()
if res:
if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']):
raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']), str(res[0]['date_stop'])))
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.third_party_ledger',
'datas': data,
}
else:
raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
account_partner_ledger()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_partner_ledger_view" model="ir.ui.view">
<field name="name">Select period</field>
<field name="model">account.partner.ledger</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Date-Period">
<field name="company_id"/>
<field name="result_selection"/>
<newline/>
<field name="fiscalyear"/>
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
<group colspan = "4" >
<field name="reconcil"/>
<field name="page_split"/>
</group>
<newline/>
<separator string="Filters" colspan="4"/>
<field name="state" required="True"/>
<newline/>
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
<separator string="Date Filter" colspan="4"/>
<field name="date1"/>
<field name="date2"/>
</group>
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
<separator string="Filter on Periods" colspan="4"/>
<field name="periods" colspan="4" nolabel="1"/>
</group>
</group>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_state" string="Print" type="object" icon="gtk-print"/>
</group>
</form>
</field>
</record>
<record id="action_account_partner_ledger" model="ir.actions.act_window">
<field name="name">Select Period</field>
<field name="res_model">account.partner.ledger</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="account_partner_ledger_view"/>
<field name="context">{'record_id':active_id}</field>
<field name="target">new</field>
</record>
<menuitem icon="STOCK_PRINT"
name="Partner Ledger"
action="action_account_partner_ledger"
id="menu_account_partner_ledger"
parent="account.next_id_22"/>
</data>
</openerp>
@@ -2,11 +2,6 @@
<openerp>
<data>
<menuitem
id="menu_tax_report"
name="Taxes"
parent="account.menu_finance_generic_reporting" sequence="3"/>
<record id="view_account_vat_declaration" model="ir.ui.view">
<field name="name">Account Vat Declaration</field>
<field name="model">account.vat.declaration</field>
@@ -1,145 +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/>.
#
##############################################################################
import wizard
import pooler
import time
from tools.translate import _
period_form = '''<?xml version="1.0"?>
<form string="Select period">
<field name="company_id"/>
<field name="display_account" required = "True"/>
<newline/>
<field name="fiscalyear"/>
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
<newline/>
<separator string="Filters" colspan="4"/>
<field name="state" required="True"/>
<newline/>
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
<separator string="Date Filter" colspan="4"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
<separator string="Filter on Periods" colspan="4"/>
<field name="periods" colspan="4" nolabel="1"/>
</group>
</group>
</form>'''
period_fields = {
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
'state':{
'string':"Date/Period Filter",
'type':'selection',
'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],
'default': lambda *a:'none'
},
'fiscalyear': {
'string':'Fiscal year',
'type':'many2one',
'relation':'account.fiscalyear',
'help':'Keep empty for all open fiscal year'
},
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]},
'date_from': {'string':"Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
}
account_form = '''<?xml version="1.0"?>
<form string="Select parent account">
<field name="Account_list" colspan="4"/>
</form>'''
account_fields = {
'Account_list': {'string':'Account', 'type':'many2one', 'relation':'account.account', 'required':True ,'domain':[('parent_id','=',False)]},
}
class wizard_report(wizard.interface):
def _get_defaults(self, cr, uid, data, context={}):
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
if user.company_id:
company_id = user.company_id.id
else:
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
data['form']['company_id'] = company_id
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
# periods_obj=pooler.get_pool(cr.dbname).get('account.period')
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
# data['form']['periods'] = periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
# data['form']['fiscalyear'] = False
data['form']['display_account'] = 'bal_all'
data['form']['context'] = context
return data['form']
def _check_state(self, cr, uid, data, context):
if data['form']['state'] == 'bydate':
self._check_date(cr, uid, data, context)
# data['form']['fiscalyear'] = 0
# else :
# data['form']['fiscalyear'] = 1
return data['form']
def _check_path(self, cr, uid, data, context):
if data['model'] == 'account.account':
return 'checktype'
else:
return 'account_selection'
def _check_date(self, cr, uid, data, context):
sql = """
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
cr.execute(sql,(data['form']['date_from'],))
res = cr.dictfetchall()
if res:
if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (res[0]['date_start'], res[0]['date_stop']))
else:
return 'report'
else:
raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year'))
states = {
'init': {
'actions': [],
'result': {'type':'choice','next_state':_check_path}
},
'account_selection': {
'actions': [],
'result': {'type':'form', 'arch':account_form,'fields':account_fields, 'state':[('end','Cancel','gtk-cancel'),('checktype','Next','gtk-go-forward')]}
},
'checktype': {
'actions': [_get_defaults],
'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
},
'report': {
'actions': [_check_state],
'result': {'type':'print', 'report':'account.account.balance', 'state':'end'}
}
}
wizard_report('account.account.balance.report')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,53 +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/>.
#
##############################################################################
import wizard
import pooler
duplicate_form = '''<?xml version="1.0"?>
<form string="Duplicate account charts">
<field name="company_id"/>
</form>'''
duplicate_fields = {
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
}
def _do_duplicate(self, cr, uid, data, context):
account_obj = pooler.get_pool(cr.dbname).get('account.account')
account_obj.copy(cr, uid, data['id'], data['form'], context=context)
return {}
class wizard_account_duplicate(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch': duplicate_form, 'fields': duplicate_fields, 'state': (('end', 'Cancel', 'gtk-cancel'), ('duplicate', 'Duplicate', 'gtk-ok'))},
},
'duplicate': {
'actions': [_do_duplicate],
'result': {'type': 'state', 'state': 'end'},
},
}
wizard_account_duplicate('account.wizard.account.duplicate')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,113 +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/>.
#
##############################################################################
import wizard
import time
import datetime
import pooler
from mx.DateTime import *
from tools.translate import _
_aged_trial_form = """<?xml version="1.0"?>
<form string="Print Aged Trial Balance">
<field name="company_id"/>
<newline/>
<field name="date1"/>
<field name="period_length"/>
<newline/>
<field name="result_selection"/>
<newline/>
<field name="direction_selection"/>
</form>"""
_aged_trial_fields = {
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
'period_length': {'string': 'Period length (days)', 'type': 'integer', 'required': True, 'default': lambda *a:30},
'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
'result_selection':{
'string':"Filter on Partners",
'type':'selection',
'selection':[('customer','Receivable'),('supplier','Payable'),('all','Receivable and Payable')],
'required':True,
'default': lambda *a: 'all',
},
'direction_selection':{
'string':"Analysis Direction",
'type':'selection',
'selection':[('past','Past'),('future','Future')],
'required':True,
'default': lambda *a: 'past',
},
}
def _calc_dates(self, cr, uid, data, context):
res = {}
period_length = data['form']['period_length']
if period_length<=0:
raise wizard.except_wizard(_('UserError'), _('You must enter a period length that cannot be 0 or below !'))
start = datetime.date.fromtimestamp(time.mktime(time.strptime(data['form']['date1'],"%Y-%m-%d")))
start = DateTime(int(start.year),int(start.month),int(start.day))
if data['form']['direction_selection'] == 'past':
for i in range(5)[::-1]:
stop = start - RelativeDateTime(days=period_length)
res[str(i)] = {
'name' : str((5-(i+1))*period_length) + '-' + str((5-i)*period_length),
'stop': start.strftime('%Y-%m-%d'),
'start' : stop.strftime('%Y-%m-%d'),
}
start = stop - RelativeDateTime(days=1)
else:
for i in range(5):
stop = start + RelativeDateTime(days=period_length)
res[str(5-(i+1))] = {
'name' : str((i)*period_length)+'-'+str((i+1)*period_length),
'start': start.strftime('%Y-%m-%d'),
'stop' : stop.strftime('%Y-%m-%d'),
}
start = stop + RelativeDateTime(days=1)
return res
class wizard_report(wizard.interface):
def _get_defaults(self, cr, uid, data, context):
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
if user.company_id:
company_id = user.company_id.id
else:
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
data['form']['company_id'] = company_id
return data['form']
states = {
'init': {
'actions': [_get_defaults],
'result': {'type':'form', 'arch':_aged_trial_form, 'fields':_aged_trial_fields, 'state':[('end','Cancel', 'gtk-cancel'),('print','Print', 'gtk-ok')]},
},
'print': {
'actions': [_calc_dates],
'result': {'type':'print', 'report':'account.aged_trial_balance', 'state':'end'},
},
}
wizard_report('account.aged.trial.balance')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,175 +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/>.
#
##############################################################################
import wizard
import ir
import pooler
import time
import netsvc
from osv import fields, osv
import mx.DateTime
from mx.DateTime import RelativeDateTime
from tools import config
dates_form = '''<?xml version="1.0"?>
<form string="Customize Report">
<notebook tabpos="up">
<page string="Report Options">
<separator string="Select Fiscal Year(s)(Maximum Three Years)" colspan="4"/>
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
<field name="fiscalyear" colspan="5" nolabel="1"/>
<field name="landscape" colspan="4"/>
<field name="show_columns" colspan="4"/>
<field name="format_perc" colspan="4"/>
<field name="select_account" colspan="4"/>
<field name="account_choice" colspan="4"/>
<field name="compare_pattern" colspan="4"/>
</page>
<page string="Select Period">
<field name="period_manner" colspan="4"/>
<separator string="Select Period(s)" colspan="4"/>
<field name="periods" colspan="4" nolabel="1"/>
</page>
</notebook>
</form>'''
dates_fields = {
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2many', 'relation': 'account.fiscalyear'},
'select_account': {'string': 'Select Reference Account(for % comparision)', 'type': 'many2one', 'relation': 'account.account','help': 'Keep empty for comparision to its parent'},
'account_choice': {'string': 'Show Accounts', 'type': 'selection','selection':[('all','All accounts'),('bal_zero','With balance is not equal to 0'),('moves','With movements')]},
'show_columns': {'string': 'Show Debit/Credit Information', 'type': 'boolean'},
'landscape': {'string': 'Show Report in Landscape Form', 'type': 'boolean'},
'format_perc': {'string': 'Show Comparision in %', 'type': 'boolean'},
'compare_pattern':{'string':"Compare Selected Years In Terms Of",'type':'selection','selection':[('bal_cash','Cash'),('bal_perc','Percentage'),('none','Don'+ "'" +'t Compare')]},
'period_manner':{'string':"Entries Selection Based on",'type':'selection','selection':[('actual','Financial Period'),('created','Creation Date')]},
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'}
}
back_form='''<?xml version="1.0"?>
<form string="Notification">
<separator string="You might have done following mistakes. Please correct them and try again." colspan="4"/>
<separator string="1. You have selected more than 3 years in any case." colspan="4"/>
<separator string="2. You have not selected 'Percentage' option, but you have selected more than 2 years." colspan="4"/>
<label string="You can select maximum 3 years. Please check again." colspan="4"/>
<separator string="3. You have selected 'Percentage' option with more than 2 years, but you have not selected landscape format." colspan="4"/>
<label string="You have to select 'Landscape' option. Please Check it." colspan="4"/>
</form>'''
back_fields={
}
zero_form='''<?xml version="1.0"?>
<form string="Notification">
<separator string="You have to select at least 1 Fiscal Year. Try again." colspan="4"/>
<label string="You may have selected the compare options with more than 1 year with credit/debit columns and % option.This can lead contents to be printed out of the paper.Please try again."/>
</form>'''
zero_fields={
}
def _check(self, cr, uid, data, context):
if (len(data['form']['fiscalyear'][0][2])==0) or (len(data['form']['fiscalyear'][0][2])>1 and (data['form']['compare_pattern']!='none') and (data['form']['format_perc']==1) and (data['form']['show_columns']==1) and (data['form']['landscape']!=1)):
return 'zero_years'
if ((len(data['form']['fiscalyear'][0][2])==3) and (data['form']['format_perc']!=1) and (data['form']['show_columns']!=1)):
if data['form']['landscape']==1:
return 'report_landscape'
else:
return 'report'
if data['form']['format_perc']==1:
if len(data['form']['fiscalyear'][0][2])<=2:
if data['form']['landscape']==1:
return 'report_landscape'
else:
return 'report'
else:
if len(data['form']['fiscalyear'][0][2])==3:
if data['form']['landscape']==1:
return 'report_landscape'
else:
return 'backtoinit'
else:
return 'backtoinit'
else:
if len(data['form']['fiscalyear'][0][2])>2:
if data['form']['landscape']==1:
return 'report_landscape'
else:
return 'backtoinit'
else:
if data['form']['landscape']==1:
return 'report_landscape'
else:
return 'report'
class wizard_report(wizard.interface):
def _get_defaults(self, cr, uid, data, context={}):
data['form']['context'] = context
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
data['form']['fiscalyear']=[fiscalyear_obj.find(cr, uid)]
# p_ids=pooler.get_pool(cr.dbname).get('account.period').search(cr,uid,[('fiscalyear_id','=',fiscalyear_obj.find(cr, uid))])
# data['form']['periods']=p_ids
data['form']['compare_pattern']='none'
data['form']['account_choice']='moves'
data['form']['period_manner']='actual'
return data['form']
states = {
'init': {
'actions': [_get_defaults],
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel', 'gtk-cancel'),('checkyear','Print', 'gtk-ok')]}
},
'backtoinit': {
'actions': [],
'result': {'type':'form','arch':back_form,'fields':back_fields,'state':[('end','Ok')]}
},
'zero_years': {
'actions': [],
'result': {'type':'form','arch':zero_form,'fields':zero_fields,'state':[('end','Ok')]}
},
'checkyear': {
'actions': [],
'result': {'type':'choice','next_state':_check}
},
'report_landscape': {
'actions': [],
'result': {'type':'print', 'report':'account.account.balance.landscape', 'state':'end'}
},
'report': {
'actions': [],
'result': {'type':'print', 'report':'account.balance.account.balance', 'state':'end'}
}
}
wizard_report('account.balance.account.balance.report')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,179 +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/>.
#
##############################################################################
import wizard
import pooler
import locale
import time
from tools.translate import _
account_form = '''<?xml version="1.0"?>
<form string="Select Chart">
<field name="Account_list" colspan="4"/>
</form>'''
account_fields = {
'Account_list': {'string':'Chart of Accounts', 'type':'many2one', 'relation':'account.account', 'required':True ,'domain':[('parent_id','=',False)]},
}
period_form = '''<?xml version="1.0"?>
<form string="Select Date-Period">
<field name="company_id" colspan="4"/>
<newline/>
<field name="fiscalyear"/>
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
<newline/>
<field name="display_account" required="True"/>
<field name="sortbydate" required="True"/>
<field name="soldeinit" invisible="1"/>
<field name="landscape"/>
<field name="amount_currency"/>
<newline/>
<separator string="Filters" colspan="4"/>
<field name="state" required="True"/>
<newline/>
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
<separator string="Date Filter" colspan="4"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
<separator string="Filter on Periods" colspan="4"/>
<field name="periods" colspan="4" nolabel="1"/>
</group>
</group>
</form>'''
period_fields = {
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
'state':{
'string':"Date/Period Filter",
'type':'selection',
'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],
'default': lambda *a:'none'
},
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
'help': 'Keep empty for all open fiscal year'},
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
'sortbydate':{'string':"Sort by:",'type':'selection','selection':[('sort_date','Date'),('sort_mvt','Movement')]},
'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]},
'landscape':{'string':"Landscape Mode",'type':'boolean'},
'soldeinit':{'string':"Include initial balances",'type':'boolean'},
'amount_currency':{'string':"With Currency",'type':'boolean'},
'date_from': {'string':" Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
}
def _check_path(self, cr, uid, data, context):
if data['model'] == 'account.account':
return 'checktype'
else:
return 'account_selection'
def _check(self, cr, uid, data, context):
if data['form']['landscape']==True:
return 'report_landscape'
else:
return 'report'
def _check_date(self, cr, uid, data, context):
sql = """
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
cr.execute(sql,(data['form']['date_from'],))
res = cr.dictfetchall()
if res:
if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']), str(res[0]['date_stop'])))
else:
return 'checkreport'
else:
raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year'))
def _check_state(self, cr, uid, data, context):
if data['form']['state'] == 'bydate':
_check_date(self, cr, uid, data, context)
# data['form']['fiscalyear'] = 0
# else :
#
# data['form']['fiscalyear'] = 1
return data['form']
class wizard_report(wizard.interface):
def _get_defaults(self, cr, uid, data, context={}):
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
if user.company_id:
company_id = user.company_id.id
else:
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
data['form']['company_id'] = company_id
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
#periods_obj=pooler.get_pool(cr.dbname).get('account.period')
#data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
data['form']['sortbydate'] = 'sort_date'
data['form']['display_account']='bal_all'
data['form']['landscape']=True
data['form']['fiscalyear'] = False
data['form']['amount_currency'] = True
data['form']['context'] = context
return data['form']
states = {
'init': {
'actions': [],
'result': {'type':'choice','next_state':_check_path}
},
'account_selection': {
'actions': [],
'result': {'type':'form', 'arch':account_form,'fields':account_fields, 'state':[('end','Cancel','gtk-cancel'),('checktype','Next','gtk-go-forward')]}
},
'checktype': {
'actions': [_get_defaults],
'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('checkreport','Print','gtk-print')]}
},
'checkreport': {
'actions': [],
'result': {'type':'choice','next_state':_check}
},
'report_landscape': {
'actions': [_check_state],
'result': {'type':'print', 'report':'account.general.ledger_landscape', 'state':'end'}
},
'report': {
'actions': [_check_state],
'result': {'type':'print', 'report':'account.general.ledger', 'state':'end'}
}
}
wizard_report('account.general.ledger.report')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,161 +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/>.
#
##############################################################################
import time
import wizard
import pooler
from tools.translate import _
period_form = '''<?xml version="1.0"?>
<form string="Select Date-Period">
<field name="company_id"/>
<field name="result_selection"/>
<newline/>
<field name="fiscalyear"/>
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
<group colspan = "4" >
<field name="reconcil"/>
<field name="page_split"/>
</group>
<newline/>
<separator string="Filters" colspan="4"/>
<field name="state" required="True"/>
<newline/>
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
<separator string="Date Filter" colspan="4"/>
<field name="date1"/>
<field name="date2"/>
</group>
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
<separator string="Filter on Periods" colspan="4"/>
<field name="periods" colspan="4" nolabel="1"/>
</group>
</group>
</form>'''
period_fields = {
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
'state':{
'string':"Date/Period Filter",
'type':'selection',
'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],
'default': lambda *a:'none'
},
'fiscalyear': {
'string':'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
'help': 'Keep empty for all open fiscal year',
'default': lambda *a:False,
},
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty','states':{'none':[('readonly',True)],'bydate':[('readonly',True)]}},
'result_selection':{
'string':"Partner",
'type':'selection',
'selection':[('customer','Receivable Accounts'),('supplier','Payable Accounts'),('all','Receivable and Payable Accounts')],
'required':True
},
'soldeinit':{'string':"Include initial balances",'type':'boolean'},
'reconcil':{'string':" Include Reconciled Entries",'type':'boolean'},
'page_split':{'string':"One Partner Per Page",'type':'boolean'},
'date1': {'string':' Start date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
'date2': {'string':'End date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
}
class wizard_report(wizard.interface):
def _get_defaults(self, cr, uid, data, context):
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
data['form']['display_account']='bal_all'
data['form']['result_selection'] = 'all'
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
if user.company_id:
company_id = user.company_id.id
else:
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
data['form']['company_id'] = company_id
periods_obj=pooler.get_pool(cr.dbname).get('account.period')
data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
data['form']['fiscalyear'] =False
data['form']['page_split'] = False
data['form']['reconcil'] = False
data['form']['soldeinit'] = True
return data['form']
def _check(self, cr, uid, data, context):
if data['form']['page_split']:
return 'report'
else:
return 'report_other'
def _check_date(self, cr, uid, data, context):
sql = """
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
cr.execute(sql,(data['form']['date1'],))
res = cr.dictfetchall()
if res:
if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']):
raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']) , str(res[0]['date_stop'])))
else:
return 'report'
else:
raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year'))
def _check_state(self, cr, uid, data, context):
if data['form']['state'] == 'bydate' or data['form']['state'] == 'all':
data['form']['fiscalyear'] = False
else :
data['form']['fiscalyear'] = True
self._check_date(cr, uid, data, context)
acc_id = pooler.get_pool(cr.dbname).get('account.invoice').search(cr, uid, [('state','=','open')])
if not acc_id:
raise wizard.except_wizard(_('No Data Available'), _('No records found for your selection!'))
return data['form']
states = {
'init': {
'actions': [_get_defaults],
'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('checkreport','Print','gtk-print')]}
},
'checkreport': {
'actions': [],
'result': {'type':'choice','next_state':_check}
},
'report': {
'actions': [_check_state],
'result': {'type':'print', 'report':'account.third_party_ledger', 'state':'end'}
},
'report_other': {
'actions': [_check_state],
'result': {'type':'print', 'report':'account.third_party_ledger_other', 'state':'end'}
}
}
wizard_report('account.third_party_ledger.report')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+64
View File
@@ -0,0 +1,64 @@
# Estonian translation for openobject-addons
# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-11-24 12:50+0000\n"
"PO-Revision-Date: 2010-04-23 09:43+0000\n"
"Last-Translator: lyyser <logard.1961@gmail.com>\n"
"Language-Team: Estonian <et@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-24 03:53+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_anglo_saxon
#: view:product.category:0
msgid " Accounting Property"
msgstr ""
#. module: account_anglo_saxon
#: model:ir.module.module,description:account_anglo_saxon.module_meta_information
msgid ""
"This module will support the Anglo-Saxons accounting methodology by \n"
" changing the accounting logic with stock transactions. The difference "
"between the Anglo-Saxon accounting countries \n"
" and the Rhine or also called Continental accounting countries is the "
"moment of taking the Cost of Goods Sold versus Cost of Sales. \n"
" Anglo-Saxons accounting does take the cost when sales invoice is "
"created, Continental accounting will take the cost at he moment the goods "
"are shipped.\n"
" This module will add this functionality by using a interim account, to "
"store the value of shipped goods and will contra book this interim account \n"
" when the invoice is created to transfer this amount to the debtor or "
"creditor account."
msgstr ""
#. module: account_anglo_saxon
#: model:ir.module.module,shortdesc:account_anglo_saxon.module_meta_information
msgid "Stock Account"
msgstr "Laoarvestuse"
#. module: account_anglo_saxon
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr "Vigane XML vaate arhitektuurile!"
#. module: account_anglo_saxon
#: field:product.category,property_account_creditor_price_difference_categ:0
#: field:product.template,property_account_creditor_price_difference:0
msgid "Price Difference Account"
msgstr ""
#. module: account_anglo_saxon
#: help:product.category,property_account_creditor_price_difference_categ:0
#: help:product.template,property_account_creditor_price_difference:0
msgid ""
"This account will be used to value price difference between purchase price "
"and cost price."
msgstr ""
+7 -7
View File
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2010-04-17 18:14+0000\n"
"Last-Translator: Valerie Engel <Unknown>\n"
"PO-Revision-Date: 2010-04-25 21:20+0000\n"
"Last-Translator: Martin Volf <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
"X-Launchpad-Export-Date: 2010-04-26 03:41+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_tax_include
@@ -34,19 +34,19 @@ msgstr ""
#. module: account_tax_include
#: selection:account.invoice,price_type:0
msgid "Tax included"
msgstr ""
msgstr "Daně zahrnuty"
#. module: account_tax_include
#: selection:account.invoice,price_type:0
msgid "Tax excluded"
msgstr ""
msgstr "Daně vyloučeny"
#. module: account_tax_include
#: view:account.tax:0
msgid "Compute Code for Taxes included prices"
msgstr ""
msgstr "Výpočetní kód pro ceny včetně daně"
#. module: account_tax_include
#: field:account.invoice.line,price_subtotal_incl:0
msgid "Subtotal"
msgstr ""
msgstr "Mezisoučet"
+1
View File
@@ -40,6 +40,7 @@
'wizard/base_calendar_invite_attendee_view.xml',
'base_calendar_view.xml'
],
"test" : ['test/base_calendar_test.yml'],
"installable" : True,
"active" : False,
}
+86 -10
View File
@@ -469,6 +469,7 @@ property or property parameter."),
reply_to=email_from
)
return True
def onchange_user_id(self, cr, uid, ids, user_id, *args, **argv):
"""
Make entry on email and availbility on change of user_id field.
@@ -795,7 +796,26 @@ class calendar_event(osv.osv):
def _tz_get(self, cr, uid, context={}):
return [(x.lower(), x) for x in pytz.all_timezones]
def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, context={}):
def onchange_allday(self, cr, uid, ids, allday, context={}):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of calendar event’s IDs.
@param allday: Value of allday boolean
@param context: A standard dictionary for contextual values
"""
if not allday or not ids:
return {}
event = self.browse(cr, uid, ids, context=context)[0]
value = {
'date': event.date and event.date[:11] + '00:00:00',
'date_deadline': event.date_deadline and event.date_deadline[:11] + '00:00:00',
'duration': 24
}
return {'value': value}
def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, allday=False, context={}):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@@ -805,14 +825,23 @@ class calendar_event(osv.osv):
@param duration: Get Duration between start date and end date or False
@param end_date: Get Ending Date or False
@param context: A standard dictionary for contextual values
"""
if not start_date:
return {}
value = {}
if not start_date:
return value
if not end_date and not duration:
duration = 8.00
value['duration'] = 8.00
value['duration'] = duration
if allday: # For all day event
start = start_date[:11] + '00:00:00'
value = {
'date': start,
'date_deadline': start,
'duration': 24
}
return {'value': value}
start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S")
if end_date and not duration:
end = datetime.strptime(end_date, "%Y-%m-%d %H:%M:%S")
@@ -822,6 +851,7 @@ class calendar_event(osv.osv):
elif not end_date:
end = start + timedelta(hours=duration)
value['date_deadline'] = end.strftime("%Y-%m-%d %H:%M:%S")
return {'value': value}
def _set_rrulestring(self, cr, uid, id, name, value, arg, context):
@@ -998,8 +1028,12 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
('3', 'Third'), ('4', 'Fourth'), \
('5', 'Fifth'), ('-1', 'Last')], 'By day'),
'month_list': fields.selection(months.items(), 'Month'),
'end_date': fields.date('Repeat Until')
'end_date': fields.date('Repeat Until'),
'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel',\
'event_id', 'attendee_id', 'Attendees'),
'allday': fields.boolean('All Day')
}
_defaults = {
'class': lambda *a: 'public',
'show_as': lambda *a: 'busy',
@@ -1007,6 +1041,46 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
'select1': lambda *x: 'date',
'interval': lambda *x: 1,
}
def open_event(self, cr, uid, ids, context=None):
"""
Open Event From for Editing
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of event’s IDs
@param context: A standard dictionary for contextual values
@return: Dictionary value which open Crm Meeting form.
"""
if not context:
context = {}
data_obj = self.pool.get('ir.model.data')
value = {}
id2 = data_obj._get_id(cr, uid, 'base_calendar', 'event_form_view')
id3 = data_obj._get_id(cr, uid, 'base_calendar', 'event_tree_view')
id4 = data_obj._get_id(cr, uid, 'base_calendar', 'event_calendar_view')
if id2:
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
if id3:
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
if id4:
id4 = data_obj.browse(cr, uid, id4, context=context).res_id
for id in ids:
value = {
'name': _('Event'),
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'calendar.event',
'view_id': False,
'views': [(id2, 'form'), (id3, 'tree'), (id4, 'calendar')],
'type': 'ir.actions.act_window',
'res_id': base_calendar_id2real_id(id),
'nodestroy': True
}
return value
def modify_this(self, cr, uid, event_id, defaults, real_date, context=None, *args):
"""
@@ -1085,8 +1159,8 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
count = 0
for data in cr.dictfetchall():
start_date = base_start_date and datetime.strptime(base_start_date, "%Y-%m-%d") or False
until_date = base_until_date and datetime.strptime(base_until_date, "%Y-%m-%d") or False
start_date = base_start_date and datetime.strptime(base_start_date[:10], "%Y-%m-%d") or False
until_date = base_until_date and datetime.strptime(base_until_date[:10], "%Y-%m-%d") or False
if count > limit:
break
event_date = datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S")
@@ -1124,7 +1198,6 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
new_rule = '%s=%s' % (name, value)
new_rrule_str.append(new_rule)
new_rrule_str = ';'.join(new_rrule_str)
start_date = datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S")
rdates = get_recurrent_dates(str(new_rrule_str), exdate, start_date)
for rdate in rdates:
r_date = datetime.strptime(rdate, "%Y-%m-%d %H:%M:%S")
@@ -1216,8 +1289,12 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
args_without_date.append(arg)
else:
if arg[1] in ('>', '>='):
if start_date:
continue
start_date = arg[2]
elif arg[1] in ('<', '<='):
if until_date:
continue
until_date = arg[2]
res = super(calendar_event, self).search(cr, uid, args_without_date, \
offset, limit, order, context, count)
@@ -1261,7 +1338,6 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
context.update({'alarm_id': vals.get('alarm_id')})
alarm_obj.do_alarm_create(cr, uid, new_ids, self._name, 'date', \
context=context)
return res
def browse(self, cr, uid, ids, context=None, list_class=None, fields_process={}):
+6 -1
View File
@@ -1,7 +1,12 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="1">
<record model="res.request.link" id="request_link_meeting">
<field name="name">Event</field>
<field name="object">calendar.event</field>
</record>
<record model="res.alarm" id="alarm1">
<field name="name">1 minute before</field>
<field name="active" eval="1" />
+240 -24
View File
@@ -71,7 +71,7 @@
<field name="arch" type="xml">
<tree string="Invitation details">
<field name="email" string="Invitation To"/>
<field name="partner_id" string="Partner" />
<field name="user_id" string="Internal User" />
<field name="partner_address_id" string="Contact" />
<field name="role" />
<field name="state" />
@@ -100,8 +100,30 @@
</search>
</field>
</record>
<record id="action_view_attendee_form" model="ir.actions.act_window">
<field name="name">Event Invitations</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">calendar.attendee</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="base_calendar.base_calendar_attendee_tree_view" />
<field name="context">{'default_sent_by_uid': uid}</field>
</record>
<!-- Calenadar's menu -->
<menuitem id="base.menu_calendar_configuration" name="Calendar"
parent="base.menu_base_config" sequence="10" />
<!-- Invitation menu -->
<menuitem id="menu_attendee_invitations"
name="Event Invitations" parent="base.menu_calendar_configuration"
sequence="10" action="action_view_attendee_form" />
<record id="res_alarm_form_view" model="ir.ui.view">
<!-- ALARM FORM VIEW-->
<record id="res_alarm_form_view" model="ir.ui.view">
<field name="name">res.alarm.form</field>
<field name="model">res.alarm</field>
<field name="type">form</field>
@@ -121,36 +143,230 @@
</field>
</record>
<record id="res_alarm_tree_view" model="ir.ui.view">
<field name="name">res.alarm.tree</field>
<field name="model">res.alarm</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Reminder details">
<field name="name" select="1"/>
<field name="trigger_interval" select="1"/>
<field name="trigger_duration" select="1"/>
<field name="trigger_occurs" select="1"/>
<field name="trigger_related" select="1"/>
</tree>
</field>
</record>
<record id="action_res_alarm_view" model="ir.actions.act_window">
<!-- ALARM TREE VIEW-->
<record id="res_alarm_tree_view" model="ir.ui.view">
<field name="name">res.alarm.tree</field>
<field name="model">res.alarm</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Reminder details">
<field name="name" select="1"/>
<field name="trigger_interval" select="1"/>
<field name="trigger_duration" select="1"/>
<field name="trigger_occurs" select="1"/>
<field name="trigger_related" select="1"/>
</tree>
</field>
</record>
<record id="action_res_alarm_view" model="ir.actions.act_window">
<field name="name">Available Alarms</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.alarm</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<!--Available alarms-->
<menuitem id="base.menu_calendar_configuration" name="Calendar"
parent="base.menu_base_config" sequence="10" />
</record>
<menuitem id="menu_crm_meeting_avail_alarm"
groups="base.group_extended"
action="base_calendar.action_res_alarm_view"
parent="base.menu_calendar_configuration" />
</data>
</openerp>
<!-- Event Form View-->
<record model="ir.ui.view" id="event_form_view">
<field name="name">Event Form</field>
<field name="model">calendar.event</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Meetings">
<group col="6" colspan="4">
<field name="name" select="1" string="Summary"
colspan="4" />
<field name="allday" colspan="2" on_change="onchange_allday(allday)" />
<newline/>
<field name="date" string="Start Date" required="1" select="1"
on_change="onchange_dates(date,duration,False,allday)" />
<field name="duration" widget="float_time"
on_change="onchange_dates(date,duration,False,allday)" attrs="{'readonly': [('allday', '=', True)]}"/>
<field name="date_deadline" string="End Date" required="1"
on_change="onchange_dates(date,False,date_deadline)" />
<field name="location" />
<field name="alarm_id" string="Reminder"
widget="selection" />
<group colspan="2" col="4" >
<field name="rrule_type" string="Recurrency"
colspan="1" attrs="{'readonly':[('recurrent_uid','!=',False)]}"/>
<button string="Edit All"
help="Edit all Ourrences of recurrent Meeting"
attrs="{'invisible':[('rrule_type','in', ('none', False))]}"
name="open_event" icon="gtk-edit"
type="object" />
</group>
</group>
<group col="4" colspan="4" name="rrule" attrs="{'invisible': [('rrule_type','!=','custom')]}">
<separator string="Select data for Custom Rule" colspan="8"/>
<group col="8" colspan="4">
<field name="freq" />
<field name="interval" />
<field name="count" />
<field name="end_date" />
</group>
<group col="14" colspan="4" name="Select weekdays"
attrs="{'invisible' : [('freq','!=','weekly')]}">
<field name="mo" colspan="1" />
<field name="tu" colspan="1" />
<field name="we" colspan="1" />
<field name="th" colspan="1" />
<field name="fr" colspan="1" />
<field name="sa" colspan="1" />
<field name="su" colspan="1" />
<newline />
</group>
<group col="10" colspan="4"
attrs="{'invisible' : [('freq','!=','monthly'), ('freq','!=','yearly')]}">
<group col="2" colspan="1">
<field name="select1" />
</group>
<group col="2" colspan="1"
attrs="{'invisible' : [('select1','=','day')]}">
<field name="day"
attrs="{'required' : [('select1','=','date')]}" />
</group>
<group col="3" colspan="1"
attrs="{'invisible' : [('select1','=','date')]}">
<field name="byday" string="The"
attrs="{'required' : [('select1','=','day')]}" />
<field name="week_list" nolabel="1"
attrs="{'required' : [('select1','=','day')]}" />
</group>
<group col="1" colspan="1"
attrs="{'invisible' : [('freq','!=','yearly')]}">
<field name="month_list" string="of"
colspan="1"
attrs="{'required' : [('freq','=','yearly')]}" />
</group>
</group>
</group>
<notebook colspan="4">
<page string="Event">
<group col="6" colspan="4">
<separator colspan="6" string="Visibility"/>
<field name="user_id" string="Responsible User" />
<field name="show_as" string="Show time as"/>
<field name="class" string="Privacy"/>
<field name="rrule" groups="base.group_extended" />
<field name="recurrent_id" invisible="1" />
<field name="recurrent_uid" invisible="1" />
</group>
<separator string="Description" colspan="4" />
<field name="description" nolabel="1" colspan="4" />
<separator colspan="4"/>
</page>
<page string="Invitation Detail">
<button string="Invite People"
name="%(base_calendar.action_view_calendar_invite_attendee_wizard)d"
icon="terp-partner" type="action"
context="{'model' : 'calendar.event', 'attendee_field':'attendee_ids'}" colspan="2"/>
<field name="attendee_ids" colspan="4"
nolabel="1" widget="one2many" mode="tree,form">
<tree string="Invitation details" editable="top">
<field name="email" />
<field name="role" select="1" />
<field name="state" />
</tree>
<form string="Invitation details">
<notebook colspan="4">
<page string="Details">
<field name="email" />
<field name="rsvp" select="1" />
<field name="cutype" select="1" />
<field name="role" select="1" />
<separator colspan="4" string="" />
<group col="6" colspan="4">
<field name="state" select="2" />
<button name="do_tentative"
states="needs-action,declined,accepted"
string="Uncertain"
type="object"
icon="terp-crm" />
<button name="do_accept"
string="Accept"
states="needs-action,tentative,declined"
type="object"
icon="gtk-apply" />
<button name="do_decline"
string="Decline"
states="needs-action,tentative,accepted"
type="object"
icon="gtk-cancel" />
<button
name="%(base_calendar.action_view_calendar_invite_attendee_wizard)d"
string="Delegate"
type="action"
icon="gtk-sort-descending"
states="needs-action,tentative,declined,accepted"
context="{'model' : 'calendar.attendee', 'attendee_field' : 'child_ids'}" />
</group>
</page>
</notebook>
</form>
</field>
</page>
</notebook>
</form>
</field>
</record>
<!-- Event Tree View -->
<record model="ir.ui.view" id="event_tree_view">
<field name="name">Event Tree</field>
<field name="model">calendar.event</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Events">
<field name="name" string="Subject" />
<field name="date" string="Meeting Date" />
<field name="location" />
<field name="show_as" />
<field name="class" string="Privacy" />
</tree>
</field>
</record>
<!-- Event Calendar View -->
<record model="ir.ui.view" id="event_calendar_view">
<field name="name">Events Calendar</field>
<field name="model">calendar.event</field>
<field name="type">calendar</field>
<field name="priority" eval="2"/>
<field name="arch" type="xml">
<calendar string="Events" date_start="date" color="show_as" date_delay="duration">
<field name="name"/>
<field name="class"/>
<field name="show_as"/>
</calendar>
</field>
</record>
<!-- Event action -->
<record id="action_view_event" model="ir.actions.act_window">
<field name="name">Events</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">calendar.event</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
</record>
<!-- Event menu -->
<menuitem id="menu_events"
name="Events" parent="base.menu_calendar_configuration"
sequence="5" action="action_view_event" />
</data>
</openerp>
@@ -0,0 +1,77 @@
- |
In Order to test base_calendar, I will first create One Simple Event with real data
-
!record {model: calendar.event, id: calendar_event_technicalpresentation0}:
class: private
date: '2010-04-30 16:00:00'
date_deadline: '2010-04-30 18:30:00'
description: The Technical Presentation will cover following topics:\n* Creating OpenERP
class\n* Views\n* Wizards\n* Workflows
duration: 2.5
location: OpenERP S.A.
name: Technical Presentation
rrule_type: none
- |
Now I will set recurrence for this event to occure monday and friday of week
-
!python {model: calendar.event}: |
self.write(cr, uid, [ref("calendar_event_technicalpresentation0")], {'fr': 1, 'mo': 1, 'interval': 1, 'freq': 'weekly', 'rrule_type': 'custom'})
- |
In order to check that recurrent events are views successfully in calenadar view,
I will open calendar view of events
-
!python {model: calendar.event}: |
self.fields_view_get(cr, uid, False, 'calendar', context)
- |
In order to check that recurrent events are views successfully in calenadar view,
I will search for one of the recurrent event and count the number of events
-
!python {model: calendar.event}: |
ids = self.search(cr, uid, [('date', '>=', '2010-05-01 00:00:00'), ('date', '<=', '2010-05-31 00:00:00')] )
assert len(ids) == 9
- |
Now I will make All day event and test it
-
!record {model: calendar.event, id: calendar_event_alldaytestevent0}:
allday: 1
class: confidential
date: '2010-04-30 00:00:00'
date_deadline: '2010-04-30 00:00:00'
description: 'All day technical test '
location: School
name: All day test event
rrule_type: none
- |
In order to check reminder I will first create reminder
-
!record {model: res.alarm, id: res_alarm_daybeforeeventstarts0}:
name: 1 Day before event starts
trigger_duration: 1
trigger_interval: days
trigger_occurs: before
trigger_related: start
- |
Now I will assign this reminder to all day event
-
!python {model: calendar.event}: |
self.write(cr, uid, [ref("calendar_event_alldaytestevent0")], {'alarm_id': ref("res_alarm_daybeforeeventstarts0")})
- |
In order to assign attendee I will invite Demo user
-
!record {model: base_calendar.invite.attendee, id: base_calendar_invite_attendee_0}:
type: internal
partner_id: base.res_partner_9 # Put bcz of problem in read
user_ids:
- base.user_demo
- |
Then I click on Invite Button
-
!python {model: base_calendar.invite.attendee}: |
self.do_invite(cr, uid, [ref("base_calendar_invite_attendee_0")], {'active_id': ref("calendar_event_alldaytestevent0"), 'model' : 'calendar.event', 'attendee_field':'attendee_ids'})
- |
Now I will Accept this invitation
-
!python {model: calendar.attendee}: |
ids = self.search(cr, uid, [('ref', '=', 'calendar.event' + ',' + str(ref("calendar_event_alldaytestevent0")))])
if ids:
self.do_accept(cr, uid, ids, context=context)
+20 -20
View File
@@ -8,13 +8,13 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2009-11-09 16:43+0000\n"
"Last-Translator: Fabien (Open ERP) <fp@tinyerp.com>\n"
"PO-Revision-Date: 2010-04-23 09:48+0000\n"
"Last-Translator: lyyser <logard.1961@gmail.com>\n"
"Language-Team: Estonian <et@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-17 04:20+0000\n"
"X-Launchpad-Export-Date: 2010-04-24 03:53+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base_module_quality
@@ -42,22 +42,22 @@ msgstr ""
#. module: base_module_quality
#: view:module.quality.detail:0
msgid "Detail"
msgstr ""
msgstr "Detail"
#. module: base_module_quality
#: field:module.quality.detail,note:0
msgid "Note"
msgstr ""
msgstr "Märkus"
#. module: base_module_quality
#: field:module.quality.detail,state:0
msgid "State"
msgstr ""
msgstr "Olek"
#. module: base_module_quality
#: field:module.quality.detail,detail:0
msgid "Details"
msgstr ""
msgstr "Detailid"
#. module: base_module_quality
#: field:module.quality.detail,ponderation:0
@@ -75,12 +75,12 @@ msgstr ""
#: view:module.quality.check:0
#: field:module.quality.check,check_detail_ids:0
msgid "Tests"
msgstr ""
msgstr "Testid"
#. module: base_module_quality
#: selection:module.quality.detail,state:0
msgid "Skipped"
msgstr ""
msgstr "Vahele jäetud"
#. module: base_module_quality
#: help:module.quality.detail,state:0
@@ -102,17 +102,17 @@ msgstr ""
#. module: base_module_quality
#: field:module.quality.detail,name:0
msgid "Name"
msgstr ""
msgstr "Nimi"
#. module: base_module_quality
#: wizard_field:quality_detail_save,init,module_file:0
msgid "Save report"
msgstr ""
msgstr "Salvesta aruanne"
#. module: base_module_quality
#: wizard_field:quality_detail_save,init,name:0
msgid "File name"
msgstr ""
msgstr "Failinimi"
#. module: base_module_quality
#: field:module.quality.detail,score:0
@@ -122,13 +122,13 @@ msgstr ""
#. module: base_module_quality
#: help:quality_detail_save,init,name:0
msgid "Save report as .html format"
msgstr ""
msgstr "Salvesta aruanne .html vormingus"
#. module: base_module_quality
#: view:module.quality.detail:0
#: field:module.quality.detail,summary:0
msgid "Summary"
msgstr ""
msgstr "Kokkuvõte"
#. module: base_module_quality
#: model:ir.actions.wizard,name:base_module_quality.quality_detail_save
@@ -143,7 +143,7 @@ msgstr ""
#. module: base_module_quality
#: view:module.quality.detail:0
msgid "Save Report"
msgstr ""
msgstr "Aruande salvestamine"
#. module: base_module_quality
#: model:ir.actions.wizard,name:base_module_quality.create_quality_check_id
@@ -158,25 +158,25 @@ msgstr ""
#. module: base_module_quality
#: selection:module.quality.detail,state:0
msgid "Done"
msgstr ""
msgstr "Valmis"
#. module: base_module_quality
#: view:module.quality.check:0
#: view:module.quality.detail:0
msgid "Result"
msgstr ""
msgstr "Tulemus"
#. module: base_module_quality
#: wizard_button:quality_detail_save,init,end:0
msgid "Cancel"
msgstr ""
msgstr "Katkesta"
#. module: base_module_quality
#: field:module.quality.detail,message:0
msgid "Message"
msgstr ""
msgstr "Sõnum"
#. module: base_module_quality
#: field:module.quality.detail,quality_check_id:0
msgid "Quality"
msgstr ""
msgstr "Kvaliteet"
+10 -3
View File
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2010-02-11 18:58+0000\n"
"Last-Translator: Auduf <5097@mail.ru>\n"
"PO-Revision-Date: 2010-04-23 16:38+0000\n"
"Last-Translator: Nikita Shehov <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-17 04:16+0000\n"
"X-Launchpad-Export-Date: 2010-04-24 03:52+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base_report_creator
@@ -23,6 +23,8 @@ msgid ""
"records.\n"
" e.g. res_partner.id=3"
msgstr ""
"Введите параметр для поиска нужных записей.\n"
"Например: res_partner.id=3"
#. module: base_report_creator
#: field:base_report_creator.report,view_graph_type:0
@@ -408,6 +410,11 @@ msgid ""
"After installing the module, it adds a menu to define custom report in\n"
"the \"Dashboard\" menu.\n"
msgstr ""
"С помощью этих модулей вы сможете создать статистический отчет\n"
"выбранных объектов. Это создатель и браузер SQL-запросов для пользователей.\n"
"\n"
"После установки модуля, в главном меню появится ссылка для выбора отчета по "
"умолчанию.\n"
#. module: base_report_creator
#: selection:base_report_creator.report.fields,calendar_mode:0
+9
View File
@@ -432,11 +432,20 @@ class crm_case(osv.osv):
"""
if not context:
context = {}
hist_obj = self.pool.get('crm.case.history')
log_obj = self.pool.get('crm.case.log')
for case in self.browse(cr, uid, ids, context):
if (not case.section_id.allow_unlink) and (case.state <> 'draft'):
raise osv.except_osv(_('Warning !'),
_('You can not delete this case. You should better cancel it.'))
# Also removing history and logs
history_ids = map(lambda x: x.id, case.history_line)
log_ids = map(lambda x: x.id, case.log_ids)
hist_obj.unlink(cr, uid, history_ids, context=context)
log_obj.unlink(cr, uid, log_ids, context=context)
return super(crm_case, self).unlink(cr, uid, ids, context)
def stage_next(self, cr, uid, ids, context=None):
+2 -5
View File
@@ -51,7 +51,7 @@ class crm_meeting(osv.osv):
),
'phonecall_id': fields.many2one ('crm.phonecall', 'Phonecall'),
'opportunity_id': fields.many2one ('crm.opportunity', 'Opportunity'),
'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel',\
'attendee_ids': fields.many2many('calendar.attendee', 'meeting_attendee_rel',\
'event_id', 'attendee_id', 'Attendees'),
'date_closed': fields.datetime('Closed', readonly=True),
'date_deadline': fields.datetime('Deadline'),
@@ -115,16 +115,13 @@ class calendar_attendee(osv.osv):
_description = 'Calendar Attendee'
def _compute_data(self, cr, uid, ids, name, arg, context):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of compute data’s IDs
@param context: A standard dictionary for contextual values
"""
name = name[0]
result = super(calendar_attendee, self)._compute_data(cr, uid, ids, name, arg, context)
@@ -132,7 +129,7 @@ class calendar_attendee(osv.osv):
id = attdata.id
result[id] = {}
if name == 'categ_id':
if attdata.ref:
if attdata.ref and 'categ_id' in attdata.ref._columns:
result[id][name] = (attdata.ref.categ_id.id, attdata.ref.categ_id.name,)
else:
result[id][name] = False
+14 -12
View File
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2009-11-18 06:25+0000\n"
"Last-Translator: Fabien (Open ERP) <fp@tinyerp.com>\n"
"PO-Revision-Date: 2010-04-23 09:08+0000\n"
"Last-Translator: grisha <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-17 03:58+0000\n"
"X-Launchpad-Export-Date: 2010-04-24 03:52+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: delivery
@@ -42,7 +42,7 @@ msgstr "Назначение"
#. module: delivery
#: model:product.template,name:delivery.delivery_product_product_template
msgid "Delivery by Poste"
msgstr ""
msgstr "Доставка почтой"
#. module: delivery
#: constraint:ir.ui.view:0
@@ -52,7 +52,7 @@ msgstr "Неправильный XML для просмотра архитект
#. module: delivery
#: constraint:res.partner:0
msgid "Error ! You can not create recursive associated members."
msgstr ""
msgstr "Ошибка! Вы не можете создать рекурсивных связанных участников."
#. module: delivery
#: field:delivery.grid,state_ids:0
@@ -62,7 +62,7 @@ msgstr "Cостояния"
#. module: delivery
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
msgstr ""
msgstr "Недопустимое имя модели в определении действия"
#. module: delivery
#: help:res.partner,property_delivery_carrier:0
@@ -72,7 +72,7 @@ msgstr ""
#. module: delivery
#: model:ir.model,name:delivery.model_delivery_grid
msgid "Delivery Grid"
msgstr ""
msgstr "Расценки на доставку"
#. module: delivery
#: field:delivery.grid,zip_from:0
@@ -119,12 +119,12 @@ msgstr ""
#. module: delivery
#: field:delivery.grid.line,grid_id:0
msgid "Grid"
msgstr ""
msgstr "Расценка"
#. module: delivery
#: view:res.partner:0
msgid "Deliveries Properties"
msgstr ""
msgstr "Свойства доставки"
#. module: delivery
#: field:delivery.carrier,active:0
@@ -151,7 +151,7 @@ msgstr "="
#. module: delivery
#: field:delivery.carrier,product_id:0
msgid "Delivery Product"
msgstr ""
msgstr "Услуга или изделие, соответствующее доставке"
#. module: delivery
#: view:delivery.grid.line:0
@@ -166,7 +166,7 @@ msgstr ""
#. module: delivery
#: field:delivery.grid.line,standard_price:0
msgid "Cost Price"
msgstr ""
msgstr "Себестоимость"
#. module: delivery
#: field:delivery.grid.line,name:0
@@ -177,6 +177,8 @@ msgstr "Название"
#: constraint:product.template:0
msgid "Error: UOS must be in a different category than the UOM"
msgstr ""
"Ошибка. Единицы продажи и единицы измерения должны принадлежать к разным "
"категориям."
#. module: delivery
#: field:delivery.grid,country_ids:0
@@ -323,7 +325,7 @@ msgstr "Ошибка: Неправильный штрих-код"
#. module: delivery
#: view:delivery.grid:0
msgid "Delivery grids"
msgstr ""
msgstr "Расценки на доставку"
#. module: delivery
#: wizard_button:delivery.sale.order,init,end:0
+1 -1
View File
@@ -79,7 +79,7 @@ class email_to_document(osv.osv):
if file_ext[1] not in ext:
logger.notifyChannel('document', netsvc.LOG_WARNING, 'file type %s is not allows to process for directory %s' % (file_ext[1], dr.directory_id.name))
continue
data_attach = {
'name': attactment,
'datas':binascii.b2a_base64(str(attachents.get(attactment))),
+5 -5
View File
@@ -93,11 +93,11 @@
<field name="domain">[]</field>
</record>
<menuitem
parent="base.menu_document"
id="menu_action_document_email_tree"
name="Email to Documents"
action="action_document_email_form"/>
<!-- <menuitem -->
<!-- parent="base.menu_document"-->
<!-- id="menu_action_document_email_tree" -->
<!-- name="Email to Documents"-->
<!-- action="action_document_email_form"/>-->
</data>
</openerp>
+14 -3
View File
@@ -320,12 +320,22 @@ class email_server(osv.osv):
return res_id
def __fetch_mail(self, cr, uid, ids, context={}):
sendmail_thread = threading.Thread(target=self.fetch_mail, args=(cr, uid, ids))
sendmail_thread.start()
return True
def _fetch_mails(self, cr, uid, ids=False, context={}):
if not ids:
ids = self.search(cr, uid, [])
return self.fetch_mail(cr, uid, ids, context)
def fetch_mail(self, cr, uid, ids, context={}):
fp = os.popen('ping www.google.com -c 1 -w 5',"r")
if not fp.read():
logger.notifyChannel('imap', netsvc.LOG_WARNING, 'lost internet connection !')
for server in self.browse(cr, uid, ids, context):
logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail start checking for new emails on %s' % (server.name))
@@ -356,7 +366,7 @@ class email_server(osv.osv):
pop_server = POP3_SSL(server.server, int(server.port))
else:
pop_server = POP3(server.server, int(server.port))
#TODO: use this to remove only unread messages
#pop_server.user("recent:"+server.user)
pop_server.user(server.user)
@@ -373,9 +383,10 @@ class email_server(osv.osv):
pop_server.quit()
logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail fetch %s email(s) from %s' % (numMsgs, server.name))
self.write(cr, uid, [server.id], {'state':'done'})
except Exception, e:
logger.notifyChannel('IMAP', netsvc.LOG_WARNING, '%s' % (e))
logger.notifyChannel(server.type, netsvc.LOG_WARNING, '%s' % (e))
return True
+1 -2
View File
@@ -58,8 +58,7 @@
</notebook>
<group col="6" colspan="4">
<field name="state" select="1"/>
<button string="Verify Server" type="object" name="fetch_mail"/>
<button string="Schedule"/>
<button string="Fetch Emails" type="object" name="__fetch_mail"/>
</group>
</form>
</field>
+3 -2
View File
@@ -39,14 +39,15 @@ system to store and search in your CV base.
'hr_recruitment_data.xml'
],
'update_xml': [
'hr_recruitment_wizard.xml',
'wizard/hr_recruitment_phonecall_view.xml',
'hr_recruitment_view.xml',
'hr_recruitment_menu.xml',
# 'report_hr_recruitment_view.xml',
'security/hr_recruitment_security.xml',
'security/ir.model.access.csv',
'board_hr_recruitment_statistical_view.xml',
'report/hr_recruitment_report_view.xml'
'report/hr_recruitment_report_view.xml',
'wizard/hr_recruitment_create_partner_job_view.xml',
],
'demo_xml': [
'hr_recruitment_demo.xml'
@@ -78,7 +78,7 @@
</group>
<field name="user_id"/>
<button string="Schedule a Phone Call"
name="%(wizard_hr_job_reschedule_phone_call)d" icon="gtk-redo" type="action"/>
name="%(action_hr_recruitment_phonecall)d" icon="gtk-redo" type="action"/>
<button name="%(survey.action_view_survey_question_message)d" string="Interview Question" type="action"
icon="gtk-execute" context="{'survey_id': survey, 'response_id': [response], 'response_no':0 ,'active' : response, 'object' : 'hr.applicant', 'cur_id' :active_id}" attrs="{'readonly':[('survey','=',False)]}"/>
<newline/>
+2 -4
View File
@@ -20,10 +20,8 @@
##############################################################################
import hr_recruitment_wizard
import hr_recruitment_phonecall
import hr_recruitment_create_partner_job
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,92 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import osv, fields
from tools.translate import _
class hr_recruitment_partner_create(osv.osv_memory):
_name = 'hr.recruitment.partner.create'
_description = 'Create Partner from job application'
_columns = {
'close': fields.boolean('Close job request'),
}
def view_init(self, cr , uid , fields_list, context=None):
case_obj = self.pool.get('hr.applicant')
for case in case_obj.browse(cr, uid, context['active_ids']):
if case.partner_id:
raise osv.except_osv(_('Warning !'),
_('A partner is already defined on this job request.'))
pass
def make_order(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
partner_obj = self.pool.get('res.partner')
contact_obj = self.pool.get('res.partner.address')
case_obj = self.pool.get('hr.applicant')
if context is None:
context = {}
data = self.read(cr, uid, ids, [], context)[0]
result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
for case in case_obj.browse(cr, uid, context['active_ids']):
partner_id = partner_obj.search(cr, uid, [('name', '=', case.partner_name or case.name)])
if partner_id:
raise osv.except_osv(_('Warning !'),_('A partner is already existing with the same name.'))
else:
partner_id = partner_obj.create(cr, uid, {
'name': case.partner_name or case.name,
'user_id': case.user_id.id,
'comment': case.description,
})
contact_id = contact_obj.create(cr, uid, {
'partner_id': partner_id,
'name': case.partner_name,
'phone': case.partner_phone,
'mobile': case.partner_mobile,
'email': case.email_from
})
case_obj.write(cr, uid, context['active_ids'], {
'partner_id': partner_id,
'partner_address_id': contact_id
})
if data['close']:
case_obj.case_close(cr, uid, context['active_ids'])
value = {
'domain': "[]",
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'res.partner',
'res_id': int(partner_id),
'view_id': False,
'type': 'ir.actions.act_window',
'search_view_id': res['res_id']
}
return value
hr_recruitment_partner_create()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_recruitment_partner_create" model="ir.ui.view">
<field name="name">hr.recruitment.partner.create.form</field>
<field name="model">hr.recruitment.partner.create</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Convert To Partner">
<group col="4" colspan="6">
<label string="Are you sure you want to create a partner based on this job request ?" colspan="4"/>
<label string="You may have to verify that this partner does not exist already." colspan="4"/>
<!--field name="close"/-->
</group>
<separator colspan="4"/>
<group col="2" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="make_order" string="Create Partner" colspan="1" type="object" icon="gtk-execute"/>
</group>
</form>
</field>
</record>
<record id="action_hr_recruitment_partner_create" model="ir.actions.act_window">
<field name="name">Create Partner</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.recruitment.partner.create</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record model="ir.values" id="hr_recruitment_partner_create_values">
<field name="model_id" ref="model_hr_applicant" />
<field name="object" eval="1" />
<field name="name">Create Partner</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_hr_recruitment_partner_create'))" />
<field name="key">action</field>
<field name="model">hr.applicant</field>
</record>
</data>
</openerp>
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_recruitment_phonecall" model="ir.ui.view">
<field name="name">hr.recruitment.job2phonecall.form</field>
<field name="model">hr.recruitment.job2phonecall</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Schedule Phone Call">
<group col="4" colspan="6">
<separator string="Phone Call Description" colspan="4" />
<newline />
<field name='user_id' />
<field name='deadline' />
<newline />
<field name='note' colspan="4"/>
<newline />
<field name='category_id'/>
</group>
<separator colspan="4"/>
<group col="2" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="make_phonecall" string="Schedule Phone Call" colspan="1" type="object" icon="gtk-execute"/>
</group>
</form>
</field>
</record>
<record id="action_hr_recruitment_phonecall" model="ir.actions.act_window">
<field name="name">Schedule Phone Call</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.recruitment.job2phonecall</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<!--<record model="ir.values" id="hr_recruitment_phonecall_values">
<field name="model_id" ref="model_hr_applicant" />
<field name="object" eval="1" />
<field name="name">Schedule Phone Call</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_hr_recruitment_phonecall'))" />
<field name="key">action</field>
<field name="model">hr.applicant</field>
</record>-->
</data>
</openerp>
@@ -40,6 +40,9 @@ reports, eso.""",
'report/report_analytic_view.xml',
'report/hr_timesheet_invoice_report_view.xml',
'wizard/hr_timesheet_invoice_analytic_cost_ledger_view.xml',
'wizard/hr_timesheet_analytic_profit_view.xml',
'wizard/hr_timesheet_invoice_create_view.xml',
'wizard/hr_timesheet_invoice_create_final_view.xml',
],
'demo_xml': ['hr_timesheet_invoice_demo.xml'],
'installable': True,
@@ -24,7 +24,7 @@
rml="hr_timesheet_invoice/report/account_analytic_profit.rml"
string="Timesheet Profit"/>
<wizard
<!--<wizard
id="account_analytic_profit"
menu="False"
model="account.analytic.line"
@@ -36,7 +36,7 @@
id="print_account_analytic_profit"
parent="menu_hr_reporting_timesheet_invoice"
type="wizard"
groups="hr.group_hr_manager"/>
groups="hr.group_hr_manager"/>-->
</data>
</openerp>
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<wizard id="hr_timesheet_invoice_create" model="account.analytic.line" name="hr.timesheet.invoice.create" string="Invoice analytic lines"/>
<wizard id="hr_timesheet_final_invoice_create" model="account.analytic.account" name="hr.timesheet.final.invoice.create" string="Final Invoice"/>
<!-- <wizard id="hr_timesheet_invoice_create" model="account.analytic.line" name="hr.timesheet.invoice.create" string="Invoice analytic lines"/>-->
<!--<wizard id="hr_timesheet_final_invoice_create" model="account.analytic.account" name="hr.timesheet.final.invoice.create" string="Final Invoice"/>-->
</data>
</openerp>
@@ -20,7 +20,7 @@
##############################################################################
import hr_timesheet_invoice_create
import account_analytic_profit
import hr_timesheet_analytic_profit
import hr_timesheet_final_invoice_create
import hr_timesheet_analytic_cost_ledger_report
@@ -1,99 +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/>.
#
##############################################################################
import wizard
import datetime
import pooler
from tools.translate import _
form='''<?xml version="1.0"?>
<form string="Choose">
<field name="date_from"/>
<field name="date_to"/>
<field name="journal_ids" colspan="4"/>
<field name="employee_ids" colspan="4"/>
</form>'''
class wizard_report(wizard.interface):
def _date_from(*a):
return datetime.datetime.today().strftime('%Y-%m-1')
def _date_to(*a):
return datetime.datetime.today().strftime('%Y-%m-%d')
def _check(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
line_obj = pool.get('account.analytic.line')
product_obj = pool.get('product.product')
price_obj = pool.get('product.pricelist')
ids = line_obj.search(cr, uid, [
('date', '>=', data['form']['date_from']),
('date', '<=', data['form']['date_to']),
('journal_id', 'in', data['form']['journal_ids'][0][2]),
('user_id', 'in', data['form']['employee_ids'][0][2]),
])
if not ids:
raise wizard.except_wizard(_('Data Insufficient!'), _('No Records Found for Report!'))
return data['form']
fields={
'date_from':{
'string':'From',
'type':'date',
'required':True,
'default':_date_from,
},
'date_to':{
'string':'To',
'type':'date',
'required':True,
'default':_date_to,
},
'journal_ids':{
'string':'Journal',
'type':'many2many',
'relation':'account.analytic.journal',
'required':True,
},
'employee_ids':{
'string':'Employee',
'type':'many2many',
'relation':'res.users',
'required':True,
},
}
states={
'init':{
'actions':[],
'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end', 'Cancel', 'gtk-cancel'), ('report', 'Print', 'gtk-ok')]}
},
'report':{
'actions':[_check],
'result':{'type':'print', 'report':'account.analytic.profit', 'state':'end'}
}
}
wizard_report('account.analytic.profit')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,79 @@
# -*- 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/>.
#
##############################################################################
import datetime
from osv import osv, fields
from tools.translate import _
class account_analytic_profit(osv.osv_memory):
_name = 'hr.timesheet.analytic.profit'
_description = 'Print Timesheet Profit'
_columns = {
'date_from': fields.date('From', required=True),
'date_to': fields.date('To', required=True),
'journal_ids': fields.many2many('account.analytic.journal', 'analytic_profit_journal_rel', 'analytic_id', 'journal_id', 'Journal', required=True),
'employee_ids': fields.many2many('res.users', 'analytic_profit_emp_rel', 'analytic_id', 'emp_id', 'Employee', required=True),
}
def _date_from(*a):
return datetime.datetime.today().strftime('%Y-%m-1')
def _date_to(*a):
return datetime.datetime.today().strftime('%Y-%m-%d')
_defaults = {
'date_from': _date_from,
'date_to': _date_to
}
def print_report(self, cr, uid, ids, context=None):
line_obj = self.pool.get('account.analytic.line')
product_obj = self.pool.get('product.product')
price_obj = self.pool.get('product.pricelist')
data = {}
data['form'] = self.read(cr, uid , ids, [], context=context)[0]
if context is None:
context = {}
ids_chk = line_obj.search(cr, uid, [
('date', '>=', data['form']['date_from']),
('date', '<=', data['form']['date_to']),
('journal_id', 'in', data['form']['journal_ids']),
('user_id', 'in', data['form']['employee_ids']),
])
if not ids_chk:
raise osv.except_osv(_('Data Insufficient!'), _('No Records Found for Report!'))
data['form']['journal_ids'] = [(6, 0, data['form']['journal_ids'])] # Improve me => Change the rml/sxw so that it can support withou [0][2]
data['form']['employee_ids'] = [(6, 0, data['form']['employee_ids'])]
datas = {
'ids': [],
'model': 'account.analytic.line',
'form': data['form']
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.analytic.profit',
'datas': datas,
}
account_analytic_profit()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_timesheet_analytic_profit" model="ir.ui.view">
<field name="name">Timesheet Profit</field>
<field name="model">hr.timesheet.analytic.profit</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Timesheet Profit">
<group col="4" colspan="6">
<field name="date_from"/>
<field name="date_to"/>
<field name="journal_ids" colspan="4"/>
<field name="employee_ids" colspan="4"/>
</group>
<separator colspan="4"/>
<group col="2" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="print_report" string="Print" colspan="1" type="object" icon="gtk-print"/>
</group>
</form>
</field>
</record>
<record id="action_hr_timesheet_analytic_profit" model="ir.actions.act_window">
<field name="name">Timesheet Profit</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.timesheet.analytic.profit</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem action="action_hr_timesheet_analytic_profit"
id="menu_hr_timesheet_analytic_profit"
parent="menu_hr_reporting_timesheet_invoice" groups="hr.group_hr_manager" />
</data>
</openerp>
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,15 +15,14 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import pooler
import time
from tools.translate import _
from osv import osv, fields
from tools.translate import _
#
# Create an final invoice based on selected timesheet lines
#
@@ -31,26 +30,37 @@ from tools.translate import _
#
# TODO: check unit of measure !!!
#
class final_invoice_create(wizard.interface):
def _get_defaults(self, cr, uid, data, context):
return {}
class final_invoice_create(osv.osv_memory):
_name = 'hr.timesheet.invoice.create.final'
_description = 'Create invoice from timesheet final'
_columns = {
'date': fields.boolean('Date', help='Display date in the history of works'),
'time': fields.boolean('Time spent', help='Display time in the history of works'),
'name': fields.boolean('Name of entry', help='Display detail of work in the invoice line.'),
'price': fields.boolean('Cost', help='Display cost of the item you reinvoice'),
'balance_product': fields.many2one('product.product', 'Balance product', help='The product that will be used to invoice the remaining amount'),
}
def _do_create(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
mod_obj = pool.get('ir.model.data')
def do_create(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
analytic_account_obj = self.pool.get('account.analytic.account')
res_partner_obj = self.pool.get('res.partner')
account_payment_term_obj = self.pool.get('account.payment.term')
invoices = []
if context is None:
context = {}
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
analytic_account_obj = pool.get('account.analytic.account')
res_partner_obj = pool.get('res.partner')
account_payment_term_obj = pool.get('account.payment.term')
account_ids = data['ids']
invoices = []
data = self.read(cr, uid, ids, [], context)[0]
account_ids = 'active_ids' in context and context['active_ids'] or []
for account in analytic_account_obj.browse(cr, uid, account_ids, context):
partner = account.partner_id
amount_total=0.0
if (not partner) or not (account.pricelist_id):
raise wizard.except_wizard(_('Analytic account incomplete'),
raise osv.except_osv(_('Analytic account incomplete'),
_('Please fill in the partner and pricelist field '
'in the analytic account:\n%s') % (account.name,))
@@ -67,15 +77,15 @@ class final_invoice_create(wizard.interface):
curr_invoice = {
'name': time.strftime('%D')+' - '+account.name,
'partner_id': account.partner_id.id,
'address_contact_id': pool.get('res.partner').address_get(cr, uid, [account.partner_id.id], adr_pref=['contact'])['contact'],
'address_invoice_id': pool.get('res.partner').address_get(cr, uid, [account.partner_id.id], adr_pref=['invoice'])['invoice'],
'address_contact_id': self.pool.get('res.partner').address_get(cr, uid, [account.partner_id.id], adr_pref=['contact'])['contact'],
'address_invoice_id': self.pool.get('res.partner').address_get(cr, uid, [account.partner_id.id], adr_pref=['invoice'])['invoice'],
'payment_term': partner.property_payment_term.id or False,
'account_id': partner.property_account_receivable.id,
'currency_id': account.pricelist_id.currency_id.id,
'date_due': date_due,
'fiscal_position': account.partner_id.property_account_position.id
}
last_invoice = pool.get('account.invoice').create(cr, uid, curr_invoice)
last_invoice = self.pool.get('account.invoice').create(cr, uid, curr_invoice)
invoices.append(last_invoice)
context2=context.copy()
@@ -106,14 +116,14 @@ class final_invoice_create(wizard.interface):
line.product_uom_id,
move_line.ref""", (account.id,))
for product_id, amount, account_id, product_uom_id, ref in cr.fetchall():
product = pool.get('product.product').browse(cr, uid, product_id, context2)
product = self.pool.get('product.product').browse(cr, uid, product_id, context2)
if product:
taxes = product.taxes_id
else:
taxes = []
tax = pool.get('account.fiscal.position').map_tax(cr, uid, account.partner_id.property_account_position, taxes)
tax = self.pool.get('account.fiscal.position').map_tax(cr, uid, account.partner_id.property_account_position, taxes)
curr_line = {
'price_unit': -amount,
'quantity': 1.0,
@@ -126,14 +136,14 @@ class final_invoice_create(wizard.interface):
'account_id': account_id,
'account_analytic_id': account.id
}
pool.get('account.invoice.line').create(cr, uid, curr_line)
self.pool.get('account.invoice.line').create(cr, uid, curr_line)
if not data['form']['balance_product']:
raise wizard.except_wizard(_('Balance product needed'), _('Please fill a Balance product in the wizard'))
product = pool.get('product.product').browse(cr, uid, data['form']['balance_product'], context2)
if not data['balance_product']:
raise osv.except_osv(_('Balance product needed'), _('Please fill a Balance product in the wizard'))
product = self.pool.get('product.product').browse(cr, uid, data['balance_product'], context2)
taxes = product.taxes_id
tax = pool.get('account.fiscal.position').map_tax(cr, uid, account.partner_id.property_account_position, taxes)
tax = self.pool.get('account.fiscal.position').map_tax(cr, uid, account.partner_id.property_account_position, taxes)
account_id = product.product_tmpl_id.property_account_income.id or product.categ_id.property_account_income_categ.id
curr_line = {
'price_unit': account.amount_max - amount_total,
@@ -147,9 +157,9 @@ class final_invoice_create(wizard.interface):
'account_id': account_id,
'account_analytic_id': account.id
}
pool.get('account.invoice.line').create(cr, uid, curr_line)
self.pool.get('account.invoice.line').create(cr, uid, curr_line)
if account.amount_max < amount_total:
pool.get('account.invoice').write(cr, uid, [last_invoice], {'type': 'out_refund',})
self.pool.get('account.invoice').write(cr, uid, [last_invoice], {'type': 'out_refund',})
cr.execute('update account_analytic_line set invoice_id=%s where invoice_id is null and account_id=%s', (last_invoice, account.id))
return {
@@ -161,40 +171,9 @@ class final_invoice_create(wizard.interface):
'view_id': False,
'context': "{'type':'out_invoice'}",
'type': 'ir.actions.act_window',
'search_view_id': res['res_id']
}
'search_view_id': res['res_id']
}
final_invoice_create()
_create_form = """<?xml version="1.0"?>
<form title="Final invoice for analytic account">
<separator string="Do you want details for each line of the invoices ?" colspan="4"/>
<field name="date"/>
<field name="time"/>
<field name="name"/>
<field name="price"/>
<separator string="Invoice Balance amount" colspan="4"/>
<field name="balance_product" required="1"/>
</form>"""
_create_fields = {
'date': {'string':'Date', 'type':'boolean', 'help':"Display date in the history of works"},
'time': {'string':'Time spent', 'type':'boolean', 'help':"Display time in the history of works"},
'name': {'string':'Name of entry', 'type':'boolean', 'help':"Display detail of work in the invoice line."},
'price': {'string':'Cost', 'type':'boolean', 'help':"Display cost of the item you reinvoice"},
'balance_product': {'string':'Balance product', 'type': 'many2one', 'relation':'product.product', 'help':"The product that will be used to invoice the remaining amount."},
}
states = {
'init' : {
'actions' : [_get_defaults],
'result' : {'type':'form', 'arch':_create_form, 'fields':_create_fields, 'state': [('end','Cancel', 'gtk-cancel'),('create','Create invoices', 'gtk-ok')]},
},
'create' : {
'actions' : [],
'result' : {'type':'action', 'action':_do_create, 'state':'end'},
},
}
final_invoice_create('hr.timesheet.final.invoice.create')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -19,52 +19,69 @@
#
##############################################################################
import wizard
import pooler
import time
from osv import osv, fields
from tools.translate import _
#
# Create an invoice based on selected timesheet lines
## Create an invoice based on selected timesheet lines
#
#
# TODO: check unit of measure !!!
#
class invoice_create(wizard.interface):
def _get_accounts(self, cr, uid, data, context):
if not len(data['ids']):
class hr_timesheet_invoice_create(osv.osv_memory):
_name = 'hr.timesheet.invoice.create'
_description = 'Create invoice from timesheet'
_columns = {
'accounts': fields.many2many('account.analytic.account', 'invoice_id', 'account_id', 'Analytic Accounts', required=True),
'date': fields.boolean('Date', help='The real date of each work will be displayed on the invoice'),
'time': fields.boolean('Time spent', help='The time of each work done will be displayed on the invoice'),
'name': fields.boolean('Name of entry', help='The detail of each work done will be displayed on the invoice'),
'price': fields.boolean('Cost', help='The cost of each work done will be displayed on the invoice. You probably don\'t want to check this'),
'product': fields.many2one('product.product', 'Product', help='Complete this field only if you want to force to use a specific product. Keep empty to use the real product that comes from the cost.'),
}
def _get_accounts(self, cr, uid, context=None):
if context is None:
context = {}
if not len(context['active_ids']):
return {}
#Checking whether the analytic line is invoiced or not
pool = pooler.get_pool(cr.dbname)
analytic_line_obj = pool.get('account.analytic.line').browse(cr, uid, data['ids'], context)
analytic_line_obj = self.pool.get('account.analytic.line').browse(cr, uid, context['active_ids'], context)
for obj_acc in analytic_line_obj:
if obj_acc.invoice_id and obj_acc.invoice_id.state !='cancel':
raise wizard.except_wizard(_('Warning'),_('The analytic entry "%s" is already invoiced!')%(obj_acc.name,))
cr.execute("SELECT distinct(account_id) from account_analytic_line where id =ANY(%s)",(data['ids'],))
account_ids = cr.fetchall()
return {'accounts': [x[0] for x in account_ids]}
raise osv.except_osv(_('Warning'),_('The analytic entry "%s" is already invoiced!')%(obj_acc.name,))
cr.execute("SELECT distinct(account_id) from account_analytic_line where id =ANY(%s)",(context['active_ids'],))
account_ids = cr.fetchall()
return [x[0] for x in account_ids]
_defaults = {
'accounts': _get_accounts
}
def do_create(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
analytic_account_obj = self.pool.get('account.analytic.account')
res_partner_obj = self.pool.get('res.partner')
account_payment_term_obj = self.pool.get('account.payment.term')
invoices = []
def _do_create(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
mod_obj = pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
analytic_account_obj = pool.get('account.analytic.account')
res_partner_obj = pool.get('res.partner')
account_payment_term_obj = pool.get('account.payment.term')
account_ids = data['form']['accounts'][0][2]
invoices = []
data = self.read(cr, uid, ids, [], context)[0]
account_ids = data['accounts']
for account in analytic_account_obj.browse(cr, uid, account_ids, context):
partner = account.partner_id
if (not partner) or not (account.pricelist_id):
raise wizard.except_wizard(_('Analytic Account incomplete'),
raise osv.except_osv(_('Analytic Account incomplete'),
_('Please fill in the Associate Partner and Sale Pricelist fields in the Analytic Account:\n%s') % (account.name,))
if not partner.address:
raise wizard.except_wizard(_('Partner incomplete'),
raise osv.except_osv(_('Partner incomplete'),
_('Please fill in the Address field in the Partner: %s.') % (partner.name,))
date_due = False
@@ -90,7 +107,7 @@ class invoice_create(wizard.interface):
'date_due': date_due,
'fiscal_position': account.partner_id.property_account_position.id
}
last_invoice = pool.get('account.invoice').create(cr, uid, curr_invoice)
last_invoice = self.pool.get('account.invoice').create(cr, uid, curr_invoice)
invoices.append(last_invoice)
context2=context.copy()
@@ -99,26 +116,26 @@ class invoice_create(wizard.interface):
"FROM account_analytic_line as line " \
"WHERE account_id = %s " \
"AND id =ANY(%s) AND to_invoice IS NOT NULL " \
"GROUP BY product_id,to_invoice", (account.id,data['ids'],))
"GROUP BY product_id,to_invoice", (account.id,context['active_ids'],))
for product_id,factor_id,qty in cr.fetchall():
product = pool.get('product.product').browse(cr, uid, product_id, context2)
if not product:
raise wizard.except_wizard(_('Error'), _('At least one line has no product !'))
raise osv.except_osv(_('Error'), _('At least one line has no product !'))
factor_name = ''
factor = pool.get('hr_timesheet_invoice.factor').browse(cr, uid, factor_id, context2)
if not data['form']['product']:
if not data['product']:
if factor.customer_name:
factor_name = product.name+' - '+factor.customer_name
else:
factor_name = product.name
else:
factor_name = pool.get('product.product').name_get(cr, uid, [data['form']['product']], context=context)[0][1]
factor_name = pool.get('product.product').name_get(cr, uid, [data['product']], context=context)[0][1]
if account.pricelist_id:
pl = account.pricelist_id.id
price = pool.get('product.pricelist').price_get(cr,uid,[pl], data['form']['product'] or product_id, qty or 1.0, account.partner_id.id)[pl]
price = pool.get('product.pricelist').price_get(cr,uid,[pl], data['product'] or product_id, qty or 1.0, account.partner_id.id)[pl]
else:
price = 0.0
@@ -132,7 +149,7 @@ class invoice_create(wizard.interface):
'invoice_line_tax_id': [(6,0,tax )],
'invoice_id': last_invoice,
'name': factor_name,
'product_id': data['form']['product'] or product_id,
'product_id': data['product'] or product_id,
'invoice_line_tax_id': [(6,0,tax)],
'uos_id': product.uom_id.id,
'account_id': account_id,
@@ -149,27 +166,27 @@ class invoice_create(wizard.interface):
for line in line_ids:
# set invoice_line_note
details = []
if data['form']['date']:
if data['date']:
details.append(line['date'])
if data['form']['time']:
if data['time']:
if line['product_uom_id']:
details.append("%s %s" % (line['unit_amount'], pool.get('product.uom').browse(cr, uid, [line['product_uom_id']])[0].name))
else:
details.append("%s" % (line['unit_amount'], ))
if data['form']['name']:
if data['name']:
details.append(line['name'])
#if data['form']['price']:
#if data['price']:
# details.append(abs(line['amount']))
note.append(u' - '.join(map(lambda x: unicode(x) or '',details)))
curr_line['note'] = "\n".join(map(lambda x: unicode(x) or '',note))
pool.get('account.invoice.line').create(cr, uid, curr_line)
cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id =ANY(%s)" ,(last_invoice,account.id,data['ids']))
cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id =ANY(%s)" ,(last_invoice, account.id,data['ids']))
pool.get('account.invoice').button_reset_taxes(cr, uid, [last_invoice], context)
self.pool.get('account.invoice').button_reset_taxes(cr, uid, [last_invoice], context)
mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
mod_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')
mod_id = mod_obj.search(cr, uid, [('name', '=', 'action_invoice_tree1')])[0]
res_id = mod_obj.read(cr, uid, mod_id, ['res_id'])['res_id']
@@ -190,45 +207,8 @@ class invoice_create(wizard.interface):
# 'search_view_id': res['res_id']
# }
_create_form = """<?xml version="1.0"?>
<form string="Invoice on analytic entries">
<notebook>
<page string="Billing Data">
<separator string="Do you want to show details of work in invoice ?" colspan="4"/>
<field name="date"/>
<field name="time"/>
<field name="name"/>
<field name="price"/>
<separator string="Force to use a specific product" colspan="4"/>
<field name="product"/>
</page>
<page string="Filter on Accounts" groups="base.group_extended">
<separator string="Choose accounts you want to invoice" colspan="4"/>
<field name="accounts" colspan="4" nolabel="1"/>
</page>
</notebook>
</form>"""
_create_fields = {
'accounts': {'string':'Analytic Accounts', 'type':'many2many', 'required':'true', 'relation':'account.analytic.account'},
'date': {'string':'Date', 'type':'boolean', 'help':'The real date of each work will be displayed on the invoice'},
'time': {'string':'Time spent', 'type':'boolean', 'help':'The time of each work done will be displayed on the invoice'},
'name': {'string':'Name of entry', 'type':'boolean', 'help':'The detail of each work done will be displayed on the invoice'},
'price': {'string':'Cost', 'type':'boolean', 'help':'The cost of each work done will be displayed on the invoice. You probably don\'t want to check this.'},
'product': {'string':'Product', 'type':'many2one', 'relation': 'product.product', 'help':"Complete this field only if you want to force to use a specific product. Keep empty to use the real product that comes from the cost."},
}
states = {
'init' : {
'actions' : [_get_accounts],
'result' : {'type':'form', 'arch':_create_form, 'fields':_create_fields, 'state': [('end','Cancel', 'gtk-cancel'),('create','Create Invoices', 'gtk-ok')]},
},
'create' : {
'actions' : [],
'result' : {'type':'action', 'action':_do_create, 'state':'end'},
},
}
invoice_create('hr.timesheet.invoice.create')
hr_timesheet_invoice_create()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_timesheet_invoice_create_final" model="ir.ui.view">
<field name="name">hr.timesheet.invoice.create.final.form</field>
<field name="model">hr.timesheet.invoice.create.final</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Final invoice for analytic account">
<group col="4" colspan="6">
<separator string="Do you want details for each line of the invoices ?" colspan="4"/>
<field name="date"/>
<field name="time"/>
<field name="name"/>
<field name="price"/>
<separator string="Invoice Balance amount" colspan="4"/>
<field name="balance_product" required="1"/>
</group>
<separator colspan="4"/>
<group col="2" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="do_create" string="Create Invoices" colspan="1" type="object" icon="gtk-execute"/>
</group>
</form>
</field>
</record>
<record id="action_hr_timesheet_invoice_create_final" model="ir.actions.act_window">
<field name="name">Final Invoice</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.timesheet.invoice.create.final</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record model="ir.values" id="hr_timesheet_invoice_create_final_values">
<field name="model_id" ref="model_account_analytic_account" />
<field name="object" eval="1" />
<field name="name">Final Invoice</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_hr_timesheet_invoice_create_final'))" />
<field name="key">action</field>
<field name="model">account.analytic.account</field>
</record>
</data>
</openerp>
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_timesheet_invoice_create" model="ir.ui.view">
<field name="name">hr.timesheet.invoice.create.form</field>
<field name="model">hr.timesheet.invoice.create</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invoice analytic lines">
<group col="4" colspan="6">
<notebook>
<page string="Billing Data">
<separator string="Do you want to show details of work in invoice ?" colspan="4"/>
<field name="date"/>
<field name="time"/>
<field name="name"/>
<field name="price"/>
<separator string="Force to use a specific product" colspan="4"/>
<field name="product"/>
</page>
<page string="Filter on Accounts" groups="base.group_extended">
<separator string="Choose accounts you want to invoice" colspan="4"/>
<field name="accounts" colspan="4" nolabel="1"/>
</page>
</notebook>
</group>
<separator colspan="4"/>
<group col="2" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="do_create" string="Create Invoices" colspan="1" type="object" icon="gtk-execute"/>
</group>
</form>
</field>
</record>
<record id="action_hr_timesheet_invoice_create" model="ir.actions.act_window">
<field name="name">Invoice analytic lines</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.timesheet.invoice.create</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record model="ir.values" id="hr_timesheet_invoice_create_values">
<field name="model_id" ref="model_account_analytic_line" />
<field name="object" eval="1" />
<field name="name">Invoice analytic lines</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_hr_timesheet_invoice_create'))" />
<field name="key">action</field>
<field name="model">account.analytic.line</field>
</record>
</data>
</openerp>
+3 -4
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,12 +15,11 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard_timesheet_current
import wizard_timesheet_department
import hr_timesheet_current
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,27 +15,27 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import netsvc
import time
import pooler
from osv import osv
from osv import osv, fields
from tools.translate import _
class wiz_timesheet_open(wizard.interface):
def _open_timesheet(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
user_ids = pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)])
if not len(user_ids):
raise wizard.except_wizard(_('Error !'), _('No employee defined for your user !'))
ts = pool.get('hr_timesheet_sheet.sheet')
ids = ts.search(cr, uid, [('user_id','=',uid),('state','=','draft'),('date_from','<=',time.strftime('%Y-%m-%d')), ('date_to','>=',time.strftime('%Y-%m-%d'))])
class hr_timesheet_current_open(osv.osv_memory):
_name = 'hr.timesheet.current.open'
_description = 'hr.timesheet.current.open'
def open_timesheet(self, cr, uid, ids, context=None):
ts = self.pool.get('hr_timesheet_sheet.sheet')
view_type = 'form,tree'
user_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)])
if not len(user_ids):
raise osv.except_osv(_('Error !'), _('No employee defined for your user !'))
ids = ts.search(cr, uid, [('user_id','=',uid),('state','=','draft'),('date_from','<=',time.strftime('%Y-%m-%d')), ('date_to','>=',time.strftime('%Y-%m-%d'))])
if len(ids) > 1:
view_type = 'tree,form'
domain = "[('id','in',["+','.join(map(str, ids))+"]),('user_id', '=', uid)]"
@@ -46,7 +46,7 @@ class wiz_timesheet_open(wizard.interface):
domain = "[('user_id', '=', uid)]"
value = {
'domain': domain,
'name': 'Open timesheet',
'name': 'Open Timesheet',
'view_type': 'form',
'view_mode': view_type,
'res_model': 'hr_timesheet_sheet.sheet',
@@ -57,14 +57,6 @@ class wiz_timesheet_open(wizard.interface):
value['res_id'] = ids[0]
return value
states = {
'init' : {
'actions' : [],
'result' : {'type':'action', 'action':_open_timesheet, 'state':'end'}
}
}
wiz_timesheet_open('hr_timesheet_sheet.current.open')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
hr_timesheet_current_open()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,114 +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/>.
#
##############################################################################
import wizard
import netsvc
import time
import pooler
from osv import osv
class wiz_timesheet_open(wizard.interface):
def _open_timesheet(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
dep_ids = pool.get('hr.department').search(cr, uid, [('manager_id','=',uid)])
user_ids = {}
for dep in pool.get('hr.department').browse(cr, uid, dep_ids, context):
for user in dep.member_ids:
user_ids[user.id] = 1
value = {
'domain': "[('user_id', 'in', "+str(user_ids.keys())+")]",
'name': 'Timesheets',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'hr_timesheet_sheet.sheet',
'view_id': False,
'type': 'ir.actions.act_window'
}
return value
states = {
'init' : {
'actions' : [],
'result' : {'type':'action', 'action':_open_timesheet, 'state':'end'}
}
}
wiz_timesheet_open('hr_timesheet_sheet.department.open')
class wiz_timesheet_confirm_open(wizard.interface):
def _open_timesheet(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
dep_ids = pool.get('hr.department').search(cr, uid, [('manager_id','=',uid)])
user_ids = {}
for dep in pool.get('hr.department').browse(cr, uid, dep_ids, context):
for user in dep.member_ids:
user_ids[user.id] = 1
value = {
'domain': "[('user_id', 'in', "+str(user_ids.keys())+"),('state','=','draft')]",
'name': 'Timesheets',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'hr_timesheet_sheet.sheet',
'view_id': False,
'type': 'ir.actions.act_window'
}
return value
states = {
'init' : {
'actions' : [],
'result' : {'type':'action', 'action':_open_timesheet, 'state':'end'}
}
}
wiz_timesheet_confirm_open('hr_timesheet_sheet.department.confirm.open')
class wiz_timesheet_validate_open(wizard.interface):
def _open_timesheet(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
dep_ids = pool.get('hr.department').search(cr, uid, [('manager_id','=',uid)])
user_ids = {}
for dep in pool.get('hr.department').browse(cr, uid, dep_ids, context):
for user in dep.member_ids:
user_ids[user.id] = 1
value = {
'domain': "[('user_id', 'in', "+str(user_ids.keys())+"),('state','=','confirm')]",
'name': 'Timesheets',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'hr_timesheet_sheet.sheet',
'view_id': False,
'type': 'ir.actions.act_window'
}
return value
states = {
'init' : {
'actions' : [],
'result' : {'type':'action', 'action':_open_timesheet, 'state':'end'}
}
}
wiz_timesheet_validate_open('hr_timesheet_sheet.department.validate.open')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+13 -4
View File
@@ -162,16 +162,25 @@ class mrp_bom(osv.osv):
"""
result = {}
bom_obj = self.pool.get('mrp.bom')
bom_id = context and context.get('active_id', False) or False
cr.execute('select id from mrp_bom')
if all(bom_id != r[0] for r in cr.fetchall()):
ids.sort()
bom_id = ids[0]
bom_parent = bom_obj.browse(cr, uid, bom_id)
for bom in self.browse(cr, uid, ids, context=context):
result[bom.id] = map(lambda x: x.id, bom.bom_lines)
if (bom_parent and bom_parent.multi_level_bom) or bom.id == bom_id:
result[bom.id] = map(lambda x: x.id, bom.bom_lines)
else:
result[bom.id] = []
if bom.bom_lines:
continue
ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce'))
if bom.type=='phantom' or ok:
if (bom.type=='phantom' or ok) and bom_parent.multi_level_bom:
sids = bom_obj.search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)])
if sids:
bom2 = bom_obj.browse(cr, uid, sids[0], context=context)
result[bom.id] += map(lambda x: x.id, bom2.bom_lines)
result[bom.id] += map(lambda x: x.id, bom2.bom_lines)
return result
@@ -267,7 +276,7 @@ class mrp_bom(osv.osv):
v['name'] = prod.name
return {'value': v}
return {}
def _bom_find(self, cr, uid, product_id, product_uom, properties=[]):
""" Finds BoM for particular product and product uom.
@param product_id: Selected product.
+2 -2
View File
@@ -253,13 +253,13 @@
<field name="product_uos" groups="product.group_uos"/>
<field name="product_uos_qty" groups="product.group_uos"/>
<newline/>
<field name="multi_level_bom" invisible="1"/>
<field name="multi_level_bom" />
<field name="type" groups="base.group_extended"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
<page string="General Information">
<field colspan="4" name="bom_lines" nolabel="1" widget="one2many_list"/>
<field colspan="4" name="bom_lines" nolabel="1" widget="one2many_list" />
</page>
<page string="Revisions" groups="base.group_extended">
<field colspan="4" name="revision_ids" nolabel="1" widget="one2many_list"/>
+2 -1
View File
@@ -46,7 +46,8 @@
"data/olap_security.xml",
'security/ir.model.access.csv'
],
"demo_xml" : ["data/olap_demo.xml"],
"demo_xml" : ["data/olap_demo.xml",
"test/olap_test00.yml"],
"active": False,
"installable": True
}
+2 -9
View File
@@ -41,10 +41,7 @@
<field name="loaded"/>
<separator string="Connection url" colspan="4"/>
<field name="connection_url" nolabel="1" colspan="2"/>
<!--
<button name="test_connection" string="Test Connection" type="object" colspan="2"/>
-->
<button name="%(bi_test_connection)d" string="Test Connection" type="action" colspan="2"/>
</page>
<page string="Tables">
<field name="table_ids" colspan="4" nolabel="1"/>
@@ -277,7 +274,7 @@
<field name="table_name" select="1" />
<field name="application_id" select="1" />
<field name="is_hidden" select="1" colspan="2" />
</form>
</field>
</record>
@@ -325,7 +322,7 @@
<field name="application_id" select="1" />
<newline/>
<field name="is_hidden" select="1" colspan="2"/>
</form>
</field>
</record>
@@ -340,9 +337,5 @@
id="menu_view_olap_application_field_form"
parent="menu_bi_conf_known_application"/>
</data>
</openerp>
+2 -2
View File
@@ -96,8 +96,8 @@ class olap_fact_database(osv.osv):
raise osv.except_osv('Error (cx_Oracle) : ', e)
except Exception,e:
raise osv.except_osv('BI Error !', e)
raise osv.except_osv('Error !', e)
raise osv.except_osv('Message', 'Connection Successful !')
return True
_columns = {
+111
View File
@@ -0,0 +1,111 @@
-
In order to check olap module which is used to configure BI from OpenERP client.I create olap fact database record.
-
!record {model: olap.fact.database, id: olap_fact_database_openerp0}:
connection_type: port
db_host: localhost
db_login: postgres
db_name: tiny
db_password: '123456'
db_port: 5432
name: OpenERP
type: postgres
-
I will check the connection for successful login. >>>>>>(Problem)
# !python {model: olap.fact.database}: |
# self.test_connection(cr, uid,[ref('olap_fact_database_openerp0')], context)
-
In order to test schema,I create a new schema record.
-
!record {model: olap.schema, id: olap_schema_Partners0}:
database_id: olap_fact_database_openerp0
name: Partners
-
I press "Connect to Database" and I see that the Schema State is "Database Connected" now
-
!workflow {model: olap.schema, action: dbconnect, ref: olap_schema_Partners0}
-
Now I will load the structure of the database. by structure we mean tables, columns and the relations. This will help in defining cube easily.
-
!record {model: bi.load.db.wizard, id: bi_load_db_wizard_0}:
db_name: OpenERP
fact_table: Partners
-
I can see two buttons for Configuration one for manually and the other is for Automatically.I press "Configure Automatically".After configuration I can see that the Boolean Configuring Data-structure is True now Schema State is "The Structure is Configured" and there is one button "Mark as Configured"
-
!record {model: bi.auto.configure.wizard, id: bi_auto_configure_wizard_Partners0}:
name: Partners
-
Performing a workflow action load on module olap.schema
-
!workflow {model: olap.schema, action: dbload, ref: olap_schema_Partners0}
-
Performing a workflow action configure on module olap.schema
-
!workflow {model: olap.schema, action: dbconfigure, ref: olap_schema_Partners0}
-
Performing a workflow action dbready on module olap.schema
-
!workflow {model: olap.schema, action: dbready, ref: olap_schema_Partners0}
-
In order to create Cube I first define the fact table.Fact table are the key tables in which measures are stored and we can branch to other tables for other parameters.
-
!record {model: olap.database.tables, id: database_table_res_partner}:
active: True
fact_database_id: fact_database_terp
name: res_partner
table_db_name: res_partner
-
I create cube table and select ID of as Relational Column.Then I select related record in Joined tables.
-
!record {model: olap.cube.table, id: olap_cube_table_partnercubetable0}:
column_link_id: olap.columns_res_partner_id
name: Partner cube table
available_table_ids:
- olap.columns_res_partner_date
- olap.columns_res_partner_id
- olap.columns_res_partner_credit_limit
- olap.columns_res_partner_user_id
-
I can configure Cube from BI Cube Designer.I make sure that OpenERP BI web-client is running.From Configuration I click on "Cube Designer" and It will open Cube Designer in my system browser.I can see that the schema "Partners" is visible through Cube Designer.
-
Creating olap cube
-
!record {model: olap.cube, id: olap_cube_partnercube0}:
name: Partner cube
query_log: true
schema_id: olap_schema_Partners0
table_id: olap_cube_table_partnercubetable0
-
After cube we can decide upon the dimensions to be used for the cube.In order to analyze Partner I create one dimension.
-
!record {model: olap.dimension, id: olap_dimension_products0}:
name: Products
cube_id: olap_cube_partnercube0
-
After adding the dimension I create hierarchy.
-
!record {model: olap.hierarchy, id: olap_hierarchy_allproducts0}:
dimension_id: olap_dimension_products0
name: All Products
sequence: 1
table_id: olap_cube_table_partnercubetable0
-
After adding the hierarchy I create level.I select Product's default_code as Columns Name that is loaded in Fact columns.
-
!record {model: olap.level, id: olap_level_productscode0}:
column_id_name: name
column_name: olap.columns_res_user_name
hierarchy_id: olap_hierarchy_allproducts0
name: Products code
sequence: 1
table_name: res_users
type: normal
-
I will check that columns is loaded in Fact Table.
-
!python {model: olap.load.column}: |
ids = self.search(cr, uid, [])
self.get_table_data(cr, uid, ids, {'active_ids': [ref('olap_cube_table_partnercubetable0')]})
-1
View File
@@ -26,7 +26,6 @@ class olap_load_column(osv.osv_memory):
_description = "Olap Load Column"
def get_table_data(self, cr, uid, ids, context={}):
"""
This function load column
@param cr: the current row, from the database cursor,
+1 -1
View File
@@ -313,7 +313,7 @@
<separator colspan="4" string="Is there anything blocking you ?"/>
<field colspan="4" name="question_blocks" nolabel="1"/>
</page>
<page string="Optionnal Info">
<page string="Optional Info">
<separator colspan="4" string="Are your Sprint Backlog estimate accurate ?"/>
<field colspan="4" name="question_backlog" nolabel="1"/>
</page>
+4 -4
View File
@@ -7,16 +7,16 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2009-04-10 14:08+0000\n"
"Last-Translator: <>\n"
"PO-Revision-Date: 2010-04-25 14:27+0000\n"
"Last-Translator: Andrey Kulakov <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-17 04:20+0000\n"
"X-Launchpad-Export-Date: 2010-04-26 03:42+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: stock_invoice_directly
#: model:ir.module.module,shortdesc:stock_invoice_directly.module_meta_information
msgid "Invoice Picking Directly"
msgstr ""
msgstr "Напрямую выставляемый счет"
+3
View File
@@ -44,6 +44,9 @@
'wizard/survey_print.xml',
'wizard/survey_send_invitation.xml'],
'demo_xml': ['survey_demo.xml'],
'test': [
'test/survey00.yml',
],
'installable': True,
'active': False,
}
+159
View File
@@ -0,0 +1,159 @@
- |
Survey Scenario:
In order to check the survey module in OpenERP.
-
I Create the one survey and give survey title "Partner Feedback" and define the survey pages and survey question.
-
I Create "Partner Feedback" survey.
-
!record {model: 'survey', id: survey_partner_0}:
title: 'Partner Feedback'
max_response_limit: 20
-
I Create "Who are you?" page in "Partner Feedback" survey with title .
-
!record {model: 'survey.page', id: survey_partner_page_0}:
title: 'Who are you?'
survey_id: survey_partner_0
-
I Create "What is your company name?" question in "Who are you" survey page.
-
!record {model: 'survey.question', id: survey_p_question_0}:
question: 'What is your company name?'
type: single_textbox
sequence: 1
page_id: survey_partner_page_0
-
I Create "What is your company size?" question in "Who are you" survey page.
-
!record {model: 'survey.question', id: survey_p_question_1}:
question: 'What is your company size?'
type: multiple_choice_only_one_ans
sequence: 2
is_require_answer: true
page_id: survey_partner_page_0
-
I Create "1-50" answer in question "What is your company size?"
-
!record {model: 'survey.answer', id: survey_p_1_1}:
answer: '1 - 50'
sequence: 1
question_id : survey_p_question_1
-
I Create "51 - 100" answer in question "What is your company size?"
-
!record {model: 'survey.answer', id: survey_p_1_2}:
answer: '51 - 100'
sequence: 2
question_id : survey_p_question_1
-
I Create "100 - 500" answer in question "What is your company size?"
-
!record {model: 'survey.answer', id: survey_p_1_3}:
answer: '100 - 500'
sequence: 3
question_id : survey_p_question_1
-
I Create "500 - 1000" answer in question "What is your company size?"
-
!record {model: 'survey.answer', id: survey_p_1_4}:
answer: '500 - 1000'
sequence: 4
question_id : survey_p_question_1
-
I Create "> 1000" answer in question "What is your company size?"
-
!record {model: 'survey.answer', id: survey_p_1_5}:
answer: '> 1000'
sequence: 5
question_id : survey_p_question_1
-
I Create another "Contract" page in "Partner Feedback" survey.
-
!record {model: 'survey.page', id: survey_partner_page_1}:
title: 'Contract'
survey_id: survey_partner_0
-
I Create "Which maintenance contract do you sell to your customers." question in "Contract" survey page.
-
!record {model: 'survey.question', id: survey_p_question_3}:
question: 'Which maintenance contract do you sell to your customers.'
type: multiple_choice_only_one_ans
sequence: 1
page_id: survey_partner_page_1
-
I Create "OpenERP maintenance contract" answer in question "Which maintenance contract do you sell to your customers."
-
!record {model: 'survey.answer', id: survey_p_3_1}:
answer: 'OpenERP maintenance contract'
sequence: 1
question_id : survey_p_question_3
-
I Create "Your own contract, but you buy an OpenERP one" answer in question "Which maintenance contract do you sell to your customers."
-
!record {model: 'survey.answer', id: survey_p_3_2}:
answer: 'Your own contract, but you buy an OpenERP one'
sequence: 2
question_id : survey_p_question_3
-
I Create "Your own contract without buying an OpenERP one" answer in question "Which maintenance contract do you sell to your customers."
-
!record {model: 'survey.answer', id: survey_p_3_3}:
answer: 'Your own contract without buying an OpenERP one'
sequence: 3
question_id : survey_p_question_3
-
I Create "When do you propose a maintenance contract to your customers?" question in "Contract" survey page.
-
!record {model: 'survey.question', id: survey_p_question_4}:
question: When do you propose a maintenance contract to your customers?
type: multiple_choice_only_one_ans
sequence: 2
comment_field_type: text
comment_label: Why?
is_require_answer: true
is_comment_require: true
page_id: survey_partner_page_1
-
I Create "With each integration" answer in question "When do you propose a maintenance contract to your customers?"
-
!record {model: 'survey.answer', id: survey_p_4_1}:
answer: 'With each integration'
sequence: 1
question_id : survey_p_question_4
-
I Create "Sometimes" answer in question "When do you propose a maintenance contract to your customers?"
-
!record {model: 'survey.answer', id: survey_p_4_2}:
answer: 'Sometimes'
sequence: 2
question_id : survey_p_question_4
-
I Create "Never... " answer in question "When do you propose a maintenance contract to your customers?"
-
!record {model: 'survey.answer', id: survey_p_4_3}:
answer: 'Never... '
sequence: 3
question_id : survey_p_question_4
-
Now Survey set in open state.
-
!python {model: survey}: |
self.survey_open(cr, uid, [ref("survey_partner_0")], context)
-
Give answer of the survey, Run "Answer a Survey" wizard and select the survey and press on start button then run the selected survey.
-
!python {model: survey.name.wiz}: |
ids = self.create(cr, uid, {'survey_id': ref("survey_partner_0")})
self.action_next(cr, uid, [ids], context)
-
Give answer of the first and second page in "Partner Feedback" suvey.
-
!python {model: survey.question.wiz}: |
ids = self.create(cr, uid, {str(ref("survey_p_question_0")) +"_single" :'Tiny' , str(ref("survey_p_question_1")) + "_selection" :int(ref("survey_p_1_1"))}, context)
ids = self.create(cr, uid, {str(ref("survey_p_question_3")) +"_selection" : int(ref("survey_p_3_1")), str(ref("survey_p_question_4")) +"_selection": int(ref("survey_p_4_1"))},context)
-
Set the value in "Total start survey" field.
-
!python {model: survey}: |
ids = self.write(cr, uid, ref("survey_partner_0"), {'tot_start_survey' : 1}, context)
+2 -1
View File
@@ -42,7 +42,8 @@
'data/wiki_main.xml',
'security/ir.model.access.csv'
],
'demo_xml': [],
'demo_xml': ['test/wiki_test00.yml'],
# 'demo_xml': [],
'installable': True,
'active': False,
'certificate': '0086363630317',
+72
View File
@@ -0,0 +1,72 @@
-
In order to test the wiki in OpenERP, I create a new wiki group on Select Display Method Tree
-
!record {model: wiki.groups, id: wiki_groups_wikigrouptest0}:
method: tree
name: Wiki Group Test
notes: I can Generate New Group for Select Display method = Tree.
-
Now I will create new wikipage and assign Group test to this page
-
!record {model: wiki.wiki, id: wiki_wiki_openerpwikiediting0}:
group_id: wiki.wiki_groups_wikigrouptest0
name: OpenERP Wiki Test
section: '1.1'
text_area: '=The Open ERP wiki=
The Open ERP wiki allows you to manage your enterprise contents using wiki
restructured texts. This module provides a collaborative way to manage internal
FAQs, quality manuals, technical references, etc.
'
-
I Get Help on this current page by clicking on "Basic wiki Editing" wizard
-
!python {model: wiki.wiki}: |
self.open_wiki_page(cr, uid, [ref("wiki_wiki_openerpwikiediting0")], context)
-
I create Index on this current page by clicking on "Create Index" wizard
-
!python {model: wiki.make.index}: |
ids = self.search(cr, uid, [])
self.wiki_do_index(cr, uid, ids , {'active_ids': [ref('wiki_wiki_openerpwikiediting0')]})
-
# Remaining Act window
I check the page history for the current page by clicking on "Page History".After that find difference between history.
-
I create a new wiki group on the Given Home Page
-
!record {model: wiki.groups, id: wiki_groups_wikigroupediting0}:
name: Wiki Group Editing
home: wiki.wiki_wiki_quickstart0
-
I open a wiki page on this given group and page by clicking on Open wiki Page wizard.
-
!python {model: wiki.wiki.page.open}: |
ids = self.search(cr, uid, [])
self.open_wiki_page(cr, uid, ids, {'active_ids': [ref('wiki_groups_wikigroupediting0')]})
-
# Remaining beacuse of Act window (I search the page by clicking on the "search page".)
In order to create a menu I will create wizard data
-
!record {model: wiki.groups, id: wiki.wiki_groups_wikiformatting0}:
home: wiki.wiki_wiki_main
-
I create a Menu by clicking on "create menu" button.
# The folowing is not running properly because of osv memory problem
-
!record {model: wiki.create.menu, id: wiki_create_menu_0}:
menu_name: Wiki Test menu
menu_parent_id: base.menu_base_partner
page: wiki.wiki_wiki_openerpwikiediting0
-
#I will check that menu is generated properly
-
# Remaining because some problem occur
#!python {model: wiki.create.menu}: |
# ids = self.search(cr, uid, [])
# self.wiki_menu_create(cr, uid, ids, context)