[MERGE] merge with main branch

bzr revid: mra@mra-laptop-20100726063015-u2vmy0pk4pnlkq2o
This commit is contained in:
Mustufa Rangwala 2010-07-26 12:00:15 +05:30
commit 84cf2f8177
79 changed files with 1263 additions and 731 deletions

View File

@ -248,59 +248,59 @@ class account_account(osv.osv):
def __compute(self, cr, uid, ids, field_names, arg=None, context=None,
query='', query_params=()):
""" compute the balance, debit and/or credit for the provided
account ids
Arguments:
`ids`: account ids
`field_names`: the fields to compute (a list of any of
'balance', 'debit' and 'credit')
`arg`: unused fields.function stuff
`query`: additional query filter (as a string)
`query_params`: parameters for the provided query string
(__compute will handle their escaping) as a
tuple
"""
mapping = {
'balance': "COALESCE(SUM(l.debit),0) " \
"- COALESCE(SUM(l.credit), 0) as balance",
'debit': "COALESCE(SUM(l.debit), 0) as debit",
'credit': "COALESCE(SUM(l.credit), 0) as credit"
}
#get all the necessary accounts
children_and_consolidated = self._get_children_and_consol(cr, uid, ids, context=context)
#compute for each account the balance/debit/credit from the move lines
accounts = {}
if children_and_consolidated:
aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
""" compute the balance, debit and/or credit for the provided
account ids
Arguments:
`ids`: account ids
`field_names`: the fields to compute (a list of any of
'balance', 'debit' and 'credit')
`arg`: unused fields.function stuff
`query`: additional query filter (as a string)
`query_params`: parameters for the provided query string
(__compute will handle their escaping) as a
tuple
"""
mapping = {
'balance': "COALESCE(SUM(l.debit),0) " \
"- COALESCE(SUM(l.credit), 0) as balance",
'debit': "COALESCE(SUM(l.debit), 0) as debit",
'credit': "COALESCE(SUM(l.credit), 0) as credit"
}
#get all the necessary accounts
children_and_consolidated = self._get_children_and_consol(cr, uid, ids, context=context)
#compute for each account the balance/debit/credit from the move lines
accounts = {}
if children_and_consolidated:
aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
wheres = [""]
if query.strip():
wheres.append(query.strip())
if aml_query.strip():
wheres.append(aml_query.strip())
filters = " AND ".join(wheres)
self.logger.notifyChannel('addons.'+self._name, netsvc.LOG_DEBUG,
'Filters: %s'%filters)
# IN might not work ideally in case there are too many
# children_and_consolidated, in that case join on a
# values() e.g.:
# SELECT l.account_id as id FROM account_move_line l
# INNER JOIN (VALUES (id1), (id2), (id3), ...) AS tmp (id)
# ON l.account_id = tmp.id
# or make _get_children_and_consol return a query and join on that
request = ("SELECT l.account_id as id, " +\
' , '.join(map(mapping.__getitem__, field_names)) +
" FROM account_move_line l" \
" WHERE l.account_id IN %s " \
+ filters +
" GROUP BY l.account_id")
params = (tuple(children_and_consolidated),) + query_params
cr.execute(request, params)
self.logger.notifyChannel('addons.'+self._name, netsvc.LOG_DEBUG,
'Status: %s'%cr.statusmessage)
wheres = [""]
if query.strip():
wheres.append(query.strip())
if aml_query.strip():
wheres.append(aml_query.strip())
filters = " AND ".join(wheres)
self.logger.notifyChannel('addons.'+self._name, netsvc.LOG_DEBUG,
'Filters: %s'%filters)
# IN might not work ideally in case there are too many
# children_and_consolidated, in that case join on a
# values() e.g.:
# SELECT l.account_id as id FROM account_move_line l
# INNER JOIN (VALUES (id1), (id2), (id3), ...) AS tmp (id)
# ON l.account_id = tmp.id
# or make _get_children_and_consol return a query and join on that
request = ("SELECT l.account_id as id, " +\
' , '.join(map(mapping.__getitem__, field_names)) +
" FROM account_move_line l" \
" WHERE l.account_id IN %s " \
+ filters +
" GROUP BY l.account_id")
params = (tuple(children_and_consolidated),) + query_params
cr.execute(request, params)
self.logger.notifyChannel('addons.'+self._name, netsvc.LOG_DEBUG,
'Status: %s'%cr.statusmessage)
for res in cr.dictfetchall():
accounts[res['id']] = res
for res in cr.dictfetchall():
accounts[res['id']] = res
# consolidate accounts with direct children
children_and_consolidated.reverse()
@ -1078,24 +1078,13 @@ class account_move(osv.osv):
'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner"),
'amount': fields.function(_amount_compute, method=True, string='Amount', digits_compute=dp.get_precision('Account'), type='float', fnct_search=_search_amount),
'date': fields.date('Date', required=True, states={'posted':[('readonly',True)]}),
'type': fields.selection([
('pay_voucher','Cash Payment'),
('bank_pay_voucher','Bank Payment'),
('rec_voucher','Cash Receipt'),
('bank_rec_voucher','Bank Receipt'),
('cont_voucher','Contra'),
('journal_sale_vou','Journal Sale'),
('journal_pur_voucher','Journal Purchase'),
('journal_voucher','Journal Voucher'),
],'Entry Type', select=True , size=128, readonly=True, states={'draft':[('readonly',False)]}),
'narration':fields.text('Narration', readonly=True, select=True, states={'draft':[('readonly',False)]}),
'narration':fields.text('Narration', select=True),
'company_id': fields.related('journal_id','company_id',type='many2one',relation='res.company',string='Company',store=True),
}
_defaults = {
'name': lambda *a: '/',
'state': lambda *a: 'draft',
'period_id': _get_period,
'type' : lambda *a : 'journal_voucher',
'date': lambda *a:time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
@ -1174,8 +1163,20 @@ class account_move(osv.osv):
# TODO: Check if period is closed !
#
def create(self, cr, uid, vals, context={}):
if 'line_id' in vals:
if 'journal_id' in vals:
if 'line_id' in vals and context.get('copy'):
for l in vals['line_id']:
if not l[0]:
l[2].update({
'reconcile_id':False,
'reconcil_partial_id':False,
'analytic_lines':False,
'invoice':False,
'ref':False,
'balance':False,
'account_tax_id':False,
})
if 'journal_id' in vals and vals.get('journal_id', False):
for l in vals['line_id']:
if not l[0]:
l[2]['journal_id'] = vals['journal_id']
@ -1201,11 +1202,14 @@ class account_move(osv.osv):
result = super(account_move, self).create(cr, uid, vals, context)
return result
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
default = default.copy()
default.update({'state':'draft', 'name':'/',})
def copy(self, cr, uid, id, default={}, context={}):
default.update({
'state':'draft',
'name':'/',
})
context.update({
'copy':True
})
return super(account_move, self).copy(cr, uid, id, default, context)
def unlink(self, cr, uid, ids, context={}, check=True):
@ -2540,9 +2544,9 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'account_paid_id': acc_template_ref[value['account_paid_id']],
})
# Creating Journals
# Creating Journals Sales and Purchase
vals_journal={}
data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_view')])
data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_sp_journal_view')])
data = data_pool.browse(cr, uid, data_id[0])
view_id = data.res_id
@ -2574,6 +2578,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
vals_journal['type'] = 'purchase'
vals_journal['code'] = _('EXJ')
vals_journal['sequence_id'] = seq_id_purchase
vals_journal['view_id'] = view_id
if obj_multi.chart_template_id.property_account_payable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id]

View File

@ -135,6 +135,12 @@
<field name="amount_untaxed" sum="Untaxed Amount"/>
<field name="amount_total" sum="Total Amount"/>
<field name="state"/>
<button name="invoice_open" states="draft,proforma2" string="Approve" icon="terp-camera_test"/>
<button name="%(action_account_invoice_pay)d" type='action' string='Pay Invoice' states='open' icon="gtk-ok"/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="terp-gtk-stop"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Credit Note' states='open,paid' icon="gtk-execute"/>
</tree>
</field>
</record>
@ -151,7 +157,7 @@
<field name="number" readonly="1"/>
<field name="type" invisible="1"/>
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change"/>
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}"/>
<newline/>
<field name="partner_id" domain="[('supplier','=', 1)]" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" context="{'default_customer': 0}"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
@ -260,7 +266,7 @@
<field name="number"/>
<field name="type" invisible="1"/>
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change"/>
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}"/>
<newline/>
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" groups="base.group_user"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
@ -365,6 +371,11 @@
<field name="amount_total"/>
</group>
<newline/>
<group col="10" colspan="4">
<field name="journal_id" widget="selection" select='1'/>
<field name="period_id" select='1'/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
@ -424,7 +435,7 @@
<field name="domain">[('type','=','out_invoice')]</field>
<field name="context">{'type':'out_invoice'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">Most of customer invoices are automatically generate in draft mode by OpenERP flows, following a purchase order for instance. Review, confirm or cancel, pay or refund yours customers invoices here. A manual invoice can be created here.</field>
<field name="help">Most of customer invoices are automatically generated in draft mode by OpenERP flows, following a purchase order for instance. Review, confirm or cancel, pay or refund your customers' invoices here. A manual invoice can be created here.</field>
</record>
<record id="action_invoice_tree1_view1" model="ir.actions.act_window.view">

View File

@ -8,23 +8,23 @@
<menuitem id="menu_finance_bank_and_cash" name="Bank and Cash" parent="menu_finance" sequence="3"/>
<!-- <menuitem id="menu_accounting" name="Accounting" parent="menu_finance" sequence="5"/>-->
<menuitem id="menu_finance_periodical_processing" name="Periodical Processing" parent="menu_finance" sequence="8" groups="group_account_user"/>
<menuitem id="periodical_processing_journal_entries_validation" name="Entries to Review" parent="menu_finance_periodical_processing"/>
<menuitem id="periodical_processing_reconciliation" name="Reconciliation" parent="menu_finance_periodical_processing"/>
<menuitem id="periodical_processing_journal_entries_validation" name="Entries to Review" parent="menu_finance_periodical_processing"/>
<menuitem id="periodical_processing_reconciliation" name="Reconciliation" parent="menu_finance_periodical_processing"/>
<!-- <menuitem id="periodical_processing_recurrent_entries" name="Recurrent Entries" parent="menu_finance_periodical_processing"/>-->
<menuitem id="periodical_processing_invoicing" name="Invoicing" parent="menu_finance_periodical_processing"/>
<menuitem id="periodical_processing_invoicing" name="Invoicing" parent="menu_finance_periodical_processing"/>
<!-- <menuitem id="periodical_processing_end_of_period" name="End of Period" parent="menu_finance_periodical_processing"/>-->
<menuitem id="menu_finance_charts" name="Charts" parent="menu_finance" sequence="5"/>
<menuitem id="menu_finance_reporting" name="Reporting" parent="account.menu_finance" sequence="12"/>
<menuitem id="menu_finance_reporting_budgets" name="Budgets" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_legal_statement" name="Legal Reports" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_management_belgian_reports" name="Belgian Reports" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_reporting_budgets" name="Budgets" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_legal_statement" name="Legal Reports" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_management_belgian_reports" name="Belgian Reports" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_configuration" name="Configuration" parent="menu_finance" sequence="13"/>
<menuitem id="menu_finance_accounting" name="Financial Accounting" parent="menu_finance_configuration"/>
<menuitem id="menu_analytic_accounting" name="Analytic Accounting" parent="menu_finance_configuration"/>
<menuitem id="menu_analytic" parent="menu_analytic_accounting" name="Accounts"/>
<menuitem id="menu_low_level" name="Low Level" parent="menu_finance_accounting"/>
<menuitem id="menu_configuration_misc" name="Miscelleanous" parent="menu_finance_configuration"/>
<menuitem id="base.menu_action_currency_form" parent="menu_configuration_misc" sequence="20"/>
<menuitem id="menu_finance_accounting" name="Financial Accounting" parent="menu_finance_configuration"/>
<menuitem id="menu_analytic_accounting" name="Analytic Accounting" parent="menu_finance_configuration"/>
<menuitem id="menu_analytic" parent="menu_analytic_accounting" name="Accounts"/>
<menuitem id="menu_low_level" name="Low Level" parent="menu_finance_accounting"/>
<menuitem id="menu_configuration_misc" name="Miscelleanous" parent="menu_finance_configuration"/>
<menuitem id="base.menu_action_currency_form" parent="menu_configuration_misc" sequence="20"/>
<!-- <menuitem id="menu_finance_configuration1" name="Configuration" parent="menu_finance" sequence="80"/>-->
<!-- <menuitem id="base.menu_action_currency_form" parent="menu_finance_configuration" sequence="20"/>-->
<!-- <menuitem id="menu_finance_accounting1" name="Financial Accounting" parent="menu_finance_configuration" sequence="80"/>-->
@ -35,7 +35,7 @@
<!-- <menuitem id="menu_finance_legal_statement1" name="Legal Statements" parent="account.menu_finance_reporting" sequence="200"/>-->
<menuitem id="menu_finance_entries" name="Accounting" parent="menu_finance" sequence="4"
groups="group_account_user"/>
groups="group_account_user"/>
<menuitem id="account.menu_finance_recurrent_entries" name="Recurring Entries" parent="menu_finance_periodical_processing" sequence="15"/>
<!-- <menuitem id="menu_finance_periodical_processing11" name="Periodical Processing" parent="account.menu_finance"-->
@ -43,17 +43,17 @@
<!-- groups="group_account_user"/>-->
<menuitem id="menu_account_end_year_treatments" name="End of Period" parent="menu_finance_periodical_processing"/>
<menuitem id="menu_finance_statistic_report_statement" name="Statistic Reports" parent="menu_finance_reporting" sequence="300"/>
<menuitem id="menu_finance_statistic_report_statement" name="Statistic Reports" parent="menu_finance_reporting" sequence="300"/>
<menuitem
parent="account.menu_finance_legal_statement"
id="final_accounting_reports"
name="Accounting Reports"/>
<menuitem
parent="account.menu_finance_legal_statement"
id="final_accounting_reports"
name="Accounting Reports"/>
<menuitem
parent="account.menu_finance_legal_statement"
id="menu_journals_report"
name="Journals"/>
<menuitem
parent="account.menu_finance_legal_statement"
id="menu_journals_report"
name="Journals"/>
</data>
</openerp>

View File

@ -20,7 +20,6 @@
##############################################################################
import time
from datetime import datetime
from operator import itemgetter
import netsvc
from osv import fields, osv
@ -192,7 +191,7 @@ class account_move_line(osv.osv):
# Compute the current move
move_id = False
partner_id = False
if context.get('journal_id',False) and context.get('period_id',False):
if context.get('journal_id', False) and context.get('period_id', False):
if 'move_id' in fields:
cr.execute('select move_id \
from \
@ -208,6 +207,7 @@ class account_move_line(osv.osv):
return data
else:
data['move_id'] = move_id
if 'date' in fields:
cr.execute('select date \
from \
@ -223,7 +223,6 @@ class account_move_line(osv.osv):
period = period_obj.browse(cr, uid, context['period_id'],
context=context)
data['date'] = period.date_start
if not move_id:
return data
@ -463,6 +462,7 @@ class account_move_line(osv.osv):
context=context)
dt = period.date_start
return dt
def _get_currency(self, cr, uid, context={}):
if not context.get('journal_id', False):
return False
@ -795,6 +795,31 @@ class account_move_line(osv.osv):
return j+(p and (':'+p) or '')
return False
# def onchange_date(self, cr, user, ids, date, context={}):
# """
# Returns a dict that contains new values and context
# @param cr: A database cursor
# @param user: ID of the user currently logged in
# @param date: latest value from user input for field date
# @param args: other arguments
# @param context: context arguments, like lang, time zone
# @return: Returns a dict which contains new values, and context
# """
# res = {}
# period_pool = self.pool.get('account.period')
# pids = period_pool.search(cr, user, [('date_start','<=',date), ('date_stop','>=',date)])
# if pids:
# res.update({
# 'period_id':pids[0]
# })
# context.update({
# 'period_id':pids[0]
# })
# return {
# 'value':res,
# 'context':context,
# }
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False):
result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu)
if view_type != 'tree':
@ -857,11 +882,14 @@ class account_move_line(osv.osv):
elif field == 'credit':
attrs.append('sum="Total credit"')
elif field == 'account_tax_id':
attrs.append('domain="[(\'parent_id\',\'=\',False)]"')
attrs.append('domain="[(\'parent_id\',\'=\',False), (\'type_tax_use\',\'=\',context.get(journal_id.type, \'sale\'))]"')
elif field == 'account_id' and journal.id:
attrs.append('domain="[(\'journal_id\', \'=\', '+str(journal.id)+'),(\'type\',\'&lt;&gt;\',\'view\'), (\'type\',\'&lt;&gt;\',\'closed\')]" on_change="onchange_account_id(account_id, partner_id)"')
elif field == 'partner_id':
attrs.append('on_change="onchange_partner_id(move_id, partner_id, account_id, debit, credit, date, journal_id)"')
# elif field == 'date':
# attrs.append('on_change="onchange_date(date)"')
# if field.readonly:
# attrs.append('readonly="1"')
# if field.required:
@ -907,6 +935,7 @@ class account_move_line(osv.osv):
def _check_date(self, cr, uid, vals, context=None, check=True):
if context is None:
context = {}
journal_id = False
if 'date' in vals.keys():
if 'journal_id' in vals and 'journal_id' not in context:
journal_id = vals['journal_id']
@ -1094,7 +1123,7 @@ class account_move_line(osv.osv):
result = super(osv.osv, self).create(cr, uid, vals, context)
# CREATE Taxes
if vals.get('account_tax_id',False):
if vals.get('account_tax_id', False):
tax_id = tax_obj.browse(cr, uid, vals['account_tax_id'])
total = vals['debit'] - vals['credit']
if journal.refund_journal:
@ -1167,7 +1196,7 @@ class account_move_line(osv.osv):
if check and ((not context.get('no_store_function')) or journal.entry_posted):
tmp = self.pool.get('account.move').validate(cr, uid, [vals['move_id']], context)
if journal.entry_posted and tmp:
self.pool.get('account.move').button_validate(cr,uid, [vals['move_id']],context)
rs = self.pool.get('account.move').button_validate(cr,uid, [vals['move_id']],context)
return result
account_move_line()

View File

@ -266,12 +266,19 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Journal Column">
<field colspan="4" name="name" select="1"/>
<field colspan="4" name="name" select="1"/><field name="name"/>
<field name="date"/>
<field name="period_id"/>
<field name="journal_id"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<field name="balance_end"/>
<field name="state"/>
<field name="field" select="1"/>
<field name="sequence"/>
<newline/>
<field name="readonly"/>
<field name="required"/>
<!-- <newline/>-->
<!-- <field name="readonly"/>-->
<!-- <field name="required"/>-->
</form>
</field>
</record>
@ -283,8 +290,8 @@
<tree string="Journal Column">
<field name="sequence"/>
<field name="name"/>
<field name="required"/>
<field name="readonly"/>
<!-- <field name="required"/>-->
<!-- <field name="readonly"/>-->
</tree>
</field>
</record>
@ -295,11 +302,18 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Journal View">
<field colspan="4" name="name" select="1"/>
<field name="name" select="1"/>
<field colspan="4" name="columns_id" nolabel="1" widget="one2many_list"/>
</form>
</field>
</record>
<record id="action_account_journal_view" model="ir.actions.act_window">
<field name="name">Journal Views</field>
<field name="res_model">account.journal.view</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem action="action_account_journal_view" id="menu_action_account_journal_view" parent="account.menu_low_level"/>
<!--
# Account Journal
@ -414,18 +428,20 @@
<field name="model">account.bank.statement</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Statement">
<group col="10" colspan="4">
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Statement"/>
<filter icon="terp-check" string="Posted" domain="[('state','=','confirm')]" help="Confirm confirm"/>
<search string="Search Bank Statements">
<group col="8" colspan="4">
<filter string="Draft" domain="[('state','=','draft')]" icon="terp-document-new"/>
<filter string="Confirm" domain="[('state','=','confirm')]" icon="terp-camera_test"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="date"/>
<field name="name"/>
<field name="journal_id"/>
</group>
<group expand="0" string="Group By..." colspan="12" col="10">
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
<newline/>
<group expand="0" string="Group By...">
<filter string="Journal" context="{'group_by': 'journal_id'}" icon="terp-folder-orange"/>
<filter string="Period" context="{'group_by': 'period_id'}" icon="terp-go-month"/>
<filter string="State" context="{'group_by': 'state'}" icon="terp-stock_effects-object-colorize"/>
</group>
</search>
</field>
@ -437,10 +453,10 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="red:balance_end_real!=balance_end and state=='draft';blue:state=='draft' and (balance_end_real==balance_end);black:state=='confirm'" string="Statement">
<field name="date"/>
<field name="name"/>
<field name="journal_id"/>
<field name="date"/>
<field name="period_id"/>
<field name="journal_id"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<field name="balance_end"/>
@ -457,7 +473,7 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Bank Statements">
<group>
<group col="8" colspan="4">
<filter string="Draft" domain="[('state','=','draft')]" icon="terp-document-new"/>
<filter string="Confirm" domain="[('state','=','confirm')]" icon="terp-camera_test"/>
<separator orientation="vertical"/>
@ -536,7 +552,7 @@
<field name="name">Bank Statements</field>
<field name="res_model">account.bank.statement</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="domain">[('journal_id.type', '=', 'bank')]</field>
</record>
<record model="ir.actions.act_window.view" id="action_bank_statement_tree_bank">
@ -663,7 +679,7 @@
<field name="period_id"/>
<field name="journal_id"/>
<field name="partner_id"/>
<field name="amount"/>
<field name="amount" sum="Total Amount"/>
<field name="state"/>
</tree>
</field>
@ -899,43 +915,69 @@
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<form string="Account Entry Line">
<notebook>
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="ref"/>
<field name="partner_id" select="1" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,date)"/>
<field name="journal_id"/>
<field name="period_id"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
</group>
<notebook colspan="4">
<page string="Information">
<separator colspan="4" string="General Information"/>
<field name="name" select="1"/>
<field name="date" select="1"/>
<field name="ref"/>
<field name="invoice"/>
<field name="account_id" select="1" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="partner_id" select="1" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,date)"/>
<group col="2" colspan="2">
<separator colspan="2" string="Amount"/>
<field name="account_id" select="1" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="debit"/>
<field name="credit"/>
<field name="quantity"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Accounting Documents"/>
<field name="invoice"/>
<field name="move_id" required="False"/>
<field name="statement_id"/>
</group>
<field name="debit"/>
<field name="credit"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
<group col="2" colspan="2">
<separator colspan="2" string="Dates"/>
<field name="date" select="1"/>
<field name="date_maturity"/>
<field name="date_created"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Taxes"/>
<field name="tax_code_id"/>
<field name="tax_amount"/>
<field name="account_tax_id" domain="[('parent_id','=',False)]"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Currency"/>
<field name="currency_id"/>
<field name="amount_currency"/>
</group>
<separator colspan="4" string="Optional Information"/>
<field name="currency_id"/>
<field name="amount_currency"/>
<field name="quantity"/>
<field name="move_id" required="False"/>
<newline/>
<field name="statement_id"/>
<field name="blocked"/>
<field name="date_maturity"/>
<field name="date_created"/>
<newline/>
<field name="tax_code_id"/>
<field name="tax_amount"/>
<newline/>
<field name="account_tax_id" domain="[('parent_id','=',False)]"/>
<field name="analytic_account_id"/>
<group col="2" colspan="2">
<separator colspan="2" string="Reconciliation"/>
<field name="reconcile_id"/>
<field name="reconcile_partial_id"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="States"/>
<field name="state"/>
<field name="blocked"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Analytic"/>
<field name="analytic_account_id"/>
</group>
<separator colspan="4" string="State"/>
<field name="journal_id"/>
<field name="period_id"/>
<field name="reconcile_id"/>
<field name="reconcile_partial_id"/>
<field name="state"/>
</page>
<page string="Analytic Lines">
<field colspan="4" name="analytic_lines" nolabel="1" context="{'default_general_account_id':account_id, 'default_name': name, 'default_date':date, 'amount': (debit or 0.0)-(credit or 0.0)}"/>
@ -945,7 +987,6 @@
</field>
</record>
<record id="view_move_line_form2" model="ir.ui.view">
<field name="name">account.move.line.form2</field>
<field name="model">account.move.line</field>
@ -953,7 +994,7 @@
<field eval="9" name="priority"/>
<field name="arch" type="xml">
<form string="Account Entry Line">
<notebook>
<notebook colspan="4">
<page string="Information">
<separator colspan="4" string="General Information"/>
<field name="name" select="1"/>
@ -993,6 +1034,19 @@
</field>
</record>
<record id="account_move_line_graph" model="ir.ui.view">
<field name="name">account.move.line.graph</field>
<field name="model">account.move.line</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Account Statistics" type="bar">
<field name="account_id"/>
<field name="debit" operator="+"/>
<field name="credit" operator="+"/>
</graph>
</field>
</record>
<record id="view_account_move_line_filter" model="ir.ui.view">
<field name="name">Entry Lines</field>
<field name="model">account.move.line</field>
@ -1001,8 +1055,11 @@
<search string="Search Entry Lines">
<group col='10' colspan='4'>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Entry Lines"/>
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','valid')]" help="Posted Entry Lines"/>
<separator orientation="vertical"/>
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','valid')]" help="Posted Entry Lines"/>
<filter icon="terp-stock_symbol-selection" string="Unposted" domain="[('move_id.state','=','draft')]" help="Unposted Entry Lines"/>
<separator orientation="vertical"/>
<filter icon="terp-stock_symbol-selection" string="Unreconciled" domain="[('reconcile_id','=',False), ('account_id.type','in',['receivable', 'payable'])]" help="Unreconciled Entry Lines"/>
<field name="date" select='1'/>
<field name="account_id" select='1'/>
<field name="partner_id" select='1'>
@ -1012,8 +1069,8 @@
</group>
<newline/>
<group col="10" colspan="4">
<field name="journal_id" widget="selection" context="{'journal_id':self, 'visible_id':self or 0, 'normal_view':False}"/>
<field name="period_id" widget="selection" context="{'period_id':self}"/>
<field name="journal_id" required="1" widget="selection" context="{'journal_id':self, 'visible_id':self or 0, 'normal_view':False}"/>
<field name="period_id" required="1" widget="selection" context="{'period_id':self}"/>
</group>
</search>
</field>
@ -1043,6 +1100,17 @@
Account.Entry Edition
-->
<record id="account_move_graph" model="ir.ui.view">
<field name="name">account.move.graph</field>
<field name="model">account.move</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Account Statistics" type="bar">
<field name="period_id"/>
<field name="amount" operator="+"/>
</graph>
</field>
</record>
<record id="view_move_tree" model="ir.ui.view">
<field name="name">account.move.tree</field>
<field name="model">account.move</field>
@ -1054,11 +1122,10 @@
<field name="ref"/>
<field name="journal_id"/>
<field name="period_id"/>
<field name="type" invisible=" not context.get('set_visible',True)"/>
<field name="partner_id"/>
<field name="line_id"/>
<field name="to_check" groups="base.group_extended"/>
<field name="amount"/>
<field name="amount" sum="Total Amount"/>
<field name="state"/>
<button name="button_validate" states="draft" string="Approve" type="object" icon="terp-camera_test"/>
</tree>
@ -1072,15 +1139,18 @@
<form string="Journal Entries">
<group colspan="4" col="6">
<field name="name" select="1" readonly="True"/>
<field name="ref" select="1"/>
<field name="to_check" groups="base.group_extended"/>
<field name="journal_id" select="1"/>
<field name="period_id"/>
<field name="type"/>
<field name="ref" select="1"/>
<field name="date" select="1"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
<field name="partner_id" invisible="1" select="1"/>
<field name="amount" invisible="1" select="1"/>
</group>
<notebook colspan="4">
<page string="Journal Entries Lines">
<field colspan="4" height="200" name="line_id" nolabel="1" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
<field colspan="4" name="line_id" nolabel="1" height="250" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
<form string="Account Entry Line">
<separator colspan="4" string="General Information"/>
<field name="name" select="1"/>
@ -1125,20 +1195,13 @@
</tree>
</field>
<separator colspan="4" string="Narration"/>
<field name="narration" colspan="4" nolabel="1"/>
<field name="state" select="1"/>
<group col="2" colspan="2">
<field name="narration" colspan="4" nolabel="1" height="50"/>
<group col="4" colspan="4">
<field name="state" select="1"/>
<button name="button_validate" states="draft" string="Approve" type="object" icon="terp-camera_test"/>
<button name="button_cancel" states="posted" string="Cancel" type="object" icon="terp-gtk-stop"/>
</group>
</page>
<page string="Other Information">
<field name="company_id" required="1" groups="base.group_multi_company"/>
<field name="date" select="1" groups="base.group_extended"/>
<field name="to_check" groups="base.group_extended"/>
<field name="partner_id" invisible="1" select="1"/>
<field name="amount" invisible="1" select="1"/>
</page>
</notebook>
</form>
</field>
@ -1155,28 +1218,34 @@
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Entries"/>
<separator orientation="vertical"/>
<filter icon="terp-camera_test" string="To Review" domain="[('to_check','=',True)]" groups="base.group_extended" help="To Review"/>
<separator orientation="vertical"/>
<field name="date" select='1'/>
<field name="name" select='1'/>
<field name="journal_id" select='1'/>
<field name="partner_id" select='1'/>
</group>
<newline/>
<group col='8' colspan='4'>
<field name="journal_id" widget="selection" select='1'/>
<field name="period_id" select='1'/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="12" col="10">
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type', 'set_visible':True}"/>
<filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
</group>
</search>
</field>
</record>
<record id="action_move_journal_line" model="ir.actions.act_window">
<record id="action_move_journal_line" model="ir.actions.act_window">
<field name="name">Journal Entries</field>
<field name="res_model">account.move</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" ref="view_move_tree"/>
<field name="search_view_id" ref="view_account_move_filter"/>
</record>
@ -1205,21 +1274,20 @@
res_model="account.move.line"
src_model="account.move"/>
<record id="action_move_to_review" model="ir.actions.act_window">
<field name="name">Journal Entries</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.move</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_move_tree"/>
<field name="search_view_id" ref="view_account_move_filter"/>
<field name="domain">[('to_check','=',True), ('state','=','draft')]</field>
</record>
<menuitem
action="action_move_to_review"
id="menu_action_move_to_review"
parent="periodical_processing_journal_entries_validation"
/>
<!-- <record id="action_move_to_review" model="ir.actions.act_window">-->
<!-- <field name="name">Journal Entries</field>-->
<!-- <field name="type">ir.actions.act_window</field>-->
<!-- <field name="res_model">account.move</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_id" ref="view_move_tree"/>-->
<!-- <field name="search_view_id" ref="view_account_move_filter"/>-->
<!-- <field name="domain">[('to_check','=',True), ('state','=','draft')]</field>-->
<!-- </record>-->
<!-- <menuitem-->
<!-- action="action_move_to_review"-->
<!-- id="menu_action_move_to_review"-->
<!-- parent="periodical_processing_journal_entries_validation"-->
<!-- />-->
<!-- <menuitem id="next_id_29" name="Search Entries" parent="account.menu_finance_entries" sequence="40"/>-->
<!-- <menuitem action="action_move_line_form" id="menu_action_move_line_form" parent="next_id_29"/>-->
@ -1239,7 +1307,7 @@
<field name="name">Journal Items</field>
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" ref="view_move_line_tree"/>
<field name="search_view_id" ref="view_account_move_line_filter"/>
<field name="domain">[('journal_id.type', 'in', ['sale', 'purchase_refund'])]</field>
@ -1251,11 +1319,10 @@
<field name="name">Journal Items</field>
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" ref="view_move_line_tree"/>
<field name="search_view_id" ref="view_account_move_line_filter"/>
<field name="domain">[('journal_id.type', 'in', ['purchase', 'sale_refund'])]</field>
<field name="context">{'journal_id':1}</field>
</record>
<menuitem action="action_account_moves_purchase" id="menu_eaction_account_moves_purchase" parent="menu_finance_payables"/>
@ -2272,7 +2339,7 @@
<field name="name">Journal Items</field>
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" ref="view_move_line_tree"/>
<field name="search_view_id" ref="view_account_move_line_filter"/>
</record>
@ -2286,23 +2353,22 @@
/>
<!-- Cash Statement -->
<record id="view_bank_statement_tree" model="ir.ui.view">
<record id="view_cash_statement_tree" model="ir.ui.view">
<field name="name">account.bank.statement.tree</field>
<field name="model">account.bank.statement</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="red:balance_end_real!=balance_end;blue:state=='draft' and (balance_end_real==balance_end);black:state in ('open')" string="Statement">
<field name="date"/>
<field name="name"/>
<field name="journal_id"/>
<field name="date"/>
<field name="period_id"/>
<field name="journal_id"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<field name="balance_end"/>
<field name="user_id" select="1"/>
<field name="state"/>
<button type="object" string="Open" name="button_open" states="draft" icon="terp-camera_test"/>
<button type="object" string="Confirm" name="button_confirm_cash" states="open" icon="terp-gtk-go-back-rtl"/>
<button type="object" string="Confirm" name="button_confirm_bank" states="open" icon="terp-gtk-go-back-rtl"/>
<button type="object" string="Cancel" name="button_cancel" states="confirm" icon="terp-gtk-stop"/>
</tree>
</field>
@ -2412,20 +2478,32 @@
</form>
</field>
</record>
<record id="account_cash_statement_graph" model="ir.ui.view">
<field name="name">account.bank.statement.graph</field>
<field name="model">account.bank.statement</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Account Statistics" type="bar">
<field name="date"/>
<field name="balance_start" operator="+"/>
<field name="balance_end" operator="+"/>
</graph>
</field>
</record>
<record id="action_view_bank_statement_tree" model="ir.actions.act_window">
<field name="name">Cash Register</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.bank.statement</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_bank_statement_tree"/>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" ref="view_cash_statement_tree"/>
<field name="search_view_id" ref="view_account_bank_statement_filter"/>
<field name="domain">[('journal_id.type', '=', 'cash')]</field>
</record>
<record model="ir.actions.act_window.view" id="act_cash_statement1_all">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_bank_statement_tree"/>
<field name="view_id" ref="view_cash_statement_tree"/>
<field name="act_window_id" ref="action_view_bank_statement_tree"/>
</record>
<record model="ir.actions.act_window.view" id="act_cash_statement2_all">
@ -2434,6 +2512,12 @@
<field name="view_id" ref="view_bank_statement_form2"/>
<field name="act_window_id" ref="action_view_bank_statement_tree"/>
</record>
<record model="ir.actions.act_window.view" id="act_cash_statement3_all">
<field name="sequence" eval="1"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="account_cash_statement_graph"/>
<field name="act_window_id" ref="action_view_bank_statement_tree"/>
</record>
<menuitem action="action_view_bank_statement_tree" id="journal_cash_move_lines" parent="menu_finance_bank_and_cash"/>
</data>

View File

@ -53,7 +53,7 @@
<field name="view_id" ref="board_account_form"/>
</record>
<menuitem icon="terp-graph" id="menu_dashboard_acc" name="Dashboard" sequence="2" parent="account.menu_finance_reporting"/>
<menuitem id="menu_dashboard_acc" name="Dashboard" sequence="2" parent="account.menu_finance_reporting"/>
<menuitem action="open_board_account" icon="terp-graph" id="menu_board_account" parent="menu_dashboard_acc" sequence="1"/>
</data>
</openerp>

View File

@ -33,8 +33,9 @@ class account_installer(osv.osv_memory):
_inherit = 'res.config.installer'
def _get_default_accounts(self, cr, uid, context=None):
accounts = [{'acc_name':'Current','account_type':'cash'},
{'acc_name':'Deposit','account_type':'cash'}]
accounts = [{'acc_name':'Current','account_type':'bank'},
{'acc_name':'Deposit','account_type':'bank'},
{'acc_name':'Cash','account_type':'cash'}]
return accounts
def _get_charts(self, cr, uid, context=None):
@ -295,9 +296,12 @@ class account_installer(osv.osv_memory):
'account_paid_id': acc_template_ref[value['account_paid_id']],
})
# Creating Journals
# Creating Journals Sales and Purchase
vals_journal={}
view_id = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Journal View')])[0]
data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_sp_journal_view')])
data = data_pool.browse(cr, uid, data_id[0])
view_id = data.res_id
seq_id = obj_sequence.search(cr,uid,[('name','=','Account Journal')])[0]
if seq_journal:

View File

@ -235,7 +235,7 @@ class account_invoice(osv.osv):
'reference': fields.char('Invoice Reference', size=64, help="The partner reference of this invoice."),
'reference_type': fields.selection(_get_reference_type, 'Reference Type',
required=True, readonly=True, states={'draft':[('readonly',False)]}),
'comment': fields.text('Additional Information', translate=True),
'comment': fields.text('Additional Information'),
'state': fields.selection([
('draft','Draft'),

View File

@ -24,100 +24,84 @@ from osv import fields,osv
class account_entries_report(osv.osv):
_name = "account.entries.report"
_description = "Entries"
_description = "Journal Items Analysis"
_auto = False
_rec_name = 'date'
_columns = {
'date': fields.date('Effective Date', readonly=True),
'date_created': fields.date('Date Created', readonly=True),
'date_maturity': fields.date('Date Maturity', readonly=True),
'nbr':fields.integer('# of Entries', readonly=True),
'nbl':fields.integer('# of Lines', readonly=True),
'amount': fields.float('Amount', readonly=True),
'ref': fields.char('Reference', size=64, readonly=True),
'nbr':fields.integer('# of Items', readonly=True),
'debit':fields.float('Debit', readonly=True),
'credit':fields.float('Credit', readonly=True),
'balance': fields.float('Balance', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'date': fields.date('Date', size=128, readonly=True),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True),
'ref': fields.char('Reference', size=64, readonly=True),
'period_id': fields.many2one('account.period', 'Period', readonly=True),
'account_id': fields.many2one('account.account', 'Account', readonly=True),
'journal_id': fields.many2one('account.journal', 'Journal', readonly=True),
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', readonly=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True),
'state': fields.selection([('draft','Draft'), ('posted','Posted')], 'State', readonly=True,
help='When new account move is created the state will be \'Draft\'. When all the payments are done it will be in \'Posted\' state.'),
'state_2': fields.selection([('draft','Draft'), ('valid','Valid')], 'State of Move Line', readonly=True,
help='When new move line is created the state will be \'Draft\'.\n* When all the payments are done it will be in \'Valid\' state.'),
'partner_id': fields.many2one('res.partner','Partner', readonly=True),
'period_id2': fields.many2one('account.period', 'Move Line Period', readonly=True),
'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
'journal_id2': fields.many2one('account.journal', 'Move Line Journal', readonly=True),
'type': fields.selection([
('pay_voucher','Cash Payment'),
('bank_pay_voucher','Bank Payment'),
('rec_voucher','Cash Receipt'),
('bank_rec_voucher','Bank Receipt'),
('cont_voucher','Contra'),
('journal_sale_vou','Journal Sale'),
('journal_pur_voucher','Journal Purchase'),
('journal_voucher','Journal Voucher'),
],'Type',readonly=True),
'quantity': fields.float('Products Quantity', digits=(16,2), readonly=True),
'user_type': fields.many2one('account.account.type', 'Account Type', readonly=True),
'type': fields.selection([
('receivable', 'Receivable'),
('payable', 'Payable'),
('view', 'View'),
('consolidation', 'Consolidation'),
('other', 'Others'),
('closed', 'Closed'),
], 'Internal Type', readonly=True, help="This type is used to differentiate types with "\
"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."),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
}
_order = 'date desc'
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_entries_report')
cr.execute("""
create or replace view account_entries_report as (
select
min(l.id) as id,
am.ref as ref,
sum(l.quantity) as quantity,
am.state as state,
l.state as state_2,
am.date as date,
count(l.id) as nbr,
count(distinct am.id) as nbl,
l.debit as amount,
to_char(am.date, 'YYYY') as year,
to_char(am.date, 'MM') as month,
to_char(am.date, 'YYYY-MM-DD') as day,
am.company_id as company_id,
l.account_id as account_id,
l.analytic_account_id as analytic_account_id,
l.date_created as date_created,
l.date_maturity as date_maturity,
am.journal_id as journal_id,
l.journal_id as journal_id2,
l.period_id as period_id2,
am.period_id as period_id,
l.partner_id as partner_id,
l.product_id as product_id,
am.type as type
from
account_move_line l
left join
account_move am on (am.id=l.move_id)
group by am.ref,
am.state,
am.date,
am.company_id,
am.journal_id,
l.journal_id,
am.period_id,
l.period_id,
am.type,
l.partner_id,
l.analytic_account_id,
l.product_id,
l.date_created,
l.date_maturity,
l.account_id,
l.state,
l.debit
select
l.id as id,
am.date as date,
l.date_maturity as date_maturity,
l.date_created as date_created,
am.ref as ref,
am.state as state,
l.state as state_2,
to_char(am.date, 'YYYY') as year,
to_char(am.date, 'MM') as month,
l.partner_id as partner_id,
l.product_id as product_id,
am.company_id as company_id,
am.journal_id as journal_id,
p.fiscalyear_id as fiscalyear_id,
am.period_id as period_id,
l.account_id as account_id,
l.analytic_account_id as analytic_account_id,
a.type as type,
a.user_type as user_type,
1 as nbr,
l.quantity as quantity,
l.debit as debit,
l.credit as credit,
l.debit-l.credit as balance
from
account_move_line l
left join account_account a on (l.account_id = a.id)
left join account_move am on (am.id=l.move_id)
left join account_period p on (am.period_id=p.id)
)
""")
account_entries_report()

View File

@ -29,15 +29,15 @@ class account_automatic_reconcile(osv.osv_memory):
_description = 'Automatic Reconcile'
_columns = {
'account_ids': fields.many2many('account.account', 'reconcile_account_rel', 'reconcile_id', 'account_id', 'Account to reconcile', domain = [('reconcile','=',1)], \
'account_ids': fields.many2many('account.account', 'reconcile_account_rel', 'reconcile_id', 'account_id', 'Accounts to Reconcile', domain = [('reconcile','=',1)], \
help = 'If no account is specified, the reconciliation will be made using every accounts that can be reconcilied'),
'writeoff_acc_id': fields.many2one('account.account', 'Account'),
'journal_id': fields.many2one('account.journal', 'Journal'),
'period_id': fields.many2one('account.period', 'Period'),
'max_amount': fields.float('Maximum write-off amount'),
'power': fields.selection([(p, str(p)) for p in range(2, 10)], 'Power', required=True, help='Number of partial amounts that can be combined to find a balance point can be chosen as the power of the automatic reconciliation'),
'date1': fields.date('Start of period', required=True),
'date2': fields.date('End of period', required=True),
'date1': fields.date('Starting Date', required=True),
'date2': fields.date('Ending Date', required=True),
'reconciled': fields.integer('Reconciled transactions', readonly=True),
'unreconciled': fields.integer('Not reconciled transactions', readonly=True),
'allow_write_off': fields.boolean('Allow write off')
@ -54,6 +54,7 @@ class account_automatic_reconcile(osv.osv_memory):
'date2': time.strftime('%Y-%m-%d'),
'reconciled': _get_reconciled,
'unreconciled': _get_unreconciled,
'power':2
}
#TODO: cleanup and comment this code... For now, it is awfulllll
@ -246,4 +247,4 @@ class account_automatic_reconcile(osv.osv_memory):
account_automatic_reconcile()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -7,33 +7,33 @@
<field name="model">account.automatic.reconcile</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Reconciliation">
<group width="660" height="430">
<separator string="Options" colspan="4"/>
<group>
<field name="account_ids" colspan="4" domain="[('reconcile','=',1)]"/>
<field name="date1"/>
<field name="date2"/>
<field name="power"/>
<field name="allow_write_off"/>
</group>
<newline/>
<group attrs="{'readonly':[('allow_write_off', '!=', True)]}">
<separator string="Write-Off Move" colspan="4"/>
<field name="max_amount"/>
<field name="writeoff_acc_id" attrs="{ 'required':[('allow_write_off', '=', True)]}"/>
<field name="journal_id" attrs="{ 'required':[('allow_write_off', '=', True)]}"/>
<field name="period_id" attrs="{ 'required':[('allow_write_off', '=', True)]}"/>
</group>
<separator string ="" colspan="4"/>
<group colspan="2" col="4">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="reconcile" string="Reconcile" type="object" icon="terp-stock_effects-object-colorize"/>
</group>
</group>
</form>
<form string="Reconciliation">
<group width="660" height="430">
<separator string="Options" colspan="4"/>
<group>
<field name="account_ids" colspan="4" domain="[('reconcile','=',1)]"/>
<field name="date1"/>
<field name="date2"/>
<field name="power"/>
<field name="allow_write_off"/>
</group>
<newline/>
<group attrs="{'readonly':[('allow_write_off', '!=', True)]}">
<separator string="Write-Off Move" colspan="4"/>
<field name="max_amount"/>
<field name="writeoff_acc_id" attrs="{ 'required':[('allow_write_off', '=', True)]}"/>
<field name="journal_id" attrs="{ 'required':[('allow_write_off', '=', True)]}"/>
<field name="period_id" attrs="{ 'required':[('allow_write_off', '=', True)]}"/>
</group>
<separator string ="" colspan="4"/>
<group colspan="2" col="4">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="reconcile" string="Reconcile" type="object" icon="terp-stock_effects-object-colorize"/>
</group>
</group>
</form>
</field>
</record>
</record>
<record id="action_account_automatic_reconcile" model="ir.actions.act_window">
<field name="name">Account Automatic Reconcile</field>
@ -47,29 +47,29 @@
<field name="help">For an invoice to be considered as paid, the invoice entries must be reconciled with counterparts, usually payments. With the automatic reconciliation functionality, OpenERP make its own search for entries to reconcile in a series of accounts. It tries to find entries for each partner where the amounts correspond.</field>
</record>
<menuitem
icon="STOCK_EXECUTE"
name="Automatic Reconciliation"
action="action_account_automatic_reconcile"
id="menu_automatic_reconcile"
parent="periodical_processing_reconciliation"/>
<menuitem
icon="STOCK_EXECUTE"
name="Automatic Reconciliation"
action="action_account_automatic_reconcile"
id="menu_automatic_reconcile"
parent="periodical_processing_reconciliation"/>
<record id="account_automatic_reconcile_view1" model="ir.ui.view">
<field name="name">Automatic reconcile unreconcile</field>
<field name="model">account.automatic.reconcile</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Reconciliation result">
<field name="reconciled"/>
<newline/>
<field name="unreconciled"/>
<group colspan="4" col="6">
<separator colspan="6"/>
<button special="cancel" string="Ok" icon="terp-dialog-close" default_focus="1"/>
</group>
</form>
<form string="Reconciliation result">
<field name="reconciled"/>
<newline/>
<field name="unreconciled"/>
<group colspan="4" col="6">
<separator colspan="6"/>
<button special="cancel" string="Ok" icon="terp-dialog-close" default_focus="1"/>
</group>
</form>
</field>
</record>
</record>
</data>
</data>
</openerp>

View File

@ -25,15 +25,15 @@
<field name="target">new</field>
</record>
<record model="ir.values" id="action_account_invoice_confirm_values">
<field name="model_id" ref="account.model_account_invoice" />
<field name="object" eval="1" />
<field name="name">Confirm Draft Invoices</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_confirm'))" />
<field name="key">action</field>
<field name="model">account.invoice</field>
</record>
<!-- <record model="ir.values" id="action_account_invoice_confirm_values">-->
<!-- <field name="model_id" ref="account.model_account_invoice" />-->
<!-- <field name="object" eval="1" />-->
<!-- <field name="name">Confirm Draft Invoices</field>-->
<!-- <field name="key2">client_action_multi</field>-->
<!-- <field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_confirm'))" />-->
<!-- <field name="key">action</field>-->
<!-- <field name="model">account.invoice</field>-->
<!-- </record>-->
<record id="account_invoice_cancel_view" model="ir.ui.view">
<field name="name">account.invoice.cancel.form</field>
@ -59,15 +59,15 @@
<field name="target">new</field>
</record>
<record model="ir.values" id="action_account_invoice_cancel_values">
<field name="model_id" ref="account.model_account_invoice" />
<field name="object" eval="1" />
<field name="name">Cancel Selected Invoices</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_cancel'))" />
<field name="key">action</field>
<field name="model">account.invoice</field>
</record>
<!-- <record model="ir.values" id="action_account_invoice_cancel_values">-->
<!-- <field name="model_id" ref="account.model_account_invoice" />-->
<!-- <field name="object" eval="1" />-->
<!-- <field name="name">Cancel Selected Invoices</field>-->
<!-- <field name="key2">client_action_multi</field>-->
<!-- <field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_cancel'))" />-->
<!-- <field name="key">action</field>-->
<!-- <field name="model">account.invoice</field>-->
<!-- </record>-->
</data>
</openerp>

View File

@ -139,12 +139,24 @@
</field>
</record>
<record id="account_cash_statement_graph" model="ir.ui.view">
<field name="name">account.voucher.graph</field>
<field name="model">account.voucher</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Voucher Statistics" type="bar">
<field name="date"/>
<field name="amount" operator="+"/>
</graph>
</field>
</record>
<!-- Receipt Vouchers -->
<record model="ir.actions.act_window" id="action_receipt_vou_voucher_list">
<field name="name">Receivable Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('journal_id.type','=','sale')]</field>
<field name="context">{'type':'sale'}</field>
@ -158,7 +170,7 @@
<field name="name">Payable Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('journal_id.type','=','purchase')]</field>
<field name="context">{'type':'purchase'}</field>
@ -172,7 +184,7 @@
<field name="name">Journal Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="context">{'type':'general'}</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="search_view_id" ref="view_voucher_filter"/>

View File

@ -1540,7 +1540,7 @@ Object encoded
<field name="model">report.unclassified.objects</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="blue:state in ('draft','unsold');black:state in ('sold');gray:state in ('paid')"string="Unclassified objects">
<tree colors="blue:state in ('draft','unsold');black:state in ('sold');gray:state in ('paid')" string="Unclassified objects">
<field name="obj_num" string="Ref" select="1"/>
<field name="name" select="1"/>
<field name="ach_login"/>

View File

@ -58,7 +58,7 @@
<field name="usage">menu</field>
<field name="view_id" ref="board_auction_manager_form"/>
</record>
<menuitem icon="terp-graph" name="Dashboard" id="menu_board_auction" parent="auction_report_menu" sequence="0"/>
<menuitem name="Dashboard" id="menu_board_auction" parent="auction_report_menu" sequence="0"/>
<menuitem
name="Auction Member"
action="open_board_auction"

View File

@ -43,7 +43,9 @@
'init_xml': ['base_setup_data.xml'],
'update_xml': ['security/ir.model.access.csv',
'base_setup_installer.xml',
'base_setup_todo.xml','gtk_contact_form.xml'],
'base_setup_todo.xml',
# 'gtk_contact_form.xml'
],
'demo_xml': ['base_setup_demo.xml'],
'installable': True,
'active': True,

View File

@ -88,7 +88,7 @@ class base_setup_company(osv.osv_memory):
'city':fields.char('City', size=128),
'state_id':fields.selection(_get_all_states, 'State'),
'country_id':fields.selection(_get_all_countries, 'Country'),
'email':fields.char('E-mail', size=64, required=True),
'email':fields.char('E-mail', size=64),
'phone':fields.char('Phone', size=64),
'currency':fields.many2one('res.currency', 'Currency', required=True),
'rml_header1':fields.char('Report Header', size=200,

View File

@ -3,7 +3,7 @@
<data>
<menuitem icon="terp-graph" id="base.reporting_menu"
name="Reporting" sequence="30" />
<menuitem icon="terp-graph" id="menu_dasboard"
<menuitem id="menu_dasboard"
name="Dashboard" sequence="30" />
<!--Board Note Search View -->
<record id="view_board_note_search" model="ir.ui.view">

View File

@ -112,7 +112,7 @@
<field name="view_id" ref="board_crm_statistical_form"/>
</record>
<menuitem icon="terp-graph" id="board.menu_dasboard" name="Dashboard" sequence="0" parent="base.next_id_64"/>
<menuitem id="board.menu_dasboard" name="Dashboard" sequence="0" parent="base.next_id_64"/>
<menuitem
name="Statistics Dashboard" parent="board.menu_dasboard"

View File

@ -152,7 +152,7 @@
<field name="usage">menu</field>
<field name="view_id" ref="board_crm_form"/>
</record>
<menuitem icon="terp-graph" id="board.menu_dasboard" name="Dashboard" sequence="0" parent="base.next_id_64"/>
<menuitem id="board.menu_dasboard" name="Dashboard" sequence="0" parent="base.next_id_64"/>
<menuitem
name="Connecting Dashboard" parent="board.menu_dasboard"
action="open_board_crm"

View File

@ -41,7 +41,7 @@
<group colspan="2" col="2">
<separator string="Plugins" colspan="4" />
<field name="thunderbird" />
<label string="*Outlook*" />
<!-- <label string="*Outlook*" />-->
<!-- TODO <field name="outlook" />-->
</group>
</group>

View File

@ -233,7 +233,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
"Partner: %s" % (lead.partner_id and lead.partner_id.name_get()[0][1]),
"Contact: %s" % (pa.name or ''),
"Title: %s" % (pa.title or ''),
"Function: %s" % (pa.function and pa.function.name_get()[0][1] or ''),
"Function: %s" % (pa.function or ''),
"Street: %s" % (pa.street or ''),
"Street2: %s" % (pa.street2 or ''),
"Zip: %s" % (pa.zip or ''),
@ -244,6 +244,8 @@ class crm_lead_forward_to_partner(osv.osv_memory):
"Phone: %s" % (pa.phone or ''),
"Fax: %s" % (pa.fax or ''),
"Mobile: %s" % (pa.mobile or ''),
"Lead Category: %s" % (lead.categ_id and lead.categ_id.name or ''),
"Details: %s" % (lead.description or ''),
]
return "\n".join(body + ['---'])

View File

@ -56,7 +56,6 @@
id="menu_reports_document"
parent="menu_reporting"
sequence="0"
icon="terp-graph"
groups="document.group_document_manager"/>

View File

@ -84,7 +84,7 @@
<field name="view_mode">form</field>
<field name="view_id" ref="board_associations_manager_form"/>
</record>
<menuitem id="board_associations" icon="terp-graph" name="Dashboard" parent="base.menu_report_association" sequence="0"/>
<menuitem id="board_associations" name="Dashboard" parent="base.menu_report_association" sequence="0"/>
<menuitem
name="Associations" parent="board_associations"
action="open_board_associations_manager"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
<menuitem id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
<menuitem
id="menu_hr_deshboard"
name="Human Resources"
@ -33,7 +33,7 @@
<field name="view_id" ref="board_hr_form"/>
</record>
<menuitem id="menu_hr_reporting" name="Reporting" parent="hr.menu_hr_root" sequence="10"/>
<menuitem icon="terp-graph" id="menu_hr_dasboard" name="Dashboard" parent="menu_hr_reporting" sequence="0"/>
<menuitem id="menu_hr_dasboard" name="Dashboard" parent="menu_hr_reporting" sequence="0"/>
<menuitem
action="open_board_hr"
icon="terp-graph"

View File

@ -34,6 +34,8 @@ class hr_employee_category(osv.osv):
}
def _check_recursion(self, cr, uid, ids, context=None):
if context is None:
context = {}
level = 100
while len(ids):
cr.execute('select distinct parent_id from hr_employee_category where id IN %s', (tuple(ids), ))
@ -62,6 +64,8 @@ hr_employee_marital_status()
class hr_job(osv.osv):
def _no_of_employee(self, cr, uid, ids, name, args, context=None):
if context is None:
context = {}
res = {}
for emp in self.browse(cr, uid, ids):
res[emp.id] = len(emp.employee_ids or [])
@ -133,6 +137,8 @@ class hr_employee(osv.osv):
}
def _get_photo(self, cr, uid, context=None):
if context is None:
context = {}
return open(os.path.join(
tools.config['addons_path'], 'hr/image', 'photo.png'),
'rb') .read().encode('base64')

View File

@ -29,7 +29,7 @@ class hr_department(osv.osv):
context = {}
if not len(ids):
return []
reads = self.read(cr, uid, ids, ['name','parent_id'], context)
reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
res = []
for record in reads:
name = record['name']
@ -39,6 +39,8 @@ class hr_department(osv.osv):
return res
def _dept_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
if context is None:
context = {}
res = self.name_get(cr, uid, ids, context=context)
return dict(res)
@ -59,7 +61,9 @@ class hr_department(osv.osv):
}
def _get_members(self,cr, uid, context=None):
mids = self.search(cr, uid, [('manager_id', '=', uid)])
if context is None:
context = {}
mids = self.search(cr, uid, [('manager_id', '=', uid)], context=context)
result = {uid: 1}
for m in self.browse(cr, uid, mids, context=context):
for user in m.member_ids:
@ -67,6 +71,8 @@ class hr_department(osv.osv):
return result.keys()
def _check_recursion(self, cr, uid, ids, context=None):
if context is None:
context = {}
level = 100
while len(ids):
cr.execute('select distinct parent_id from hr_department where id IN %s',(tuple(ids),))
@ -89,6 +95,7 @@ class ir_action_window(osv.osv):
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
if context is None:
context = {}
obj_dept = self.pool.get('hr.department')
select = ids
if isinstance(ids, (int, long)):
select = [ids]
@ -96,7 +103,7 @@ class ir_action_window(osv.osv):
for r in res:
mystring = 'department_users_get()'
if mystring in (r.get('domain', '[]') or ''):
r['domain'] = r['domain'].replace(mystring, str(self.pool.get('hr.department')._get_members(cr, uid)))
r['domain'] = r['domain'].replace(mystring, str(obj_dept._get_members(cr, uid)))
if isinstance(ids, (int, long)):
if res:
return res[0]
@ -111,18 +118,22 @@ class res_users(osv.osv):
_description = 'User'
def _parent_compute(self, cr, uid, ids, name, args, context=None):
if context is None:
context = {}
result = {}
obj_dept = self.pool.get('hr.department')
for user_id in ids:
ids_dept = obj_dept.search(cr, uid, [('member_ids', 'in', [user_id])])
ids_dept = obj_dept.search(cr, uid, [('member_ids', 'in', [user_id])], context=context)
parent_ids = []
if ids_dept:
data_dept = obj_dept.read(cr, uid, ids_dept, ['manager_id'])
data_dept = obj_dept.read(cr, uid, ids_dept, ['manager_id'], context=context)
parent_ids = map(lambda x: x['manager_id'][0], data_dept)
result[user_id] = parent_ids
return result
def _parent_search(self, cr, uid, obj, name, args, context=None):
if context is None:
context = {}
parent = []
for arg in args:
if arg[0] == 'parent_id':
@ -133,20 +144,20 @@ class res_users(osv.osv):
return [('id', 'in', child_ids.get(uid,[]))]
def _child_compute(self, cr, uid, ids, name, args, context=None):
if context is None:
context = {}
obj_dept = self.pool.get('hr.department')
obj_user = self.pool.get('res.users')
result = {}
if context is None:
context = {}
for manager_id in ids:
child_ids = []
mgnt_dept_ids = obj_dept.search(cr, uid, [('manager_id', '=', manager_id)])
ids_dept = obj_dept.search(cr, uid, [('id', 'child_of', mgnt_dept_ids)])
mgnt_dept_ids = obj_dept.search(cr, uid, [('manager_id', '=', manager_id)], context=context)
ids_dept = obj_dept.search(cr, uid, [('id', 'child_of', mgnt_dept_ids)], context=context)
if ids_dept:
data_dept = obj_dept.read(cr, uid, ids_dept, ['member_ids'])
data_dept = obj_dept.read(cr, uid, ids_dept, ['member_ids'], context=context)
childs = map(lambda x: x['member_ids'], data_dept)
childs = tools.flatten(childs)
childs = obj_user.search(cr, uid, [('id', 'in', childs),('active', '=', True)])
childs = obj_user.search(cr, uid, [('id', 'in', childs),('active', '=', True)], context=context)
if manager_id in childs:
childs.remove(manager_id)
child_ids.extend(tools.flatten(childs))
@ -159,6 +170,8 @@ class res_users(osv.osv):
return result
def _child_search(self, cr, uid, obj, name, args, context=None):
if context is None:
context = {}
parent = []
for arg in args:
if arg[0] == 'child_ids':

View File

@ -46,9 +46,9 @@ class hr_installer(osv.osv_memory):
"performance review of employees."),
'hr_attendance': fields.boolean('Attendances (Sign In/Out)',
help="Simplifies the management of employee attendances."),
'hr_payroll': fields.boolean('Payroll' ,
'hr_payroll': fields.boolean('Payroll',
help="Generic Payroll system"),
'hr_payroll_account': fields.boolean('Payroll with Accounting',
'hr_payroll_account': fields.boolean('Payroll',
help="Generic Payroll system Integrated with Accountings."),
}
_defaults = {

View File

@ -37,7 +37,9 @@ class hr_action_reason(osv.osv):
hr_action_reason()
def _employee_get(obj, cr, uid, context=None):
ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)])
if context is None:
context = {}
ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
if ids:
return ids[0]
return False
@ -47,6 +49,8 @@ class hr_attendance(osv.osv):
_description = "Attendance"
def _day_compute(self, cr, uid, ids, fieldnames, args, context=None):
if context is None:
context = {}
res = dict.fromkeys(ids, '')
for obj in self.browse(cr, uid, ids, context=context):
res[obj.id] = time.strftime('%Y-%m-%d', time.strptime(obj.name, '%Y-%m-%d %H:%M:%S'))
@ -89,6 +93,8 @@ class hr_employee(osv.osv):
_description = "Employee"
def _state(self, cr, uid, ids, name, args, context=None):
if context is None:
context = {}
result = {}
for id in ids:
result[id] = 'absent'
@ -112,11 +118,16 @@ class hr_employee(osv.osv):
}
def _action_check(self, cr, uid, emp_id, dt=False, context=None):
if context is None:
context = {}
cr.execute('select max(name) from hr_attendance where employee_id=%s', (emp_id,))
res = cr.fetchone()
return not (res and (res[0]>=(dt or time.strftime('%Y-%m-%d %H:%M:%S'))))
def attendance_action_change(self, cr, uid, ids, type='action', context=None, dt=False, *args):
obj_attendance = self.pool.get('hr.attendance')
if context is None:
context = {}
id = False
warning_sign = 'sign'
res = {}
@ -136,7 +147,7 @@ class hr_employee(osv.osv):
if dt:
res['name'] = dt
id = self.pool.get('hr.attendance').create(cr, uid, res, context=context)
id = obj_attendance.create(cr, uid, res, context=context)
if type != 'action':
return id

View File

@ -35,6 +35,8 @@ class hr_attendance_byweek(osv.osv_memory):
}
def print_report(self, cr, uid, ids, context=None):
if context is None:
context = {}
datas = {
'ids': [],
'model': 'hr.employee',

View File

@ -42,14 +42,14 @@ class hr_attendance_error(osv.osv_memory):
if context is None:
context = {}
emp_ids = []
data_error = self.read(cr, uid, ids)[0]
data_error = self.read(cr, uid, ids, context=context)[0]
date_from = data_error['init_date']
date_to = data_error['end_date']
cr.execute("select id from hr_attendance where employee_id IN %s and to_char(name,'YYYY-mm-dd')<=%s and to_char(name,'YYYY-mm-dd')>=%s and action IN %s order by name" ,(tuple(context['active_ids']), date_to, date_from, tuple(['sign_in','sign_out'])))
attendance_ids = [x[0] for x in cr.fetchall()]
if not attendance_ids:
raise osv.except_osv(_('No Data Available'), _('No records found for your selection!'))
attendance_records = self.pool.get('hr.attendance').browse(cr, uid, attendance_ids)
attendance_records = self.pool.get('hr.attendance').browse(cr, uid, attendance_ids, context=context)
for rec in attendance_records:
if rec.employee_id.id not in emp_ids:

View File

@ -53,11 +53,15 @@ class hr_si_so_ask(osv.osv_memory):
}
def sign_in(self, cr, uid, ids, context=None):
data = self.read(cr, uid, ids, [])[0]
if context is None:
context = {}
data = self.read(cr, uid, ids, [], context=context)[0]
return self.pool.get('hr.sign.in.out').sign_in(cr, uid, data, context)
def sign_out(self, cr, uid, ids, context=None):
data = self.read(cr, uid, ids, [])[0]
if context is None:
context = {}
data = self.read(cr, uid, ids, [], context=context)[0]
return self.pool.get('hr.sign.in.out').sign_out(cr, uid, data, context)
hr_si_so_ask()
@ -74,6 +78,8 @@ class hr_sign_in_out(osv.osv_memory):
}
def _get_empid(self, cr, uid, context=None):
if context is None:
context = {}
emp_id = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
if emp_id:
employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0]
@ -81,6 +87,8 @@ class hr_sign_in_out(osv.osv_memory):
return {}
def default_get(self, cr, uid, fields_list, context=None):
if context is None:
context = {}
res = super(hr_sign_in_out, self).default_get(cr, uid, fields_list, context=context)
res_emp = self._get_empid(cr, uid, context=context)
res.update(res_emp)
@ -89,10 +97,12 @@ class hr_sign_in_out(osv.osv_memory):
def si_check(self, cr, uid, ids, context=None):
obj_model = self.pool.get('ir.model.data')
att_obj = self.pool.get('hr.attendance')
data = self.read(cr, uid, ids, [])[0]
if context is None:
context = {}
data = self.read(cr, uid, ids, [], context=context)[0]
emp_id = data['emp_id']
att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id)], limit=1, order='name desc')
last_att = att_obj.browse(cr, uid, att_id)
last_att = att_obj.browse(cr, uid, att_id, context=context)
if last_att:
last_att = last_att[0]
cond = not last_att or last_att.action == 'sign_out'
@ -113,8 +123,10 @@ class hr_sign_in_out(osv.osv_memory):
def so_check(self, cr, uid, ids, context=None):
obj_model = self.pool.get('ir.model.data')
data = self.read(cr, uid, ids, [])[0]
att_obj = self.pool.get('hr.attendance')
if context is None:
context = {}
data = self.read(cr, uid, ids, [], context=context)[0]
emp_id = data['emp_id']
att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id),('action', '!=', 'action')], limit=1, order='name desc')
last_att = att_obj.browse(cr, uid, att_id, context=context)
@ -137,8 +149,8 @@ class hr_sign_in_out(osv.osv_memory):
if cond:
return self.sign_out(cr, uid, data, context)
else:
model_data_ids = self.pool.get('ir.model.data').search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_hr_attendance_si_ask')], context=context)
resource_id = self.pool.get('ir.model.data').read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
model_data_ids = att_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_hr_attendance_si_ask')], context=context)
resource_id = att_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
return {
'name': _('Sign in / Sign out'),
'view_type': 'form',
@ -150,12 +162,14 @@ class hr_sign_in_out(osv.osv_memory):
}
def sign_in(self, cr, uid, data, context=None):
if context is None:
context = {}
emp_id = data['emp_id']
if 'last_time' in data:
if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'):
raise osv.except_osv(_('UserError'), _('The sign-out date must be in the past'))
self.pool.get('hr.attendance').create(cr, uid, {'name': data['last_time'], 'action': 'sign_out',
'employee_id': emp_id})
'employee_id': emp_id}, context=context)
try:
success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in')
except:
@ -163,11 +177,13 @@ class hr_sign_in_out(osv.osv_memory):
return {} # To do: Return Success message
def sign_out(self, cr, uid, data, context=None):
if context is None:
context = {}
emp_id = data['emp_id']
if 'last_time' in data:
if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'):
raise osv.except_osv(_('UserError'), _('The Sign-in date must be in the past'))
self.pool.get('hr.attendance').create(cr, uid, {'name':data['last_time'], 'action':'sign_in', 'employee_id':emp_id})
self.pool.get('hr.attendance').create(cr, uid, {'name':data['last_time'], 'action':'sign_in', 'employee_id':emp_id}, context=context)
try:
success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_out')
except:

View File

@ -8,13 +8,14 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-11-25 12:18+0000\n"
"PO-Revision-Date: 2010-06-29 22:34+0000\n"
"Last-Translator: Borja López Soilán (Pexego) <borjals@pexego.es>\n"
"PO-Revision-Date: 2010-07-23 19:03+0000\n"
"Last-Translator: Jordi Esteve (www.zikzakmedia.com) "
"<jesteve@zikzakmedia.com>\n"
"Language-Team: Spanish <es@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-07-01 03:45+0000\n"
"X-Launchpad-Export-Date: 2010-07-24 03:58+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: hr_evaluation
@ -84,7 +85,7 @@ msgstr "Datos informales"
#. module: hr_evaluation
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
msgstr "Nombre de modelo inválido en la definición de acción."
msgstr "Nombre de modelo no válido en la definición de la acción."
#. module: hr_evaluation
#: field:hr_evaluation.evaluation,employee_id:0

View File

@ -36,6 +36,7 @@ system to store and search in your CV base.
'depends': ['hr','survey','crm'],
'update_xml': [
'wizard/hr_recruitment_phonecall_view.xml',
'wizard/hr_recruitment_create_partner_job_view.xml',
'hr_recruitment_view.xml',
'hr_recruitment_menu.xml',
# 'report_hr_recruitment_view.xml',
@ -43,7 +44,6 @@ system to store and search in your CV base.
'security/ir.model.access.csv',
'board_hr_recruitment_statistical_view.xml',
'report/hr_recruitment_report_view.xml',
'wizard/hr_recruitment_create_partner_job_view.xml',
],
'init_xml': [
'hr_recruitment_data.xml'

View File

@ -59,6 +59,19 @@ class hr_recruitment_stage(osv.osv):
}
hr_recruitment_stage()
class hr_recruitment_degree(osv.osv):
""" Degree of HR Recruitment """
_name = "hr.recruitment.degree"
_description = "Degree of Recruitment"
_columns = {
'name': fields.char('Name', size=64, required=True, translate=True),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of degrees."),
}
_defaults = {
'sequence': 1,
}
hr_recruitment_degree()
class hr_applicant(osv.osv, crm.crm_case):
_name = "hr.applicant"
_description = "Applicant"
@ -88,6 +101,8 @@ class hr_applicant(osv.osv, crm.crm_case):
# Applicant Columns
'date_closed': fields.datetime('Closed', readonly=True),
'date': fields.datetime('Date'),
'date_action': fields.date('Next Action Date'),
'title_action': fields.char('Next Action', size=64),
'priority': fields.selection(AVAILABLE_PRIORITIES, 'Appreciation'),
'job_id': fields.many2one('hr.job', 'Applied Job'),
'salary_proposed': fields.float('Proposed Salary', help="Salary Proposed by the Organisation"),
@ -96,7 +111,7 @@ class hr_applicant(osv.osv, crm.crm_case):
'partner_name': fields.char("Applicant's Name", size=64),
'partner_phone': fields.char('Phone', size=32),
'partner_mobile': fields.char('Mobile', size=32),
'type_id': fields.many2one('crm.case.resource.type', 'Degree', domain="[('object_id.model', '=', 'hr.applicant')]"),
'type_id': fields.many2one('hr.recruitment.degree', 'Degree'),
'department_id':fields.many2one('hr.department', 'Department'),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
'survey' : fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
@ -237,7 +252,7 @@ class hr_applicant(osv.osv, crm.crm_case):
def message_new(self, cr, uid, msg, context):
"""
Automatically calls when new email message arrives
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks
@ -249,7 +264,7 @@ class hr_applicant(osv.osv, crm.crm_case):
body = msg.get('body')
msg_from = msg.get('from')
priority = msg.get('priority')
vals = {
'name': subject,
'email_from': msg_from,
@ -259,15 +274,15 @@ class hr_applicant(osv.osv, crm.crm_case):
}
if msg.get('priority', False):
vals['priority'] = priority
res = mailgate_pool.get_partner(cr, uid, msg.get('from'))
if res:
vals.update(res)
res = self.create(cr, uid, vals, context)
message = _('A Job Request created') + " '" + subject + "' " + _("from Mailgate.")
self.log(cr, uid, res, message)
attachents = msg.get('attachments', [])
for attactment in attachents or []:
data_attach = {
@ -283,16 +298,16 @@ class hr_applicant(osv.osv, crm.crm_case):
return res
def message_update(self, cr, uid, ids, vals={}, msg="", default_act='pending', context={}):
"""
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of update mails IDs
@param ids: List of update mails IDs
"""
if isinstance(ids, (str, int, long)):
ids = [ids]
msg_from = msg['from']
vals.update({
'description': msg['body']
@ -312,7 +327,7 @@ class hr_applicant(osv.osv, crm.crm_case):
if res and maps.get(res.group(1).lower(), False):
key = maps.get(res.group(1).lower())
vls[key] = res.group(2).lower()
vals.update(vls)
res = self.write(cr, uid, ids, vals)
return res
@ -328,7 +343,7 @@ class hr_applicant(osv.osv, crm.crm_case):
@param **args: Return Dictionary of Keyword Value
"""
return True
def case_open(self, cr, uid, ids, *args):
"""
@param self: The object pointer

View File

@ -17,17 +17,17 @@
<!-- Resource(type_id) -->
<record model="crm.case.resource.type" id="type_job1">
<record model="hr.recruitment.degree" id="degree_graduate">
<field name="name">Graduate</field>
<field name="object_id" search="[('model','=','hr.applicant')]" model="ir.model"/>
<field name="sequence">1</field>
</record>
<record model="crm.case.resource.type" id="type_job2">
<record model="hr.recruitment.degree" id="degree_licenced">
<field name="name">Licenced</field>
<field name="object_id" search="[('model','=','hr.applicant')]" model="ir.model"/>
<field name="sequence">2</field>
</record>
<record model="crm.case.resource.type" id="type_job3">
<record model="hr.recruitment.degree" id="degree_bac5">
<field name="name"> > Bac +5</field>
<field name="object_id" search="[('model','=','hr.applicant')]" model="ir.model"/>
<field name="sequence">3</field>
</record>
<record model="hr.recruitment.stage" id="stage_job1">

View File

@ -9,7 +9,7 @@
<record id="hr_case_salesman0" model="hr.applicant">
<field eval="time.strftime('%Y-%m-01 10:35:50')" name="date"/>
<field eval="time.strftime('%Y-%m-03')" name="date_deadline"/>
<field name="type_id" ref="type_job1"/>
<field name="type_id" ref="degree_graduate"/>
<field name="partner_id" ref="base.res_partner_asus"/>
<field eval="'2'" name="priority"/>
<field name="user_id" ref="base.user_root"/>
@ -29,7 +29,7 @@
<field name="partner_address_id" ref="base.res_partner_address_14"/>
<field name="som" ref="base.som_fury"/>
<field eval="time.strftime('%Y-%m-10 18:15:00')" name="date"/>
<field name="type_id" ref="type_job3"/>
<field name="type_id" ref="degree_bac5"/>
<field name="partner_id" ref="base.res_partner_15"/>
<field eval="'3'" name="priority"/>
<field name="user_id" ref="base.user_root"/>
@ -50,7 +50,7 @@
<field name="som" ref="base.som_happy"/>
<field eval="time.strftime('%Y-%m-15 16:10:00')" name="date"/>
<field eval="time.strftime('%Y-%m-18')" name="date_deadline"/>
<field name="type_id" ref="type_job2"/>
<field name="type_id" ref="degree_licenced"/>
<field name="partner_id" ref="base.res_partner_5"/>
<field eval="'1'" name="priority"/>
<field name="user_id" ref="base.user_root"/>
@ -68,7 +68,7 @@
<field eval="time.strftime('%Y-%m-25 16:25:52')" name="date"/>
<field eval="time.strftime('%Y-%m-28')" name="date_deadline"/>
<field name="categ_id" ref="categ_job2"/>
<field name="type_id" ref="type_job3"/>
<field name="type_id" ref="degree_bac5"/>
<field name="partner_id" ref="base.res_partner_10"/>
<field eval="'3'" name="priority"/>
<field name="user_id" ref="base.user_root"/>
@ -83,7 +83,7 @@
<record id="hr_case_marketingjob0" model="hr.applicant">
<field eval="time.strftime('%Y-%m-26 17:15:32')" name="date"/>
<field eval="time.strftime('%Y-%m-28')" name="date_deadline"/>
<field name="type_id" ref="type_job2"/>
<field name="type_id" ref="degree_licenced"/>
<field name="partner_id" ref="base.res_partner_11"/>
<field eval="'4'" name="priority"/>
<field name="user_id" ref="base.user_demo"/>
@ -101,7 +101,7 @@
<record id="hr_case_financejob0" model="hr.applicant">
<field eval="time.strftime('%Y-%m-26 17:39:42')" name="date"/>
<field eval="time.strftime('%Y-%m-28')" name="date_deadline"/>
<field name="type_id" ref="type_job2"/>
<field name="type_id" ref="degree_licenced"/>
<field name="partner_id" ref="base.res_partner_11"/>
<field eval="'4'" name="priority"/>
<field name="user_id" ref="base.user_root"/>
@ -121,7 +121,7 @@
<field name="partner_address_id" ref="base.res_partner_address_14"/>
<field name="som" ref="base.som_fury"/>
<field eval="time.strftime('%Y-%m-12 17:49:19')" name="date"/>
<field name="type_id" ref="type_job3"/>
<field name="type_id" ref="degree_bac5"/>
<field name="partner_id" ref="base.res_partner_15"/>
<field eval="'3'" name="priority"/>
<field name="user_id" ref="base.user_root"/>

View File

@ -7,9 +7,9 @@
<record model="ir.actions.act_window" id="crm_case_categ0_act_job">
<field name="name">Applicants</field>
<field name="res_model">hr.applicant</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_mode">tree,form,graph,calendar</field>
<field name="view_id" ref="crm_case_tree_view_job"/>
<field name="context">{"search_default_user_id":uid}</field>
<field name="context">{"search_default_user_id":uid, 'search_default_current': 1}</field>
<field name="search_view_id" ref="view_crm_case_jobs_filter"/>
</record>

View File

@ -55,6 +55,8 @@
<field name="stage_id"/>
<button name="stage_previous" string="Previous" states="open,pending" type="object" icon="gtk-go-back"/>
<button name="stage_next" string="Next" states="open,pending" type="object" icon="gtk-go-forward"/>
<field name="title_action" invisible="context.get('invisible_next_action', True)"/>
<field name="date_action" invisible="context.get('invisible_next_date', True)"/>
<field name="survey" invisible="1"/>
<field name="response" invisible="1"/>
<field name="priority"/>
@ -67,7 +69,6 @@
<button name="case_pending" string="Pending" states="draft,open" type="object" icon="gtk-media-pause"/>
<button name="case_close" string="Hired" states="open,draft,pending" type="object" icon="terp-partner"/>
<button name="case_cancel" string="Refused" states="draft,open,pending" type="object" icon="gtk-cancel"/>
</tree>
</field>
</record>
@ -94,16 +95,23 @@
<field name="user_id"/>
<button name="action_print_survey" string="Print Interview" type="object" icon="gtk-print" attrs="{'readonly':[('survey','=',False)]}"/>
<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)]}" groups="base.group_extended"/>
<newline/>
<field name="date_action"/>
<field name="title_action"/>
</group>
<notebook colspan="4">
<page string="Job Info">
<group col="2" colspan="2">
<separator colspan="2" string="Contact"/>
<group col="3" colspan="2">
<separator colspan="3" string="Contact"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, email_from)" />
<field name="partner_address_id" on_change="onchange_partner_address_id(partner_address_id, email_from)"/>
<field name="email_from"/>
<field name="partner_phone"/>
<field name="partner_mobile"/>
<button string="Create Partner"
name="%(action_hr_recruitment_partner_create)d"
icon="terp-mail-replied" type="action"/>
<newline/>
<field name="partner_address_id" on_change="onchange_partner_address_id(partner_address_id, email_from)" colspan="3"/>
<field name="email_from" colspan="3"/>
<field name="partner_phone" colspan="3"/>
<field name="partner_mobile" colspan="3"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Contract Data"/>
@ -113,7 +121,8 @@
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Qualification"/>
<field name="type_id" domain="[('object_id.model', '=', 'hr.applicant')]"/>
<!-- <field name="type_id" domain="[('object_id.model', '=', 'hr.applicant')]"/>-->
<field name="type_id"/>
<field name="priority" string="Appreciation"/>
<field name="reference"/>
</group>
@ -133,13 +142,13 @@
<button name="case_reset" string="Reset to New" states="done,cancel" type="object" icon="gtk-convert"/>
</group>
</page>
<page string="Internal Notes">
<page string="Notes">
<field name="description" nolabel="1" colspan="4"/>
</page>
<page string="History" groups="base.group_extended">
<!-- <page string="History" groups="base.group_extended">
<field name="id"/>
<field name="active"/>
</page>
</page> -->
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="Global CC" widget="char"/>
@ -176,10 +185,13 @@
icon="terp-mail-replied" type="action" />
</form>
</field>
<button colspan="4" string="Send New Email"
<button colspan="2" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'hr.applicant'}"
icon="terp-mail-message-new" type="action" />
<button colspan="2" string="Forward"
name="%(crm.crm_lead_forward_to_partner_act)d"
icon="terp-mail-forward" type="action" />
</page>
</notebook>
</form>
@ -210,6 +222,7 @@
domain="[('state','in',('draft','open'))]"
help="All new and in progress jobs"
default="1"
name="current"
/>
<filter icon="terp-document-new" string="New"
domain="[('state','=','draft')]"
@ -224,10 +237,15 @@
help="Pending Jobs"
/>
<separator orientation="vertical"/>
<filter icon="terp-check" string="Next Actions"
context="{'invisible_next_action':False, 'invisible_next_date':False}"
domain="[]"
help="View Next Action and Date"/>
<separator orientation="vertical"/>
<field name="partner_name"/>
<field name="email_from"/>
<field name="job_id" widget="selection"/>
<field name="user_id" widget="selection">
<field name="user_id">
<filter domain="[('user_id','=',False)]" help="Unassigned Recruitements" icon="terp-personal-" separator="1"/>
</field>
<field name="department_id" widget="selection" string="Department" context="{'invisible_department': False}">
@ -254,6 +272,24 @@
</field>
</record>
<!-- CRM Lead Calendar View -->
<record model="ir.ui.view" id="hr_applicant_calendar_view">
<field name="name">Hr Applicants Calendar</field>
<field name="model">hr.applicant</field>
<field name="type">calendar</field>
<field name="priority" eval="2"/>
<field name="arch" type="xml">
<calendar string="Applicants"
date_start="date_action" color="user_id">
<field name="name" />
<field name="partner_name" />
<field name="stage_id" />
</calendar>
</field>
</record>
# ------------------------------------------------------
# HR Job
# ------------------------------------------------------
@ -321,5 +357,42 @@
action="hr_recruitment_stage_act"
sequence="1"/>
<!-- Degree Tree View -->
<record model="ir.ui.view" id="hr_recruitment_degree_tree">
<field name="name">hr.recruitment.degree.tree</field>
<field name="model">hr.recruitment.degree</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Degree">
<field name="sequence" invisible="1"/>
<field name="name"/>
</tree>
</field>
</record>
<!-- Degree Form View -->
<record model="ir.ui.view" id="hr_recruitment_degree_form">
<field name="name">hr.recruitment.degree.form</field>
<field name="model">hr.recruitment.degree</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Degree">
<field name="name" select="1"/>
<field name="sequence"/>
</form>
</field>
</record>
<!-- Degree Action -->
<record id="hr_recruitment_degree_action" model="ir.actions.act_window">
<field name="name">Degree</field>
<field name="res_model">hr.recruitment.degree</field>
<field name="view_type">form</field>
<field name="view_id" ref="hr_recruitment_degree_tree"/>
</record>
</data>
</openerp>

View File

@ -60,7 +60,7 @@
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Recruitment during last 7 days"/>
<separator orientation="vertical"/>
<filter string="Draft"
<filter string="New"
icon="terp-document-new"
domain="[('state','=','draft')]"
help = "Draft recruitment"/>
@ -73,9 +73,9 @@
domain="[('state','=','pending')]"
help = "Pending recruitment"/>
<separator orientation="vertical"/>
<field name="partner_id"/>
<field name="job_id"/>
<field name="department_id" widget="selection"/>
<field name="user_id" widget="selection">
<field name="user_id">
<filter icon="terp-hr"
string="My Recruitment"
help="My Recruitment"

View File

@ -31,7 +31,7 @@
<field name="target">new</field>
</record>
<record model="ir.values" id="hr_recruitment_partner_create_values">
<!-- <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>
@ -39,7 +39,7 @@
<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>
</record> -->
</data>
</openerp>

View File

@ -47,7 +47,9 @@ class hr_analytic_timesheet(osv.osv):
'partner_id': fields.related('account_id', 'partner_id', type='many2one', string='Partner Id', relation='account.analytic.account', store=True),
}
def unlink(self, cr, uid, ids, context={}):
def unlink(self, cr, uid, ids, context=None):
if context is None:
context = {}
toremove = {}
for obj in self.browse(cr, uid, ids, context=context):
toremove[obj.line_id.id] = True
@ -55,7 +57,9 @@ class hr_analytic_timesheet(osv.osv):
return super(hr_analytic_timesheet, self).unlink(cr, uid, ids, context=context)
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, unit, context={}):
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, unit, context=None):
if context is None:
context = {}
res = {}
if prod_id and unit_amount:
# find company
@ -63,9 +67,11 @@ class hr_analytic_timesheet(osv.osv):
res = self.pool.get('account.analytic.line').on_change_unit_amount(cr, uid, id, prod_id, unit_amount, company_id, unit, context=context)
return res
def _getEmployeeProduct(self, cr, uid, context={}):
def _getEmployeeProduct(self, cr, uid, context=None):
if context is None:
context = {}
emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))])
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))], context=context)
if emp_id:
emp=emp_obj.browse(cr, uid, emp_id[0], context=context)
if emp.product_id:
@ -76,7 +82,7 @@ class hr_analytic_timesheet(osv.osv):
emp_obj = self.pool.get('hr.employee')
if context is None:
context = {}
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))])
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))], context=context)
if emp_id:
emp=emp_obj.browse(cr, uid, emp_id[0], context=context)
if emp.product_id:
@ -87,7 +93,7 @@ class hr_analytic_timesheet(osv.osv):
emp_obj = self.pool.get('hr.employee')
if context is None:
context = {}
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))])
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))], context=context)
if emp_id:
emp = emp_obj.browse(cr, uid, emp_id[0], context=context)
if bool(emp.product_id):
@ -102,7 +108,7 @@ class hr_analytic_timesheet(osv.osv):
emp_obj = self.pool.get('hr.employee')
if context is None:
context = {}
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))])
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))], context=context)
if emp_id:
emp = emp_obj.browse(cr, uid, emp_id[0], context=context)
if emp.journal_id:
@ -129,7 +135,9 @@ class hr_analytic_timesheet(osv.osv):
return {'value':{},'warning':warning}
return {'value':{}}
def create(self, cr, uid, vals, context={}):
def create(self, cr, uid, vals, context=None):
if context is None:
context = {}
emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))], context=context)
ename = ''

View File

@ -7,13 +7,14 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0_rc3\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2009-11-17 07:12+0000\n"
"Last-Translator: Raimon Esteve (Zikzakmedia) <resteve@zikzakmedia.com>\n"
"PO-Revision-Date: 2010-07-24 10:06+0000\n"
"Last-Translator: Jordi Esteve (www.zikzakmedia.com) "
"<jesteve@zikzakmedia.com>\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-06-22 04:09+0000\n"
"X-Launchpad-Export-Date: 2010-07-25 04:07+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: hr_timesheet
@ -112,7 +113,7 @@ msgstr "Producte"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "août"
msgstr ""
msgstr "Agost"
#. module: hr_timesheet
#: field:hr.employee,journal_id:0
@ -157,11 +158,9 @@ msgstr "Temps total"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "juillet"
msgstr ""
msgstr "Juliol"
#. module: hr_timesheet
#: xsl:hr.analytical.timesheet:0
#: xsl:hr.analytical.timesheet_users:0
#: model:ir.ui.menu,name:hr_timesheet.next_id_48
msgid "Timesheet"
msgstr "Full d'assistència"
@ -171,14 +170,14 @@ msgstr "Full d'assistència"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "janvier"
msgstr ""
msgstr "Gener"
#. module: hr_timesheet
#: selection:hr.analytical.timesheet,init,month:0
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "juin"
msgstr ""
msgstr "Juny"
#. module: hr_timesheet
#: model:ir.actions.wizard,name:hr_timesheet.wizard_hr_timesheet_my
@ -233,7 +232,7 @@ msgstr "XML invàlid per a la definició de la vista!"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "avril"
msgstr ""
msgstr "Abril"
#. module: hr_timesheet
#: field:hr.analytic.timesheet,line_id:0
@ -255,7 +254,7 @@ msgstr "Selecciona usuaris"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "novembre"
msgstr ""
msgstr "Novembre"
#. module: hr_timesheet
#: wizard_view:hr_timesheet.si_so,sign_out:0
@ -283,7 +282,7 @@ msgstr "Estat actual"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "octobre"
msgstr ""
msgstr "Octubre"
#. module: hr_timesheet
#: view:account.analytic.account:0
@ -295,7 +294,7 @@ msgstr "Estadístiques d'anàlisis"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "décembre"
msgstr ""
msgstr "Desembre"
#. module: hr_timesheet
#: wizard_field:hr_timesheet.si_so,sign_in,info:0
@ -345,7 +344,7 @@ msgstr "Recursos humans (codificació d'horaris)"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "mars"
msgstr ""
msgstr "Març"
#. module: hr_timesheet
#: xsl:hr.analytical.timesheet:0
@ -358,7 +357,7 @@ msgstr "Total"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "mai"
msgstr ""
msgstr "Maig"
#. module: hr_timesheet
#: wizard_button:hr_timesheet.si_so,sign_out,si_result:0
@ -375,7 +374,7 @@ msgstr "Canvia treball"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "février"
msgstr ""
msgstr "Febrer"
#. module: hr_timesheet
#: view:account.analytic.account:0
@ -469,9 +468,105 @@ msgstr "Horari d'empleats"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "septembre"
msgstr ""
msgstr "Setembre"
#. module: hr_timesheet
#: view:hr.employee:0
msgid "Timesheets"
msgstr "Horaris"
#, python-format
#~ msgid "Wed"
#~ msgstr "Dc"
#, python-format
#~ msgid "No employee defined for your user !"
#~ msgstr "No s'ha definit un empleat pel vostre usuari!"
#, python-format
#~ msgid "Mon"
#~ msgstr "Dl"
#, python-format
#~ msgid "UserError"
#~ msgstr "Error d'usuari"
#, python-format
#~ msgid "No cost unit defined for this employee !"
#~ msgstr "No s'ha definit una unitat de cost per aquest empleat!"
#, python-format
#~ msgid "ValidateError"
#~ msgstr "Error de validació"
#, python-format
#~ msgid "Sat"
#~ msgstr "Ds"
#, python-format
#~ msgid "Sun"
#~ msgstr "Dg"
#, python-format
#~ msgid "July"
#~ msgstr "Juliol"
#, python-format
#~ msgid "Tue"
#~ msgstr "Dt"
#, python-format
#~ msgid "March"
#~ msgstr "Març"
#, python-format
#~ msgid "September"
#~ msgstr "Setembre"
#, python-format
#~ msgid "December"
#~ msgstr "Desembre"
#, python-format
#~ msgid "Fri"
#~ msgstr "Dv"
#, python-format
#~ msgid "August"
#~ msgstr "Agost"
#, python-format
#~ msgid "June"
#~ msgstr "Juny"
#, python-format
#~ msgid "November"
#~ msgstr "Novembre"
#, python-format
#~ msgid "October"
#~ msgstr "Octubre"
#, python-format
#~ msgid "January"
#~ msgstr "Gener"
#, python-format
#~ msgid "May"
#~ msgstr "Maig"
#, python-format
#~ msgid "February"
#~ msgstr "Febrer"
#, python-format
#~ msgid "Thu"
#~ msgstr "Dj"
#, python-format
#~ msgid "April"
#~ msgstr "Abril"
#, python-format
#~ msgid "UnknownError"
#~ msgstr "Error desconegut"

View File

@ -33,6 +33,8 @@ class analytical_timesheet_employee(osv.osv_memory):
}
def _get_user(self, cr, uid, context=None):
if context is None:
context = {}
return uid
_defaults = {
@ -42,6 +44,8 @@ class analytical_timesheet_employee(osv.osv_memory):
}
def print_report(self, cr, uid, ids, context=None):
if context is None:
context = {}
data = self.read(cr, uid, ids, context=context)[0]
datas = {
'ids': [],
@ -54,4 +58,5 @@ class analytical_timesheet_employee(osv.osv_memory):
'datas': datas,
}
analytical_timesheet_employee()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -39,6 +39,8 @@ class analytical_timesheet_employees(osv.osv_memory):
}
def print_report(self, cr, uid, ids, context=None):
if context is None:
context = {}
data = self.read(cr, uid, ids, context=context)[0]
datas = {
'ids': [],

View File

@ -33,31 +33,37 @@ class hr_so_project(osv.osv_memory):
'date': fields.datetime('Closing Date'),
'analytic_amount': fields.float('Minimum Analytic Amount'),
'name': fields.char('Employees name', size=32, required=True, readonly=True),
'state': fields.char('Current state', size=32, required=True, readonly=True),
# 'state': fields.char('Current state', size=32, required=True, readonly=True),
'state': fields.related('emp_id', 'state', string='Current state', type='char', required=True, readonly=True),
'server_date': fields.datetime('Current Date', required=True, readonly=True),
'emp_id': fields.many2one('hr.employee', 'Employee ID')
}
def _get_empid(self, cr, uid, context=None):
emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
if emp_id:
for employee in emp_obj.browse(cr, uid, emp_id):
return {'name': employee.name, 'state': employee.state, 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
if context is None:
context = {}
emp_ids = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
if emp_ids:
for employee in emp_obj.browse(cr, uid, emp_ids, context=context):
return {'name': employee.name, 'state': employee.state, 'emp_id': emp_ids[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
def _get_empid2(self, cr, uid, context):
res = self._get_empid(cr, uid, context)
def _get_empid2(self, cr, uid, context=None):
if context is None:
context = {}
res = self._get_empid(cr, uid, context=context)
cr.execute('select name,action from hr_attendance where employee_id=%s order by name desc limit 1', (res['emp_id'],))
res['server_date'] = time.strftime('%Y-%m-%d %H:%M:%S')
date_start = cr.fetchone()
if date_start:
res['date_start'] = date_start[0]
return res
def default_get(self, cr, uid, fields_list, context=None):
if context is None:
context = {}
res = super(hr_so_project, self).default_get(cr, uid, fields_list, context=context)
res.update(self._get_empid2(cr, uid, context=context))
return res
@ -65,41 +71,44 @@ class hr_so_project(osv.osv_memory):
def _write(self, cr, uid, data, emp_id, context=None):
timesheet_obj = self.pool.get('hr.analytic.timesheet')
emp_obj = self.pool.get('hr.employee')
if context is None:
context = {}
hour = (time.mktime(time.strptime(data['date'] or time.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')) -
time.mktime(time.strptime(data['date_start'], '%Y-%m-%d %H:%M:%S'))) / 3600.0
minimum = data['analytic_amount']
if minimum:
hour = round(round((hour + minimum / 2) / minimum) * minimum, 2)
res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'], context=context)
if not res['product_uom_id']:
raise osv.except_osv(_('UserError'), _('No cost unit defined for this employee !'))
up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour, res['product_uom_id'])['value']
res['name'] = data['info']
res['account_id'] = data['account_id'].id
res['unit_amount'] = hour
emp_journal = emp_obj.browse(cr, uid, emp_id, context).journal_id
emp_journal = emp_obj.browse(cr, uid, emp_id, context=context).journal_id
res['journal_id'] = emp_journal and emp_journal.id or False
res.update(up)
up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
res.update(up)
return timesheet_obj.create(cr, uid, res, context=context)
def sign_out_result_end(self, cr, uid, ids, context=None):
if context is None:
context = {}
emp_obj = self.pool.get('hr.employee')
for data in self.browse(cr, uid, ids):
for data in self.browse(cr, uid, ids, context=context):
emp_id = data.emp_id.id
emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out',dt=data.date)
emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out', dt=data.date)
self._write(cr, uid, data, emp_id, context=context)
return {}
def sign_out_result(self, cr, uid, ids, context=None):
if context is None:
context = {}
emp_obj = self.pool.get('hr.employee')
for data in self.browse(cr, uid, ids):
for data in self.browse(cr, uid, ids, context=context):
emp_id = data.emp_id.id
emp_obj.attendance_action_change(cr, uid, [emp_id], type='action', dt=data.date)
self._write(cr, uid, data, emp_id, context=context)
@ -108,7 +117,7 @@ class hr_so_project(osv.osv_memory):
hr_so_project()
class hr_si_project(osv.osv_memory):
_name = 'hr.sign.in.project'
_description = 'Sign In By Project'
_columns = {
@ -117,9 +126,9 @@ class hr_si_project(osv.osv_memory):
'date': fields.datetime('Starting Date'),
'server_date': fields.datetime('Current Date', readonly=True),
# 'emp_id': fields.char('Employee ID', size=512, required=False),
'emp_id': fields.many2one('hr.employee', 'Employee ID')
'emp_id': fields.many2one('hr.employee', 'Employee ID')
}
def view_init(self, cr, uid, fields, context=None):
"""
This function checks for precondition before wizard executes
@ -130,22 +139,25 @@ class hr_si_project(osv.osv_memory):
@param context: A standard dictionary for contextual values
"""
emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
if context is None:
context = {}
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
if not emp_id:
raise osv.except_osv(_('UserError'), _('No employee defined for your user !'))
return False
return False
def check_state(self, cr, uid, ids, context=None):
obj_model = self.pool.get('ir.model.data')
if context is None:
context = {}
emp_id = self.default_get(cr, uid, context)['emp_id']
# get the latest action (sign_in or out) for this employee
cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,))
res = (cr.fetchone() or ('sign_out',))[0]
in_out = res == 'sign_out' and 'out' or 'in'
#TODO: invert sign_in et sign_out
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_%s' % in_out)])
resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_%s' % in_out)], context=context)
resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
return {
'name': 'Sign in / Sign out',
'view_type': 'form',
@ -156,20 +168,24 @@ class hr_si_project(osv.osv_memory):
'target': 'new'
}
def sign_in_result(self, cr, uid, ids, context):
def sign_in_result(self, cr, uid, ids, context=None):
emp_obj = self.pool.get('hr.employee')
for data in self.browse(cr, uid, ids, context):
if context is None:
context = {}
for data in self.browse(cr, uid, ids, context=context):
emp_id = data.emp_id.id
success = emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data.date or False)
return {}
def default_get(self, cr, uid, fields_list, context=None):
res = super(hr_si_project, self).default_get(cr, uid, fields_list, context=context)
if context is None:
context = {}
emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
if emp_id:
for employee in emp_obj.browse(cr, uid, emp_id):
res.update({'emp_id': employee.name, 'state': employee.state, 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')})
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
if emp_id:
for employee in emp_obj.browse(cr, uid, emp_id, context=context):
res.update({'name': employee.name, 'state': employee.state, 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')})
return res
hr_si_project()

View File

@ -70,11 +70,13 @@
<field name="date_start"/>
<field name="server_date"/>
<separator string="Work done in the last period" colspan="4" />
<field name="account_id" colspan="3"/>
<field name="info" colspan="3"/>
<field name="account_id" colspan="2"/>
<field name="info" colspan="2"/>
<field name="date"/>
<label string="(Keep empty for current_time)" colspan="2"/>
<field name="analytic_amount"/> </group>
<field name="analytic_amount"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Change Work" name="sign_out_result" type="object"/>

View File

@ -2,8 +2,6 @@
<openerp>
<data>
<act_window domain="[('state','&lt;&gt;','close'),('partner_id','&lt;&gt;',False),('to_invoice', '&lt;&gt;', False)]" id="act_my_account" name="Accounts to invoice" res_model="account.analytic.account" src_model="res.users" view_mode="tree,form" view_type="form"/>
<record id="action_account_analytic_line_to_invoice" model="ir.actions.act_window">
@ -16,26 +14,26 @@
<record id="board_hr_timesheet_invoice_form" model="ir.ui.view">
<field name="name">board.hr.timesheet.invoice</field>
<field name="model">board.board</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.board_account_form"/>
<field name="type">form</field>
<field name="inherit_id" ref="account.board_account_form"/>
<field name="arch" type="xml">
<xpath expr="/form/hpaned/child1/action[@string='Draft Customer Invoices']" position="before">
<action colspan="4" height="160" name="%(hr_timesheet_invoice.action_analytic_account_tree)d" string="Analytic accounts to close" width="510"/>
<action colspan="4" height="160" name="%(act_my_account)d" string="Accounts to invoice" width="510"/>
</xpath>
<xpath expr="/form/vpaned/child1/action[@string='Draft Customer Invoices']" position="before">
<action colspan="4" height="160" name="%(hr_timesheet_invoice.action_analytic_account_tree)d" string="Analytic accounts to close" width="510"/>
<action colspan="4" height="160" name="%(act_my_account)d" string="Accounts to invoice" width="510"/>
</xpath>
</field>
</record>
<!-- Need to merge in above view -->
<record id="board_hr_timesheet_invoice_report_form1" model="ir.ui.view">
<!-- Need to merge in above view -->
<record id="board_hr_timesheet_invoice_report_form1" model="ir.ui.view">
<field name="name">board.hr.timesheet.invoice</field>
<field name="model">board.board</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.board_account_form"/>
<field name="type">form</field>
<field name="inherit_id" ref="account.board_account_form"/>
<field name="arch" type="xml">
<xpath expr="/form/hpaned/child2/action[@string='Aged receivables']" position="before">
<action colspan="4" height="220" name="%(action_account_analytic_line_to_invoice)d" string="Costs to invoice"/>
</xpath>
<xpath expr="/form/vpaned/child2/group/action[@string='Aged receivables']" position="before">
<action colspan="4" height="220" name="%(action_account_analytic_line_to_invoice)d" string="Costs to invoice"/>
</xpath>
</field>
</record>
</data>

View File

@ -84,7 +84,6 @@
</record>
<!-- Inherits for account analytic lines -->
<record id="view_account_analytic_line_tree_inherit" model="ir.ui.view">
<field name="name">account.analytic.line.tree.to_invoice</field>
<field name="model">account.analytic.line</field>
@ -110,6 +109,11 @@
</record>
<!-- Menus -->
<menuitem
parent="account.menu_finance_periodical_processing"
id="menu_finance_periodical_processing_billing"
name="Billing"/>
<record id="action_hr_analytic_timesheet_open_tree" model="ir.actions.act_window">
<field name="name">Entries to invoice</field>
<field name="res_model">account.analytic.line</field>
@ -118,12 +122,11 @@
<field name="domain">[('to_invoice','&lt;&gt;',False)]</field>
<field name="context">{"search_default_user_id":uid}</field>
<field name="help">OpenERP automatically group the entries to be invoiced so you can keep an eye on them on real time in one glance.</field>
<!-- <field name="search_view_id" ref="account.view_account_analytic_account_search"/> -->
</record>
<menuitem
action="action_hr_analytic_timesheet_open_tree"
id="menu_hr_analytic_timesheet_tree"
parent="account.menu_finance_periodical_processing"/>
parent="menu_finance_periodical_processing_billing"/>
<record id="action_hr_analytic_timesheet_tree_invoiced" model="ir.actions.act_window">
<field name="name">Uninvoiced Entries</field>

View File

@ -1,30 +1,30 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * hr_timesheet_invoice
# * hr_timesheet_invoice
#
msgid ""
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-09-08 14:49+0000\n"
"Last-Translator: filsys <office@filsystem.ro>\n"
"PO-Revision-Date: 2010-07-23 20:20+0000\n"
"Last-Translator: Desen <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-06-22 04:11+0000\n"
"X-Launchpad-Export-Date: 2010-07-24 03:58+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: hr_timesheet_invoice
#: view:hr_timesheet_invoice.factor:0
msgid "Type of invoicing"
msgstr ""
msgstr "Tip de facturare"
#. module: hr_timesheet_invoice
#: rml:account.analytic.profit:0
msgid "Profit"
msgstr ""
msgstr "Profit"
#. module: hr_timesheet_invoice
#: wizard_view:hr.timesheet.invoice.create,init:0
@ -39,17 +39,17 @@ msgstr ""
#. module: hr_timesheet_invoice
#: rml:account.analytic.profit:0
msgid "Income"
msgstr ""
msgstr "Venituri"
#. module: hr_timesheet_invoice
#: field:hr_timesheet_invoice.factor,customer_name:0
msgid "Visible name"
msgstr ""
msgstr "Nume vizibil"
#. module: hr_timesheet_invoice
#: wizard_field:hr.timesheet.invoice.account.analytic.account.cost_ledger.report,init,date1:0
msgid "Start of period"
msgstr ""
msgstr "Începutul perioadei"
#. module: hr_timesheet_invoice
#: help:hr.timesheet.invoice.create,init,price:0
@ -57,11 +57,13 @@ msgid ""
"The cost of each work done will be displayed on the invoice. You probably "
"don't want to check this."
msgstr ""
"Costul fiecărei activități efectuate va fi tipărit pe factura. Probabil că "
"nu doriți să bifați această opțiune."
#. module: hr_timesheet_invoice
#: model:ir.actions.wizard,name:hr_timesheet_invoice.hr_timesheet_invoice_create
msgid "Invoice analytic lines"
msgstr ""
msgstr "Detalii factură"
#. module: hr_timesheet_invoice
#: help:hr.timesheet.final.invoice.create,init,time:0
@ -72,18 +74,18 @@ msgstr ""
#: model:ir.actions.act_window,name:hr_timesheet_invoice.action_draft_analytic_accounts
#: model:ir.ui.menu,name:hr_timesheet_invoice.menu_action_draft_analytic_accounts
msgid "Draft Analytic Accounts"
msgstr ""
msgstr "Conturi analitice în schiță"
#. module: hr_timesheet_invoice
#: wizard_field:hr.timesheet.final.invoice.create,init,time:0
#: wizard_field:hr.timesheet.invoice.create,init,time:0
msgid "Time spent"
msgstr ""
msgstr "Timp consumat"
#. module: hr_timesheet_invoice
#: field:account.analytic.account,amount_invoiced:0
msgid "Invoiced Amount"
msgstr ""
msgstr "Valoarea Facturată"
#. module: hr_timesheet_invoice
#: help:account.analytic.account,to_invoice:0

View File

@ -72,7 +72,6 @@
'wizard/mrp_change_standard_price_view.xml',
# 'wizard/mrp_track_prod_view.xml',
'mrp_view.xml',
'mrp_wizard.xml',
'mrp_report.xml',
'company_view.xml',
'process/stockable_product_process.xml',

View File

@ -35,7 +35,7 @@
<field name="view_id" ref="board_mrp_manager_form"/>
</record>
<menuitem icon="terp-graph" id="menus_dash_mrp" name="Dashboard"
<menuitem id="menus_dash_mrp" name="Dashboard"
parent="next_id_77" sequence="0"/>
<menuitem
action="open_board_manufacturing"

View File

@ -48,10 +48,10 @@ class mrp_workcenter(osv.osv):
'time_cycle': fields.float('Time for 1 cycle (hour)', help="Time in hours for doing one cycle."),
'time_start': fields.float('Time before prod.', help="Time in hours for the setup."),
'time_stop': fields.float('Time after prod.', help="Time in hours for the cleaning."),
'costs_hour': fields.float('Cost per hour'),
'costs_hour': fields.float('Cost per hour', help="Specify Cost of Workcenter per hour."),
'costs_hour_account_id': fields.many2one('account.analytic.account', 'Hour Account', domain=[('type','<>','view')],
help="Complete this only if you want automatic analytic accounting entries on production orders."),
'costs_cycle': fields.float('Cost per cycle'),
'costs_cycle': fields.float('Cost per cycle', help="Specify Cost of Workcenter per cycle."),
'costs_cycle_account_id': fields.many2one('account.analytic.account', 'Cycle Account', domain=[('type','<>','view')],
help="Complete this only if you want automatic analytic accounting entries on production orders."),
'costs_journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal'),
@ -208,7 +208,7 @@ class mrp_bom(osv.osv):
'active': lambda *a: 1,
'product_efficiency': lambda *a: 1.0,
'product_qty': lambda *a: 1.0,
'product_rounding': lambda *a: 1.0,
'product_rounding': lambda *a: 0.0,
'type': lambda *a: 'normal',
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.bom', context=c),
}
@ -269,11 +269,11 @@ class mrp_bom(osv.osv):
max_prop = prop
return result
def _bom_explode(self, cr, uid, bom, factor, properties, addthis=False, level=0):
def _bom_explode(self, cr, uid, bom, factor, properties=[], addthis=False, level=0):
""" Finds Products and Workcenters for related BoM for manufacturing order.
@param bom: BoM of particular product.
@param factor: Factor of product UoM.
@param properties: A dictionary for contextual values.
@param properties: A List of properties Ids.
@param addthis: If BoM found then True else False.
@param level: Depth level to find BoM lines starts from 10.
@return: result: List of dictionaries containing product details.
@ -635,13 +635,11 @@ class mrp_production(osv.osv):
move_obj.write(cr, uid, [production.move_prod_id.id],
{'location_id': production.location_dest_id.id})
message = ("%s %s %s %s %s %s") % (
_('Manufacturing Order '),
name,
_("scheduled the"),
datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d'),
_("for"),
production.product_id.name)
message = ("Manufacturing Order '%s' for %s %s is Ready to produce.") % (
name,
production.product_qty,
production.product_id.name,
)
self.log(cr, uid, production_id, message)
return True
@ -740,7 +738,7 @@ class mrp_production(osv.osv):
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.production', production_id, 'button_produce_done', cr)
message = _('Manufacturing order ') + " '" + production.name + "' "+ _("is finished.")
message = str(production_qty) + " '[" + production.product_id.code + '] ' + production.product_id.name + _("' have been manufactured for ") + production.name
self.log(cr, uid, production_id, message)
return True
@ -910,7 +908,16 @@ class mrp_production(osv.osv):
proc_ids.append(proc_id)
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
self.write(cr, uid, [production.id], {'picking_id': picking_id, 'move_lines': [(6,0,moves)], 'state':'confirmed'})
message = _('Manufacturing order ') + " '" + production.name + "' "+ _("is confirmed.")
message = ("%s '%s' %s %s %s %s %s %s.") % (
_('Manufacturing Order'),
production.name,
_('for'),
production.product_qty,
production.product_id.name,
_('scheduled for date '),
datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d'),
_('is waiting')
)
self.log(cr, uid, production.id, message)
return picking_id

View File

@ -155,10 +155,10 @@
<group col="4" colspan="4">
<field name="capacity_per_cycle"/>
<newline/>
<field name="time_cycle"/>
<field name="time_cycle" widget="float_time"/>
<field name="time_efficiency"/>
<field name="time_start"/>
<field name="time_stop"/>
<field name="time_start" widget="float_time"/>
<field name="time_stop" widget="float_time"/>
</group>
</page>
<page string="Analytic Accounting" groups="base.group_extended">
@ -236,7 +236,7 @@
<field name="sequence" select="1"/>
<field name="workcenter_id" select="1"/>
<field name="cycle_nbr"/>
<field name="hour_nbr"/>
<field name="hour_nbr" widget="float_time"/>
<separator colspan="4" string="Description"/>
<field colspan="4" name="note" nolabel="1"/>
</form>
@ -301,8 +301,8 @@
<field name="name" select="1"/>
<field name="code" select="1" string="Reference" groups="base.group_extended"/>
<newline/>
<field name="product_uom"/>
<field name="product_qty"/>
<field name="product_uom"/>
<field name="routing_id" groups="base.group_extended"/>
<newline/>
<field name="product_uos" groups="product.group_uos"/>
@ -316,8 +316,8 @@
<field colspan="4" name="bom_lines" nolabel="1" widget="one2many_list">
<tree string="Components" editable="bottom">
<field name="product_id" on_change="onchange_product_id(product_id, name)" select="1"/>
<field name="product_uom"/>
<field name="product_qty"/>
<field name="product_uom"/>
<field name="name" invisible="1"/>
<field name="date_start"/>
<field name="date_stop"/>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
</data>
</openerp>

View File

@ -31,75 +31,68 @@ from tools.translate import _
class report_custom(report_rml):
def create_xml(self, cr, uid, ids, datas, context={}):
number = (datas.get('form', False) and datas['form']['number']) or 1
def process_bom(bom, currency_id):
pool = pooler.get_pool(cr.dbname)
product_pool = pool.get('product.product')
product_uom_pool = pool.get('product.uom')
supplier_info_pool = pool.get('product.supplierinfo')
workcenter_pool = pool.get('mrp.workcenter')
user_pool = pool.get('res.users')
bom_pool = pool.get('mrp.bom')
def process_bom(bom, currency_id, factor=1):
xml = '<row>'
sum = 0
sum_strd = 0
prod = pooler.get_pool(cr.dbname).get('product.product').browse(cr, uid, bom['product_id'])
prod = product_pool.browse(cr, uid, bom['product_id'])
prod_name = bom['name']
prod_qtty = bom['product_qty']
prod_uom = prod.uom_id.name
prod_qtty = factor * bom['product_qty']
product_uom = product_uom_pool.browse(cr, uid, bom['product_uom'], context=context)
level = 1
main_sp_price = ''
main_sp_name = ''
main_strd_price = ''
main_strd_price = ''
if prod.seller_ids and prod.seller_ids[0] :
main_sp_name = '<b>' + prod.seller_ids[0].name.name + '</b>\r\n'
pricelist_id = prod.seller_ids[0].name.property_product_pricelist_purchase.id
if pricelist_id:
pricelist_obj = pooler.get_pool(cr.dbname).get('product.pricelist')
price = pricelist_obj.price_get(cr,uid,[pricelist_id], prod.id, number*prod_qtty or 1.0).setdefault(pricelist_id, 0)
price = pooler.get_pool(cr.dbname).get('res.currency').compute(cr, uid, pricelist_obj.browse(cr, uid, pricelist_id).currency_id.id, currency_id, price)
else:
price = 0
main_sp_price = '%.2f' % price + '\r\n'
main_sp_price, main_sp_name , main_strd_price = '','',''
sellers, sellers_price = '',''
if prod.seller_id:
main_sp_name = "<b>%s</b>\r\n" %(prod.seller_id.name)
price = supplier_info_pool.price_get(cr, uid, prod.seller_id.id, prod.id, number*prod_qtty)[prod.seller_id.id]
price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
main_sp_price = '<b>%s</b>\r\n' %(str(price))
sum += prod_qtty*price
std_price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, prod.standard_price, to_uom_id=product_uom.id)
main_strd_price = str(std_price) + '\r\n'
sum_strd = prod_qtty*std_price
main_strd_price = '%.2f' % prod.standard_price + '\r\n'
sum_strd = prod_qtty*prod.standard_price
sellers = ''
sellers_price = ''
for seller_id in prod.seller_ids:
sellers += '- <i>'+ seller_id.name.name +'</i>\r\n'
pricelist_id = seller_id.name.property_product_pricelist_purchase.id
if pricelist_id:
pricelist_obj = pooler.get_pool(cr.dbname).get('product.pricelist')
price = pricelist_obj.price_get(cr,uid,[pricelist_id], prod.id, number*prod_qtty or 1.0).setdefault(pricelist_id, 0)
price = pooler.get_pool(cr.dbname).get('res.currency').compute(cr, uid, pricelist_obj.browse(cr, uid, pricelist_id).currency_id.id, currency_id, price)
else:
price = 0
sellers_price += '%.2f' % price + '\r\n'
price = supplier_info_pool.price_get(cr, uid, seller_id.name.id, prod.id, number*prod_qtty)[seller_id.name.id]
price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
sellers_price += '<i>' + str(price) + '</i>\r\n'
xml += "<col para='yes'>" + prod_name + '</col>'
xml += "<col para='no'>" + main_sp_name + sellers + '</col>'
xml += "<col para='yes'>" + main_sp_name + sellers + '</col>'
xml += "<col para='yes'>" + str(prod_qtty) + '</col>'
xml += "<col para='yes'>" + prod_uom + '</col>'
xml += "<col para='yes'>" + product_uom.name + '</col>'
xml += "<col para='yes'>" + main_strd_price + '</col>'
xml += "<col para='no'>" + main_sp_price + sellers_price + '</col>'
xml += "<col para='yes'>" + main_sp_price + sellers_price + '</col>'
xml += '</row>'
return xml, sum, sum_strd
def process_workcenter(wrk):
workcenter = workcenter_pool.browse(cr, uid, wrk['workcenter_id'])
cost_cycle = wrk['cycle']*workcenter.costs_cycle
cost_hour = wrk['hour']*workcenter.costs_hour
total = cost_cycle + cost_hour
xml = '<row>'
workcenter = pooler.get_pool(cr.dbname).get('mrp.workcenter').browse(cr, uid, wrk['workcenter_id'])
xml += "<col para='yes'>" + wrk['name'] + '</col>'
xml += "<col para='yes'>" + '</col>'
xml += "<col para='no'>" + '</col>'
xml += "<col para='yes'>" + workcenter.name + '</col>'
xml += "<col/>"
xml += "<col para='no'>" + str(wrk['cycle']*workcenter.costs_cycle) + '</col>'
xml += "<col para='yes'>" + str(wrk['hour']*workcenter.costs_hour) + '</col>'
xml += "<col/>"
xml += "<col para='yes'>" + str(cost_cycle) + '</col>'
xml += "<col para='yes'>" + str(cost_hour) + '</col>'
xml += "<col para='yes'>" + str(cost_hour + cost_cycle) + '</col>'
xml += '</row>'
return xml, wrk['cycle']*workcenter.costs_cycle+wrk['hour']*workcenter.costs_hour
return xml, total
xml = ''
@ -115,30 +108,20 @@ class report_custom(report_rml):
<report-footer>Generated by Open ERP</report-footer>
</config>
"""
header = """
<header>
<field>%s</field>
<field>%s</field>
<field>%s</field>
<field>%s</field>
<field>%s</field>
<field>%s</field>
</header>
""" % (_('Product name'), _('Product supplier'), _('Product quantity'), _('Product uom'), _('Product Standard Price'), _('Unit Product Price'))
workcenter_header = """
<lines style='header'>
<row>
<col>%s</col>
<col/>
<col/>
<col/>
<col>%s</col>
<col>%s</col>
<col>%s</col>
</row>
</lines>
""" % (_('Work Center name'), _('Cycles Cost'), _('Total hourly costs'))
""" % (_('Work Center name'), _('Cycles Cost'), _('Hourly Cost'),_('Work Cost'))
prod_header = """
<lines style='header'>
<row>
<col para='yes'>%s</col>
<col para='yes'>%s</col>
@ -147,32 +130,62 @@ class report_custom(report_rml):
<col para='yes'>%s</col>
<col para='yes'>%s</col>
</row>
</lines>
""" % (_('Product name'), _('Product supplier'), _('Product Quantity'), _('Product uom'), _('Product Standard Price'), _('Unit Product Price'))
""" % (_('Componet'), _('Componet suppliers'), _('Quantity'), _('Uom'), _('Cost Unit Price per Uom'), _('Supplier Unit Price per Uom'))
company_currency = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid).company_id.currency_id.id
first = True
for prod_id in ids:
bom_ids = pooler.get_pool(cr.dbname).get('mrp.bom').search(cr, uid, [('product_id','=',prod_id)])
prod = pooler.get_pool(cr.dbname).get('product.product').browse(cr, uid, prod_id)
for bom_id in bom_ids:
bom = pooler.get_pool(cr.dbname).get('mrp.bom').browse(cr, uid, bom_id)
sub_boms = pooler.get_pool(cr.dbname).get('mrp.bom')._bom_explode(cr, uid, bom, number, [])
company_currency = user_pool.browse(cr, uid, uid).company_id.currency_id.id
for product in product_pool.browse(cr, uid, ids, context=context):
bom_id = bom_pool._bom_find(cr, uid, product.id, product.uom_id.id)
title = "<title>%s</title>" %(_("Cost Structure"))
title += "<title>%s</title>" %product.name
xml += "<lines style='header'>" + title + prod_header + "</lines>"
if not bom_id:
total_strd = number * product.standard_price
total = number * product_pool.price_get(cr, uid, [product.id], 'standard_price')[product.id]
xml += """<lines style='lines'><row>
<col para='yes'>-</col>
<col para='yes'>-</col>
<col para='yes'>-</col>
<col para='yes'>-</col>
<col para='yes'>-</col>
<col para='yes'>-</col>
</row></lines>"""
xml += """<lines style='total'> <row>
<col>%s %s %s %s : </col>
<col/>
<col/>
<col/>
<col>%s</col>
<col>%s</col>
</row></lines>'"""%(_('Total Cost'), _('of'), str(number), product.uom_id.name, str(total_strd), str(total))
else:
bom = bom_pool.browse(cr, uid, bom_id, context=context)
factor = number * product.uom_id.factor / bom.product_uom.factor
sub_boms = bom_pool._bom_explode(cr, uid, bom, factor / bom.product_qty)
total = 0
total_strd = 0
parent_bom = {'product_qty': bom.product_qty, 'name': bom.product_id.name, 'product_uom': bom.product_id.uom_id.factor, 'product_id': bom.product_id.id}
parent_bom = {
'product_qty': bom.product_qty,
'name': bom.product_id.name,
'product_uom': bom.product_uom.id,
'product_id': bom.product_id.id
}
xml_tmp = ''
for sub_bom in (sub_boms and sub_boms[0]) or [parent_bom]:
txt, sum, sum_strd = process_bom(sub_bom, company_currency)
xml_tmp += txt
total += sum
total_strd += sum_strd
if not first:
xml += prod_header
xml += "<lines style='lines'>" + xml_tmp + '</lines>'
xml += "<lines style='sub_total'><row><col>%s : </col><col>(" % (_('SUBTOTAL')) + str(number) + " %s)</col><col/><col/><col>" % (_('products')) + '%.2f' % total_strd + '</col><col>' + '%.2f' % total + '</col></row></lines>'
xml += """<lines style='sub_total'> <row>
<col>%s %s %s %s : </col>
<col/>
<col/>
<col/>
<col>%s</col>
<col>%s</col>
</row></lines>'"""%(_('Cost'), _('of'), str(number), product.uom_id.name, str(total_strd), str(total))
total2 = 0
xml_tmp = ''
for wrk in (sub_boms and sub_boms[1]):
@ -182,13 +195,24 @@ class report_custom(report_rml):
if xml_tmp:
xml += workcenter_header
xml += "<lines style='lines'>" + xml_tmp + '</lines>'
xml += "<lines style='sub_total'><row><col>%s : </col><col>(" % (_('SUBTOTAL')) + str(number) + " %s)</col><col/><col/><col/><col>" % (_('products')) + '%.2f' % total2 + '</col></row></lines>'
xml += "<lines style='total'><row><col>%s : </col><col>(" % (_('TOTAL')) + str(number) + " %s)</col><col/><col/><col>" % (_('products')) + '%.2f' % (total_strd+total2) + "</col><col>" + '%.2f' % (total+total2) + '</col></row></lines>'
first = False
xml = '<?xml version="1.0" ?><report>' + config_start + '<report-header>%s\n\r' % (_('Product Cost Structure')) + prod.name + '</report-header>'+ config_stop + header + xml + '</report>'
xml += """<lines style='sub_total'> <row>
<col>%s %s %s %s : </col>
<col/>
<col/>
<col/>
<col/>
<col>%s</col>
</row></lines>'"""%(_('Work Cost'), _('of'), str(number), product.uom_id.name, str(total2))
xml += """<lines style='total'> <row>
<col>%s %s %s %s : </col>
<col/>
<col/>
<col/>
<col>%s</col>
<col>%s</col>
</row></lines>'"""%(_('Total Cost'), _('of'), str(number), product.uom_id.name, str(total_strd+total2), str(total+total2))
xml = '<?xml version="1.0" ?><report>' + config_start + config_stop + xml + '</report>'
return xml
report_custom('report.product.price', 'product.product', '', 'addons/mrp/report/price.xsl')

View File

@ -43,13 +43,6 @@
<xsl:template match="report">
<xsl:apply-templates select="config"/>
<blockTable style="header">
<xsl:attribute name="colWidths">
<xsl:value-of select="./config/tableSize"/>
</xsl:attribute>
<xsl:apply-templates select="header"/>
</blockTable>
<xsl:apply-templates select="title"/>
<xsl:apply-templates select="lines"/>
</xsl:template>
@ -82,6 +75,7 @@
</xsl:template>
<xsl:template match="lines">
<xsl:apply-templates select="title"/>
<blockTable>
<xsl:attribute name="style"><xsl:value-of select="@style"/></xsl:attribute>
<xsl:attribute name="colWidths">

View File

@ -33,7 +33,8 @@
seller_ids:
- delay: 1
name: base.res_partner_asus
qty: 1.0
min_qty: 1.0
product_uom: product_uom_litre0
supply_method: buy
type: product
uom_id: product.product_uom_kgm
@ -51,7 +52,8 @@
seller_ids:
- delay: 1
name: base.res_partner_desertic_hispafuentes
qty: 2.0
min_qty: 2.0
product_uom: product.product_uom_kgm
supply_method: buy
type: product
uom_id: product.product_uom_kgm

View File

@ -25,7 +25,10 @@ class mrp_price(osv.osv_memory):
_name = 'mrp.product_price'
_description = 'Product Price'
_columns = {
'number': fields.integer('Number of products to produce', required=True),
'number': fields.integer('Quantity', required=True, help="Specify quantity of products to produce or buy. Report of Cost structure will be displayed base on this qunatity."),
}
_defaults = {
'number': 1,
}
def print_report(self, cr, uid, ids, context=None):

View File

@ -9,14 +9,16 @@
<field name="model">mrp.product_price</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Paid ?">
<form string="Product Cost Structure">
<separator colspan="4" string="Print Cost Structure of Product." />
<field name="number"/>
<newline/>
<separator string="" colspan="4"/>
<group col="2" colspan="4">
<button icon='gtk-close' special="cancel"
string="Close" />
<button name="print_report" string="Print"
colspan="1" type="object" icon="gtk-ok" />
colspan="1" type="object" icon="gtk-print" />
</group>
</form>
</field>

View File

@ -8,13 +8,14 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-12-08 11:46+0000\n"
"PO-Revision-Date: 2010-03-07 17:36+0000\n"
"Last-Translator: Edgardo Ramos Roque <Unknown>\n"
"PO-Revision-Date: 2010-07-23 19:00+0000\n"
"Last-Translator: Jordi Esteve (www.zikzakmedia.com) "
"<jesteve@zikzakmedia.com>\n"
"Language-Team: Spanish <es@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-06-22 04:20+0000\n"
"X-Launchpad-Export-Date: 2010-07-24 03:58+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: multi_company
@ -46,7 +47,7 @@ msgstr "El IVA no parece ser correcto"
#. module: multi_company
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
msgstr "Nombre de modelo inválido en la definición de la acción"
msgstr "Nombre de modelo no válido en la definición de la acción."
#. module: multi_company
#: model:res.company,overdue_msg:multi_company.res_company_odoo

View File

@ -291,8 +291,7 @@ class procurement_order(osv.osv):
if not procurement.product_id.seller_ids:
cr.execute('update procurement_order set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id))
return False
partner_list = sorted([(partner_id.sequence, partner_id) for partner_id in procurement.product_id.seller_ids if partner_id and partner_id.sequence])
partner = partner_list and partner_list[0] and partner_list[0][1] and partner_list[0][1].name or False
partner = procurement.product_id.seller_id #Taken Main Supplier of Product of Procurement.
if user.company_id and user.company_id.partner_id:
if partner.id == user.company_id.partner_id.id:

View File

@ -257,7 +257,7 @@
<act_window
context="{'product_uom': locals().has_key('uom_id') and uom_id}"
domain="[('product_id', '=', active_id)]"
domain="[('procurement_id', '=', active_id)]"
id="act_procurement_2_stock_warehouse_orderpoint"
name="Minimum Stock Rules"
res_model="stock.warehouse.orderpoint"

View File

@ -59,7 +59,7 @@ class product_uom(osv.osv):
def _factor_inv_write(self, cursor, user, id, name, value, arg, context):
return self.write(cursor, user, id, {'factor': self._compute_factor_inv(value)}, context=context)
def create(self, cr, uid, data, context={}):
if 'factor_inv' in data:
if data['factor_inv'] <> 1:
@ -180,7 +180,7 @@ class product_category(osv.osv):
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of product categories."),
'type': fields.selection([('view','View'), ('normal','Normal')], 'Category Type'),
}
_defaults = {
'type' : lambda *a : 'normal',
@ -212,14 +212,18 @@ product_category()
class product_template(osv.osv):
_name = "product.template"
_description = "Product Template"
def _calc_seller_delay(self, cr, uid, ids, name, arg, context={}):
def _calc_seller(self, cr, uid, ids, fields, arg, context={}):
result = {}
for product in self.browse(cr, uid, ids, context):
for field in fields:
result[product.id] = {field:False}
result[product.id]['seller_delay'] = 1
if product.seller_ids:
partner_list = sorted([(partner_id.sequence, partner_id) for partner_id in product.seller_ids if partner_id and partner_id.sequence])
result[product.id] = partner_list and partner_list[0] and partner_list[0][1] and partner_list[0][1].delay or False
else:
result[product.id] = 1
main_supplier = partner_list and partner_list[0] and partner_list[0][1] or False
result[product.id]['seller_delay'] = main_supplier and main_supplier.delay or 1
result[product.id]['seller_qty'] = main_supplier and main_supplier.qty or 0.0
result[product.id]['seller_id'] = main_supplier and main_supplier.name.id or False
return result
_columns = {
@ -230,8 +234,8 @@ class product_template(osv.osv):
'description_sale': fields.text('Sale Description',translate=True),
'type': fields.selection([('product','Stockable Product'),('consu', 'Consumable'),('service','Service')], 'Product Type', required=True, help="Will change the way procurements are processed. Consumables are stockable products with infinite stock, or for use when you have no inventory management in the system."),
'supply_method': fields.selection([('produce','Produce'),('buy','Buy')], 'Supply method', required=True, help="Produce will generate production order or tasks, according to the product type. Purchase will trigger purchase orders when requested."),
'sale_delay': fields.float('Customer Lead Time', help="This is the average time between the confirmation of the customer order and the delivery of the finished products. It's the time you promise to your customers."),
'produce_delay': fields.float('Manufacturing Lead Time', help="Average time to produce this product. This is only for the production order and, if it is a multi-level bill of material, it's only for the level of this product. Different lead times will be summed for all levels and purchase orders."),
'sale_delay': fields.float('Customer Lead Time', help="This is the average delay in days between the confirmation of the customer order and the delivery of the finished products. It's the time you promise to your customers."),
'produce_delay': fields.float('Manufacturing Lead Time', help="Average delay in days to produce this product. This is only for the production order and, if it is a multi-level bill of material, it's only for the level of this product. Different lead times will be summed for all levels and purchase orders."),
'procure_method': fields.selection([('make_to_stock','Make to Stock'),('make_to_order','Make to Order')], 'Procurement Method', required=True, help="'Make to Stock': When needed, take from the stock or wait until re-supplying. 'Make to Order': When needed, purchase or produce for the procurement request."),
'rental': fields.boolean('Can be Rent'),
'categ_id': fields.many2one('product.category','Category', required=True, change_default=True, domain="[('type','=','normal')]" ,help="Select category for the current product"),
@ -254,7 +258,9 @@ class product_template(osv.osv):
help='Coefficient to convert UOM to UOS\n'
' uos = uom * coeff'),
'mes_type': fields.selection((('fixed', 'Fixed'), ('variable', 'Variable')), 'Measure Type', required=True),
'seller_delay': fields.function(_calc_seller_delay, method=True, type='integer', string='Supplier Lead Time', help="This is the average delay in days between the purchase order confirmation and the reception of goods for this product and for the default supplier. It is used by the scheduler to order requests based on reordering delays."),
'seller_delay': fields.function(_calc_seller, method=True, type='integer', string='Supplier Lead Time', multi="seller_delay", help="This is the average delay in days between the purchase order confirmation and the reception of goods for this product and for the default supplier. It is used by the scheduler to order requests based on reordering delays."),
'seller_qty': fields.function(_calc_seller, method=True, type='float', string='Supplier Quantity', multi="seller_qty", help="This is minimum quantity to purchase from Main Supplier."),
'seller_id': fields.function(_calc_seller, method=True, type='many2one', relation="res.partner", string='Main Supplier', help="Main Supplier who has highest priority in Supplier List.", multi="seller_id"),
'seller_ids': fields.one2many('product.supplierinfo', 'product_id', 'Partners'),
'loc_rack': fields.char('Rack', size=16),
'loc_row': fields.char('Row', size=16),
@ -616,12 +622,32 @@ product_packaging()
class product_supplierinfo(osv.osv):
_name = "product.supplierinfo"
_description = "Information about a product supplier"
def _calc_qty(self, cr, uid, ids, fields, arg, context={}):
result = {}
product_uom_pool = self.pool.get('product.uom')
for supplier_info in self.browse(cr, uid, ids, context):
for field in fields:
result[supplier_info.id] = {field:False}
if supplier_info.product_uom.id:
qty = product_uom_pool._compute_qty(cr, uid, supplier_info.product_uom.id, supplier_info.min_qty, to_uom_id=supplier_info.product_id.uom_id.id)
else:
qty = supplier_info.min_qty
result[supplier_info.id]['qty'] = qty
return result
def _get_uom_id(self, cr, uid, *args):
cr.execute('select id from product_uom order by id limit 1')
res = cr.fetchone()
return res and res[0] or False
_columns = {
'name' : fields.many2one('res.partner', 'Supplier', required=True, ondelete='cascade', help="Supplier of this product"),
'product_name': fields.char('Supplier Product Name', size=128, help="This supplier's product name will be used when printing a request for quotation. Keep empty to use the internal one."),
'product_code': fields.char('Supplier Product Code', size=64, help="This supplier's product code will be used when printing a request for quotation. Keep empty to use the internal one."),
'sequence' : fields.integer('Sequence', help="Assigns the priority to the list of product supplier."),
'qty' : fields.float('Minimal Quantity', required=True, help="The minimal quantity to purchase to this supplier, expressed in the default unit of measure."),
'product_uom': fields.many2one('product.uom', string="UOM", help="Supplier Product UoM."),
'min_qty': fields.float('Minimal Quantity', required=True, help="The minimal quantity to purchase to this supplier, expressed in the default unit of measure."),
'qty': fields.function(_calc_qty, method=True, store=True, type='float', string='Quantity', multi="qty", help="This is a quantity which is converted into Default Uom."),
'product_id' : fields.many2one('product.template', 'Product', required=True, ondelete='cascade', select=True),
'delay' : fields.integer('Delivery Lead Time', required=True, help="Lead time in days between the confirmation of the purchase order and the reception of the products in your warehouse. Used by the scheduler for automatic computation of the purchase order planning."),
'pricelist_ids': fields.one2many('pricelist.partnerinfo', 'suppinfo_id', 'Supplier Pricelist'),
@ -633,6 +659,55 @@ class product_supplierinfo(osv.osv):
'delay': lambda *a: 1,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'product.supplierinfo', context=c)
}
def _check_uom(self, cr, uid, ids):
for supplier_info in self.browse(cr, uid, ids):
if supplier_info.product_uom and supplier_info.product_uom.category_id.id <> supplier_info.product_id.uom_id.category_id.id:
return False
return True
_constraints = [
(_check_uom, 'Error: The default UOM and the Supplier Product UOM must be in the same category.', ['product_uom']),
]
def price_get(self, cr, uid, supplier_ids, product_id, product_qty=1, context=None):
"""
Calculate price from supplier pricelist.
@param supplier_ids: Ids of res.partner object.
@param product_id: Id of product.
@param product_qty: specify quantity to purchase.
"""
if not context:
context = {}
if type(supplier_ids) in (int,long,):
supplier_ids = [supplier_ids]
res = {}
product_pool = self.pool.get('product.product')
partner_pool = self.pool.get('res.partner')
pricelist_pool = self.pool.get('product.pricelist')
currency_pool = self.pool.get('res.currency')
currency_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
for supplier in partner_pool.browse(cr, uid, supplier_ids, context=context):
# Compute price from standard price of product
price = product_pool.price_get(cr, uid, [product_id], 'standard_price')[product_id]
# Compute price from Purchase pricelist of supplier
pricelist_id = supplier.property_product_pricelist_purchase.id
if pricelist_id:
price = pricelist_pool.price_get(cr, uid, [pricelist_id], product_id, product_qty).setdefault(pricelist_id, 0)
price = currency_pool.compute(cr, uid, pricelist_pool.browse(cr, uid, pricelist_id).currency_id.id, currency_id, price)
# Compute price from supplier pricelist which are in Supplier Information
supplier_info_ids = self.search(cr, uid, [('name','=',supplier.id),('product_id','=',product_id)])
if supplier_info_ids:
cr.execute('SELECT * ' \
'FROM pricelist_partnerinfo ' \
'WHERE suppinfo_id IN %s' \
'AND min_quantity <= %s ' \
'ORDER BY min_quantity DESC LIMIT 1', (tuple(supplier_info_ids),product_qty,))
res2 = cr.dictfetchone()
if res2:
price = res2['price']
res[supplier.id] = price
return res
_order = 'sequence'
product_supplierinfo()

View File

@ -356,114 +356,133 @@
<record id="supplierinfo1" model="product.supplierinfo">
<field name="name" ref="base.res_partner_asus"/>
<field name="qty">10</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_mb1"/>
<field name="delay">5</field>
</record>
<record id="supplierinfo2" model="product.supplierinfo">
<field name="name" ref="base.res_partner_asus"/>
<field name="qty">10</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_mb2"/>
<field name="delay">5</field>
</record>
<record id="supplierinfo3" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_mb1"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo4" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_mb2"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo5" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_pc1"/>
<field name="delay">2</field>
</record>
<record id="supplierinfo6" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_pc2"/>
<field name="delay">2</field>
</record>
<record id="supplierinfo7" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_pc3"/>
<field name="delay">2</field>
</record>
<record id="supplierinfo8" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_pc4"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo9" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_cpu1"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo10" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_cpu3"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo11" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_hdd1"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo12" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_hdd2"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo13" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_hdd3"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo14" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_20"/>
<field name="delay">10</field>
</record>
<record id="supplierinfo15" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_21"/>
<field name="delay">10</field>
</record>
<record id="supplierinfo16" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_22"/>
<field name="delay">10</field>
</record>
<record id="supplierinfo17" model="product.supplierinfo">
<field name="name" ref="base.res_partner_seagate"/>
<field name="qty">10</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_hdd1"/>
<field name="delay">10</field>
</record>
<record id="supplierinfo18" model="product.supplierinfo">
<field name="name" ref="base.res_partner_seagate"/>
<field name="qty">10</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_hdd2"/>
<field name="delay">10</field>
</record>
<record id="supplierinfo19" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">10</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_hdd3"/>
<field name="delay">10</field>
</record>

View File

@ -149,6 +149,8 @@
<newline/>
<field groups="base.group_extended" name="cost_method"/>
<newline/>
<field groups="base.group_extended" name="seller_id"/>
<newline/>
<field colspan="4" name="seller_ids" nolabel="1"/>
</page>
<page string="Descriptions">
@ -453,8 +455,10 @@
<field name="sequence"/>
<field name="product_name" groups="base.group_extended"/>
<field name="product_code" groups="base.group_extended"/>
<field name="delay"/>
<field name="min_qty"/>
<field name="product_uom" widget="selection"/>
<field name="qty"/>
<field name="delay"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field colspan="4" groups="base.group_extended" name="pricelist_ids" nolabel="1" widget="one2many_list">
<tree editable="bottom" string="Pricelist">

View File

@ -23,7 +23,7 @@ import time
from report import report_sxw
from osv import osv
import pooler
from tools.translate import _
class product_pricelist(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(product_pricelist, self).__init__(cr, uid, name, context=context)

View File

@ -44,18 +44,14 @@ class product_price_list(osv.osv_memory):
}
def print_report(self, cr, uid, ids, context=None):
"""
To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : return report
To get the date and print the report
@return : return report
"""
datas = {'ids': context.get('active_ids', [])}
res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5'], context)
res = res and res[0] or {}
price_dict = self.pool.get('product.pricelist').price_get(cr, uid, [res['price_list']], 1, 1.0)
datas['form'] = res
return {
'type': 'ir.actions.report.xml',

View File

@ -5,11 +5,12 @@
<!-- Product Price List -->
<record id="view_product_price_list" model="ir.ui.view">
<field name="name">Price List</field>
<field name="name">Price per unit</field>
<field name="model">product.price_list</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Price list">
<form string="Price per Unit">
<separator colspan="4" string="Calculate Product Price per unit base on pricelist version."/>
<field name="price_list" widget="selection"/>
<field name="qty1" colspan="2" />
<field name="qty2" colspan="2" />
@ -19,15 +20,17 @@
<separator colspan="4"/>
<group col="2" colspan="4">
<button icon="gtk-cancel" special="cancel" string="Close"/>
<button name="print_report" string="Print Report" type="object" icon="gtk-print"/>
<button name="print_report" string="Print" type="object" icon="gtk-print"/>
</group>
</form>
</field>
</record>
<act_window id="action_product_price_list"
key2="client_action_multi" name="Price List"
res_model="product.price_list" src_model="product.product"
key2="client_print_multi"
name="Price Per Unit"
res_model="product.price_list"
src_model="product.product"
view_mode="form" target="new" view_type="form" />
</data>

View File

@ -136,7 +136,6 @@
<menuitem
id="next_id_86"
name="Dashboard"
icon="terp-graph"
sequence="0"
parent="base.menu_project_report"/>

View File

@ -86,6 +86,6 @@
<field name="view_id" ref="board_project_issue_form"/>
</record>
<menuitem id="menu_deshboard_project_issue" name="Project Issue Dashboard" parent="project.next_id_86"
icon="terp-graph" action="open_board_project_issue"/>
action="open_board_project_issue"/>
</data>
</openerp>

View File

@ -58,6 +58,6 @@
<menuitem
id="menu_deshboard_scurm"
name="Scrum Dashboard" parent="project.next_id_86"
icon="terp-graph" action="open_board_project_scrum"/>
action="open_board_project_scrum"/>
</data>
</openerp>

View File

@ -5,7 +5,6 @@
<menuitem
id="menu_purchase_deshboard"
name="Dashboard"
icon="terp-graph"
parent="base.next_id_73" sequence="0"/>
<record id="purchase_draft" model="ir.actions.act_window">

View File

@ -305,7 +305,7 @@ class purchase_order(osv.osv):
def inv_line_create(self, cr, uid, a, ol):
return (0, False, {
'name': ol.name,
'account_id': a.id,
'account_id': a,
'price_unit': ol.price_unit or 0.0,
'quantity': ol.product_qty,
'product_id': ol.product_id.id or False,
@ -344,7 +344,7 @@ class purchase_order(osv.osv):
if not a:
raise osv.except_osv(_('Error !'), _('There is no expense account defined for this product: "%s" (id:%d)') % (ol.product_id.name, ol.product_id.id,))
else:
a = self.pool.get('ir.property').get(cr, uid, 'property_account_expense_categ', 'product.category')
a = self.pool.get('ir.property').get(cr, uid, 'property_account_expense_categ', 'product.category').id
fpos = o.fiscal_position or False
a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, a)
il.append(self.inv_line_create(cr, uid, a, ol))
@ -746,23 +746,24 @@ class procurement_order(osv.osv):
po_obj = self.pool.get('purchase.order')
for procurement in self.browse(cr, uid, ids):
res_id = procurement.move_id.id
partner = procurement.product_id.seller_ids[0].name
partner = procurement.product_id.seller_id # Taken Main Supplier of Product of Procurement.
seller_qty = procurement.product_id.seller_qty
seller_delay = int(procurement.product_id.seller_delay)
partner_id = partner.id
partner_rec = procurement.product_id.seller_ids[0]
address_id = partner_obj.address_get(cr, uid, [partner_id], ['delivery'])['delivery']
pricelist_id = partner.property_product_pricelist_purchase.id
uom_id = procurement.product_id.uom_po_id.id
qty = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id)
if procurement.product_id.seller_ids[0].qty:
qty = max(qty,partner_rec.qty)
if seller_qty:
qty = max(qty,seller_qty)
price = pricelist_obj.price_get(cr, uid, [pricelist_id], procurement.product_id.id, qty, False, {'uom': uom_id})[pricelist_id]
newdate = DateTime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S')
newdate = newdate - DateTime.RelativeDateTime(days=company.po_lead)
newdate = newdate - partner_rec.delay
newdate = newdate - seller_delay
#Passing partner_id to context for purchase order line integrity of Line name
context.update({'lang': partner.lang, 'partner_id': partner_id})

View File

@ -78,8 +78,7 @@
<field name="name" select="1"/>
<field name="manager" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company"/>
<newline/>
<field colspan="4" name="week_id" nolabel="1" widget="one2many_list"/>
<!-- <field colspan="4" name="week_id" nolabel="1" widget="one2many_list"/>-->
</form>
</field>
</record>

View File

@ -50,7 +50,7 @@
<field name="view_mode">form</field>
<field name="view_id" ref="board_sales_manager_form"/>
</record>
<menuitem icon="terp-graph" id="board.menu_dasboard" name="Dashboard" sequence="0" parent="base.next_id_64"/>
<menuitem id="board.menu_dasboard" name="Dashboard" sequence="0" parent="base.next_id_64"/>
<menuitem action="open_board_sales_manager" icon="terp-graph" id="menu_board_sales_manager" parent="board.menu_dasboard" sequence="0"/>
</data>

View File

@ -43,8 +43,8 @@
<field name="view_id" ref="board_warehouse_form"/>
</record>
<menuitem icon="terp-graph" id="menu_dashboard_stock" name="Dashboard" sequence="0" parent="stock.next_id_61"/>
<menuitem id="menu_dashboard_stock" name="Dashboard" sequence="0" parent="stock.next_id_61"/>
<menuitem action="open_board_warehouse" icon="terp-graph" id="menu_board_warehouse" parent="menu_dashboard_stock" sequence="1"/>
</data>
</openerp>
</openerp>

View File

@ -536,16 +536,7 @@ class stock_picking(osv.osv):
if ('name' not in vals) or (vals.get('name')=='/'):
seq_obj_name = 'stock.picking.' + vals['type']
vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name)
type_list = {
'out':_('Picking List'),
'in':_('Reception'),
'internal': _('Internal Picking'),
'delivery': _('Delivery Order')
}
new_id = super(stock_picking, self).create(cr, user, vals, context)
if not vals.get('auto_picking', False):
message = type_list.get(vals.get('type', False), _('Picking')) + " '" + (vals['name'] or "n/a") + _(" with origin")+" '" + (vals.get('origin') or "n/a") + "' "+ _("is created.")
self.log(cr, user, new_id, message)
return new_id
_columns = {
@ -626,6 +617,9 @@ class stock_picking(osv.osv):
for r in picking.move_lines:
if r.state == 'draft':
todo.append(r.id)
self.log_picking(cr, uid, ids, context=context)
todo = self.action_explode(cr, uid, todo, context)
if len(todo):
self.pool.get('stock.move').action_confirm(cr, uid, todo, context=context)
@ -710,16 +704,8 @@ class stock_picking(osv.osv):
""" Changes picking state to assigned.
@return: True
"""
for pick in self.browse(cr, uid, ids, context=context):
type_list = {
'out':'Picking List',
'in':'Reception',
'internal': 'Internal picking',
'delivery': 'Delivery order'
}
message = type_list.get(pick.type, _('Document')) + " '" + (pick.name or 'n/a') + "' "+ _("is ready to be processed.")
self.log(cr, uid, id, message)
self.write(cr, uid, ids, {'state': 'assigned'})
self.log_picking(cr, uid, ids, context=context)
return True
def test_finnished(self, cr, uid, ids):
@ -758,8 +744,7 @@ class stock_picking(osv.osv):
ids2 = [move.id for move in pick.move_lines]
self.pool.get('stock.move').action_cancel(cr, uid, ids2, context)
self.write(cr, uid, ids, {'state': 'cancel', 'invoice_state': 'none'})
message = _('Picking') + " '" + pick.name + "' "+_("is cancelled")
self.log(cr, uid, id, message)
self.log_picking(cr, uid, ids, context=context)
return True
#
@ -1190,6 +1175,31 @@ class stock_picking(osv.osv):
return res
def log_picking(self, cr, uid, ids, context=None):
""" This function will create log messages for picking.
@param cr: the database cursor
@param uid: the current user's ID for security checks,
@param ids: List of Picking Ids
@param context: A standard dictionary for contextual values
"""
for pick in self.browse(cr, uid, ids, context=context):
type_list = {
'out':'Picking List',
'in':'Reception',
'internal': 'Internal picking',
'delivery': 'Delivery order'
}
message = type_list.get(pick.type, _('Document')) + " '" + (pick.name or 'n/a') + "' "
state_list = {
'confirmed': "is scheduled for the '" + datetime.strptime(pick.min_date, '%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d') + "'.",
'assigned': 'is ready to process.',
'cancel': 'is Cancelled.',
'done': 'is processed.',
}
message += state_list[pick.state]
self.log(cr, uid, pick.id, message)
return True
stock_picking()
class stock_production_lot(osv.osv):
@ -1844,8 +1854,6 @@ class stock_move(osv.osv):
'ref': move.picking_id and move.picking_id.name,
})
message = _('Move line') + " '" + move.name + "' "+ _("is processed.")
self.log(cr, uid, move.id, message)
# This can be removed
#tracking_lot = False
#if context:
@ -1865,9 +1873,7 @@ class stock_move(osv.osv):
for pick_id in picking_ids:
wf_service.trg_write(uid, 'stock.picking', pick_id, cr)
for (id,name) in picking_obj.name_get(cr, uid, picking_ids):
message = _('Document') + " '" + name + "' "+ _("is processed.")
self.log(cr, uid, id, message)
picking_obj.log_picking(cr, uid, picking_ids, context=context)
return True
def create_account_move(self, cr, uid, move,account_id, account_variation, amount, context=None):
@ -1940,8 +1946,11 @@ class stock_move(osv.osv):
new_move = self.copy(cr, uid, move.id, default_val)
#self.write(cr, uid, [new_move], {'move_history_ids':[(4,move.id)]}) #TODO : to track scrap moves
res += [new_move]
message = _('Product ') + " '" + move.product_id.name + "' "+ _("is scraped with") + " '" + str(move.product_qty) + "' "+ _("quantity.")
product_obj = self.pool.get('product.product')
for (id, name) in product_obj.name_get(cr, uid, [move.product_id.id]):
message = _('Product ') + " '" + name + "' "+ _("is scraped with") + " '" + str(move.product_qty) + "' "+ _("quantity.")
self.log(cr, uid, move.id, message)
self.action_done(cr, uid, res)
return res
@ -2068,8 +2077,12 @@ class stock_move(osv.osv):
}
self.write(cr, uid, [move.id], update_val)
message = _('Product ') + " '" + move.product_id.name + "' "+ _("is consumed with") + " '" + str(move.product_qty) + "' "+ _("quantity.")
self.log(cr, uid, move.id, message)
product_obj = self.pool.get('product.product')
for new_move in self.browse(cr, uid, res, context=context):
for (id, name) in product_obj.name_get(cr, uid, [new_move.product_id.id]):
message = _('Product ') + " '" + name + "' "+ _("is consumed with") + " '" + str(new_move.product_qty) + "' "+ _("quantity.")
self.log(cr, uid, new_move.id, message)
self.action_done(cr, uid, res)
return res

View File

@ -896,7 +896,6 @@
<newline/>
<field name="date_done"/>
<field name="move_type"/>
<field name="sale_id"/>
</page>
</notebook>
</form>