[MERGE] Merge with trunk addons

bzr revid: mra@mra-laptop-20100709112422-sbxv9xccly0f7pts
This commit is contained in:
Mustufa Rangwala 2010-07-09 16:54:22 +05:30
commit 4f61f9c3e5
30 changed files with 284 additions and 101 deletions

View File

@ -159,7 +159,7 @@ class account_bank_statement(osv.osv):
'period_id': _get_period,
}
def button_confirm(self, cr, uid, ids, context={}):
def button_confirm_bank(self, cr, uid, ids, context={}):
done = []
res_currency_obj = self.pool.get('res.currency')
res_users_obj = self.pool.get('res.users')

View File

@ -67,19 +67,25 @@ class account_cash_statement(osv.osv):
_inherit = 'account.bank.statement'
def _get_starting_balance(self, cr, uid, ids, name, arg, context=None):
def _get_starting_balance(self, cr, uid, ids, context=None):
""" Find starting balance "
""" Find starting balance
@param name: Names of fields.
@param arg: User defined arguments
@return: Dictionary of values.
"""
"""
res ={}
for statement in self.browse(cr, uid, ids):
amount_total=0.0
if statement.journal_id.type not in('cash'):
continue
for line in statement.starting_details_ids:
amount_total+= line.pieces * line.number
res[statement.id]=amount_total
res[statement.id] = {
'balance_start':amount_total
}
return res
def _balance_end_cash(self, cr, uid, ids, name, arg, context=None):
@ -116,7 +122,7 @@ class account_cash_statement(osv.osv):
""" To get default journal for the object"
@param name: Names of fields.
@return: journal
"""
"""
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
journal = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', company_id)])
if journal:
@ -166,11 +172,10 @@ class account_cash_statement(osv.osv):
company_id = company_pool.search(cr, uid, [])[0]
return company_id
_columns = {
'company_id':fields.many2one('res.company', 'Company', required=False),
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
'balance_start': fields.function(_get_starting_balance, store=True, method=True, string='Opening Balance', type='float',digits=(16,2), help="Opening balance based on cashBox"),
'balance_end_real': fields.float('Closing Balance', digits=(16,2), states={'confirm':[('readonly', True)]}, help="closing balance entered by the cashbox verifier"),
'state': fields.selection(
[('draft', 'Draft'),
@ -178,7 +183,7 @@ class account_cash_statement(osv.osv):
('open','Open')], 'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"),
'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, store=True, string="Cash Transaction", help="Total cash transactions"),
'closing_date':fields.datetime("Closed On"),
'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on transactions"),
'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on Opening Balance and Transactions"),
'balance_end_cash': fields.function(_balance_end_cash, method=True, store=True, string='Balance', help="Closing balance based on cashBox"),
'starting_details_ids': fields.one2many('account.cashbox.line', 'starting_id', string='Opening Cashbox'),
'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing Cashbox'),
@ -205,8 +210,31 @@ class account_cash_statement(osv.osv):
for i in starting_details_ids:
if i and i[0] and i[1]:
i[0], i[1] = 0, 0
res = super(account_cash_statement, self).create(cr, uid, vals, context=context)
return res
res_id = super(account_cash_statement, self).create(cr, uid, vals, context=context)
res = self._get_starting_balance(cr, uid, [res_id])
for rs in res:
super(account_cash_statement, self).write(cr, uid, rs, res.get(rs))
return res_id
def write(self, cr, uid, ids, vals, context=None):
"""
Update redord(s) comes in {ids}, with new value comes as {vals}
return True on success, False otherwise
@param cr: cursor to database
@param user: id of current user
@param ids: list of record ids to be update
@param vals: dict of new values to be set
@param context: context arguments, like lang, time zone
@return: True on success, False otherwise
"""
super(account_cash_statement, self).write(cr, uid, ids, vals)
res = self._get_starting_balance(cr, uid, ids)
for rs in res:
super(account_cash_statement, self).write(cr, uid, rs, res.get(rs))
return True
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context={}):
""" Changes balance start and starting details if journal_id changes"
@ -285,7 +313,7 @@ class account_cash_statement(osv.osv):
self.write(cr, uid, ids, vals)
return True
def button_confirm(self, cr, uid, ids, context={}):
def button_confirm_cash(self, cr, uid, ids, context={}):
""" Check the starting and ending detail of statement
@return: True
@ -296,20 +324,24 @@ class account_cash_statement(osv.osv):
account_move_obj = self.pool.get('account.move')
account_move_line_obj = self.pool.get('account.move.line')
account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
company_currency_id = res_users_obj.browse(cr, uid, uid, context=context).company_id.currency_id.id
for st in self.browse(cr, uid, ids, context):
self.write(cr, uid, [st.id], {'balance_end_real':st.balance_end})
st.balance_end_real = st.balance_end
if not st.state == 'open':
continue
if not self._equal_balance(cr, uid, ids, st, context):
raise osv.except_osv(_('Error !'), _('Cash balance is not matching with closing balance !'))
if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
raise osv.except_osv(_('Error !'),
_('The statement balance is incorrect !\n') +
_('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end))
raise osv.except_osv(_('Error !'), _('CashBox Balance is not matching with Calculated Balance !'))
# if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
# raise osv.except_osv(_('Error !'),
# _('The statement balance is incorrect !\n') +
# _('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end))
if (not st.journal_id.default_credit_account_id) \
or (not st.journal_id.default_debit_account_id):
raise osv.except_osv(_('Configuration Error !'),
@ -435,7 +467,7 @@ class account_cash_statement(osv.osv):
if move.reconcile_id and move.reconcile_id.line_ids:
torec += map(lambda x: x.id, move.reconcile_id.line_ids)
#try:
if abs(move.reconcile_amount-move.amount)<0.0001:
writeoff_acc_id = False
@ -447,13 +479,16 @@ class account_cash_statement(osv.osv):
account_move_line_obj.reconcile(cr, uid, torec, 'statement', writeoff_acc_id=writeoff_acc_id, writeoff_period_id=st.period_id.id, writeoff_journal_id=st.journal_id.id, context=context)
else:
account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context)
#except:
# raise osv.except_osv(_('Error !'), _('Unable to reconcile entry "%s": %.2f') % (move.name, move.amount))
if st.journal_id.entry_posted:
account_move_obj.write(cr, uid, [move_id], {'state':'posted'})
done.append(st.id)
self.write(cr, uid, done, {'state':'confirm'}, context=context)
vals = {
'state':'confirm',
'closing_date':time.strftime("%Y-%m-%d %H:%M:%S")
}
self.write(cr, uid, done, vals, context=context)
return True
def button_cancel(self, cr, uid, ids, context={}):

View File

@ -427,6 +427,9 @@
<field name="balance_end_real"/>
<field name="balance_end"/>
<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_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>
</record>
@ -465,7 +468,7 @@
<field name="journal_id" on_change="onchange_journal_id(journal_id)" select="1"/>
<field name="period_id"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<field name="balance_end_real"/>
</group>
<notebook colspan="4">
<page string="Transaction">
@ -505,7 +508,7 @@
<field name="state"/>
<field name="balance_end"/>
<button name="button_dummy" states="draft" string="Compute" icon="terp-stock_format-scientific"/>
<button name="button_confirm" states="draft" string="Confirm" type="object" icon="terp-camera_test"/>
<button name="button_confirm_bank" states="draft" string="Confirm" type="object" icon="terp-camera_test"/>
<button name="button_cancel" states="confirm" string="Cancel" type="object" icon="terp-gtk-stop"/>
</group>
</form>
@ -518,6 +521,18 @@
<field name="view_mode">tree,form</field>
<field name="domain">[('journal_id.type', '=', 'bank')]</field>
</record>
<record model="ir.actions.act_window.view" id="action_bank_statement_tree_bank">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_bank_statement_tree"/>
<field name="act_window_id" ref="action_bank_statement_tree"/>
</record>
<record model="ir.actions.act_window.view" id="action_bank_statement_form_bank">
<field name="sequence" eval="1"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_bank_statement_form"/>
<field name="act_window_id" ref="action_bank_statement_tree"/>
</record>
<menuitem string="Bank Statements" action="action_bank_statement_tree" id="menu_bank_statement_tree" parent="menu_finance_bank_and_cash" sequence="7"/>
<record id="action_bank_statement_draft_tree" model="ir.actions.act_window">
@ -2267,7 +2282,7 @@
<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" states="open" icon="terp-gtk-go-back-rtl"/>
<button type="object" string="Confirm" name="button_confirm_cash" states="open" icon="terp-gtk-go-back-rtl"/>
<button type="object" string="Cancel" name="button_cancel" states="confirm" icon="terp-gtk-stop"/>
</tree>
</field>
@ -2285,7 +2300,7 @@
<field name="journal_id" on_change="onchange_journal_id(journal_id)" domain="[('type','=','cash')]" select="1" />
<field name="user_id" select="1" readonly="1"/>
<field name="period_id" select="1"/>
<field name="balance_end_real"/>
<!-- <field name="balance_end_real"/>-->
</group>
<notebook colspan="4">
@ -2318,7 +2333,7 @@
</form>
</field>
</page>
<page string="Cash Box">
<page string="CashBox">
<group col="2" colspan="2" expand="1">
<field name="starting_details_ids" nolabel="1" colspan="2" attrs="{'readonly':[('state','=','draft')]}">
<tree string = "Opening Balance" editable="bottom">
@ -2349,7 +2364,7 @@
</group>
</page>
<page string="Accounting Entries" attrs="{'invisible': [('state','!=','confirm')]}">
<field colspan="4" name="move_line_ids" nolabel="1"/>
<field colspan="4" name="move_line_ids" nolabel="1" string="Accounting Entries"/>
</page>
</notebook>
<group col="6" colspan="4">
@ -2360,18 +2375,18 @@
</group>
<group col="2" colspan="2">
<separator string="Opening Balance" colspan="4"/>
<field name="balance_start"/>
<field name="balance_start" readonly="1" string="Opening Balance"/>
<field name="total_entry_encoding"/>
</group>
<group col="2" colspan="2">
<separator string="Closing Balance" colspan="4"/>
<field name="balance_end" string="Approx"/>
<field name="balance_end_cash" string="Cash Balance"/>
<field name="balance_end" string="Calculated Balance"/>
<field name="balance_end_cash" string="CashBox Balance"/>
</group>
</group>
<group col="8" colspan="4">
<field name="state" colspan="4"/>
<button name="button_confirm" states="open" string="Close CashBox" icon="terp-check" type="object"/>
<button name="button_confirm_cash" states="open" string="Close CashBox" icon="terp-check" type="object"/>
<button name="button_open" states="draft" string="Open CashBox" icon="terp-document-new" type="object"/>
<button name="button_cancel" states="confirm,open" string="Cancel" icon="terp-gtk-stop" type="object" groups="base.group_extended"/>
</group>

View File

@ -1,16 +1,17 @@
<?xml version="1.0"?>
<openerp>
<data>
<record id="view_account_journal_form_inherit" model="ir.ui.view">
<record id="view_account_journal_form_inherit" model="ir.ui.view">
<field name="name">account.journal.form</field>
<field name="model">account.journal</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page[@string='General Information']/group/group/field[@name='centralisation']" position="after">
<field name="entry_posted" position="after">
<!-- <xpath expr="/form/notebook/page[@string='General Information']/group/group/field[@name='centralisation']" position="after">-->
<field name="update_posted"/>
</xpath>
</field>
</field>
</record>
</data>
</openerp>
</record>
</data>
</openerp>

View File

@ -49,7 +49,7 @@ class account_voucher_unreconcile(osv.osv_memory):
recs = [line.reconcile_id.id]
for rec in recs:
obj_reconcile.unlink(cr, uid, rec)
reconcile_pool.unlink(cr, uid, rec)
if res.remove:
wf_service = netsvc.LocalService("workflow")

View File

@ -378,6 +378,7 @@ property or property parameter."),
}
_defaults = {
'state': 'needs-action',
'user_id': lambda self, cr, uid, ctx: uid,
}
def copy(self, cr, uid, id, default=None, context=None):

View File

@ -103,7 +103,7 @@
separator="1" help="Declined Invitations" />
<separator orientation="vertical"/>
<field name="email" select='1'/>
<field name="sent_by_uid" select="1"/>
<field name="user_id" select="1"/>
<separator orientation="vertical"/>
<field name="cutype" string="Invitation type" select="1"/>
<field name="event_date" select="1"/>

View File

@ -268,12 +268,13 @@ class crm_case(object):
"""
cases = self.browse(cr, uid, ids)
for case in cases:
data = {'active': True, 'user_id': False}
data = {'active': True}
if case.section_id.parent_id:
data['section_id'] = case.section_id.parent_id.id
if case.section_id.parent_id.user_id:
data['user_id'] = case.section_id.parent_id.user_id.id
if case.section_id.parent_id.change_responsible:
if case.section_id.parent_id.user_id:
data['user_id'] = case.section_id.parent_id.user_id.id
else:
raise osv.except_osv(_('Error !'), _('You can not escalate, You are already at the top level regarding your sales-team category.'))
self.write(cr, uid, [case.id], data)
@ -439,6 +440,7 @@ class crm_case_section(osv.osv):
'active': fields.boolean('Active', help="If the active field is set to \
true, it will allow you to hide the sales team without removing it."),
'allow_unlink': fields.boolean('Allow Delete', help="Allows to delete non draft cases"),
'change_responsible': fields.boolean('Change Responsible', help="Set responsible of this Sales team on escalation to this team"),
'user_id': fields.many2one('res.users', 'Responsible User'),
'member_ids':fields.many2many('res.users', 'sale_member_rel', 'section_id', 'member_id', 'Team Members'),
'reply_to': fields.char('Reply-To', size=64, help="The email address put \

View File

@ -80,7 +80,8 @@ class crm_meeting(osv.osv, crm_case):
_defaults = {
'state': lambda *a: 'draft',
'active': lambda *a: 1,
'active': lambda *a: 1,
'user_id': lambda self, cr, uid, ctx: uid,
}
def open_meeting(self, cr, uid, ids, context=None):

View File

@ -105,7 +105,7 @@
<field name="view_mode">tree,form</field>
<field name="view_id" ref="base_calendar.base_calendar_attendee_tree_view" />
<field name="domain">[('ref','like','crm.meeting,')]</field>
<field name="context">{'default_sent_by_uid': uid}</field>
<field name="context">{"search_default_user_id":uid}</field>
</record>
<menuitem id="menu_attendee_invitations"

View File

@ -43,6 +43,7 @@
<group col="2" colspan="1">
<separator string="Configuration" colspan="2"/>
<field name="allow_unlink" select="2"/>
<field name="change_responsible"/>
</group>
<separator string="Team Members" colspan="4"/>
<field name="member_ids" nolabel="1" colspan="4"/>

View File

@ -9,6 +9,7 @@
"access_document_directory_content_type_group_system","document.directory.content.type group system","model_document_directory_content_type","base.group_user",1,0,0,0
"access_document_storage_group_document_manager","document.storage document manager","model_document_storage","group_document_manager",1,1,1,1
"access_document_storage_group_system","document.storage group system","model_document_storage","base.group_user",1,0,0,0
"access_document_directory_dctx_all","document.directory.dctx all","model_document_directory_dctx",,1,0,0,0
"access_document_directory_dctx_group_document_manager","document.directory.dctx document manager","model_document_directory_dctx","group_document_manager",1,1,1,1
"access_document_directory_dctx_group_system","document.directory.dctx group system","model_document_directory_dctx","base.group_system",1,1,1,1
"access_report_document_user_group_document_manager","report.document.user document manager","model_report_document_user","document.group_document_manager",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
9 access_document_directory_content_type_group_system document.directory.content.type group system model_document_directory_content_type base.group_user 1 0 0 0
10 access_document_storage_group_document_manager document.storage document manager model_document_storage group_document_manager 1 1 1 1
11 access_document_storage_group_system document.storage group system model_document_storage base.group_user 1 0 0 0
12 access_document_directory_dctx_all document.directory.dctx all model_document_directory_dctx 1 0 0 0
13 access_document_directory_dctx_group_document_manager document.directory.dctx document manager model_document_directory_dctx group_document_manager 1 1 1 1
14 access_document_directory_dctx_group_system document.directory.dctx group system model_document_directory_dctx base.group_system 1 1 1 1
15 access_report_document_user_group_document_manager report.document.user document manager model_report_document_user document.group_document_manager 1 0 0 0

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,12 +15,13 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import event
import wizard
import report
import res_partner
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -53,6 +53,7 @@
'wizard/event_make_invoice_view.xml',
'wizard/partner_event_registration_view.xml',
'board_association_view.xml',
'res_partner_view.xml',
],
'demo_xml': ['event_demo.xml', 'board_association_demo.xml'],
'test': ['test/test_event.yml'],

View File

@ -176,11 +176,13 @@ class event_event(osv.osv):
'note': fields.text('Notes', help="Description or Summary of Event"),
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
"unit_price": fields.float('Cost'),
'partner_id': fields.many2one('res.partner','Teacher'),
'main_speaker_id': fields.many2one('res.partner','Main Speaker'),
'speaker_ids':fields.many2many('res.partner', 'event_speaker_rel', 'speaker_id', 'partner_id', 'Other Speakers'),
'address_id': fields.many2one('res.partner.address','Location Room'),
'teacher_confirmed': fields.boolean('Teacher Confirmed'),
'speaker_confirmed': fields.boolean('Speaker Confirmed'),
'country_id': fields.related('address_id', 'country_id',
type='many2one', relation='res.country', string='Country'),
'language': fields.char('Language',size=64),
}

View File

@ -57,18 +57,20 @@
<page string="General">
<field name="unit_price"/>
<field name="currency_id"/>
<separator string="Teacher Information" colspan="4"/>
<field name="partner_id"/>
<separator string="Speaker Information" colspan="4"/>
<field name="main_speaker_id" domain="[('speaker','=',True)]"/>
<field name="address_id"/>
<field name="teacher_confirmed"/>
<field name="speaker_ids" domain="[('speaker','=',True)]" colspan="4"/>
<field name="country_id" />
<field name="speaker_confirmed"/>
<field name="language"/>
<separator string="Event description" colspan="4"/>
<field name="parent_id" domain="[('parent_id','child_of','Event')]"/>
<field name="active"/>
<field name="register_min"/>
<field name="register_max"/>
<separator string="Notes" colspan="4"/>
<field name="note" colspan="4" nolabel="1"/>
<!--field name="note" colspan="4" nolabel="1"/-->
<field name="state" select="1"/>
<group col="4" colspan="2">
<button string="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/>
@ -120,9 +122,11 @@
<field name="arch" type="xml">
<tree string="Events" colors="red:register_min>register_current;black:register_min&lt;=register_current">
<field name="name" string="Name"/>
<field name="user_id"/>
<field name="main_speaker_id"/>
<field name="language"/>
<field name="type"/>
<field name="date_begin"/>
<field name="date_end"/>
<field name="register_min"/>
<field name="register_current"/>
<field name="state"/>

View File

@ -43,6 +43,7 @@ class report_event_registration(osv.osv):
'type': fields.many2one('event.type', 'Event Type'),
'state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, required=True),
'user_id':fields.many2one('res.users', 'Responsible', readonly=True),
'speaker_id':fields.many2one('res.partner', 'Speaker', readonly=True),
}
_order = 'date desc'
def init(self, cr):
@ -57,6 +58,7 @@ class report_event_registration(osv.osv):
c.event_id as event_id,
e.date_begin as date,
e.user_id as user_id,
e.main_speaker_id as speaker_id,
to_char(e.date_begin, 'YYYY') as year,
to_char(e.date_begin, 'MM') as month,
to_char(e.date_begin, 'YYYY-MM-DD') as day,
@ -75,7 +77,7 @@ class report_event_registration(osv.osv):
group by
to_char(e.date_begin, 'YYYY'),
to_char(e.date_begin, 'MM'),
t.id, e.id, e.date_begin,
t.id, e.id, e.date_begin,e.main_speaker_id,
e.register_max, e.type, e.state, c.event_id, e.user_id,
to_char(e.date_begin, 'YYYY-MM-DD')
)""")

View File

@ -10,6 +10,7 @@
<tree string="Event on Registration">
<field name="date" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="speaker_id" invisible="1"/>
<field name="year" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
@ -85,7 +86,8 @@
<separator orientation="vertical"/>
<filter string="state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Responsible" name="user" icon="terp-personal" context="{'group_by': 'user_id'}"/>
<filter string="Speaker" name="user" icon="terp-personal+" context="{'group_by': 'speaker_id'}"/>
<!--filter string="Responsible" name="user" icon="terp-personal" context="{'group_by': 'user_id'}"/-->
<separator orientation="vertical" />
<filter string="Day" icon="terp-go-month"
domain="[]" context="{'group_by':'day'}"/>

View File

@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields,osv
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
'speaker': fields.boolean('Speaker'),
'event_ids': fields.one2many('event.event','main_speaker_id',readonly=True),
'event_registration_ids': fields.one2many('event.registration','partner_id',readonly=True),
}
res_partner()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,44 @@
<?xml version="1.0"?>
<openerp>
<data>
<!-- Partners inherited form -->
<record id="view_speaker_partner_info_form" model="ir.ui.view">
<field name="name">res.partner.speaker.info.inherit</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="supplier" position="after">
<field name="speaker"/>
</field>
</field>
</record>
<record id="view_event_partner_info_form" model="ir.ui.view">
<field name="name">res.partner.event.info.inherit</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="History" position="inside">
<field name="event_ids" colspan="4" nolabel="1">
<tree string="Events">
<field name="name" string="Event"/>
<field name="main_speaker_id"/>
</tree>
</field>
<field name="event_registration_ids" colspan="4" nolabel="1">
<tree string="Events Registration">
<field name="event_id" />
<field name="partner_id"/>
<field name="unit_price"/>
</tree>
</field>
</page>
</field>
</record>
</data>
</openerp>

View File

@ -158,9 +158,9 @@ class mailgate_message(osv.osv):
'user_id': fields.many2one('res.users', 'User Responsible', readonly=True),
'message': fields.text('Description'),
'email_from': fields.char('From', size=128, help="Email From"),
'email_to': fields.text('To', help="Email Recipients"),
'email_cc': fields.text('Cc', help="Carbon Copy Email Recipients"),
'email_bcc': fields.text('Bcc', help='Blind Carbon Copy Email Recipients'),
'email_to': fields.char('To', help="Email Recipients", size=256),
'email_cc': fields.char('Cc', help="Carbon Copy Email Recipients", size=256),
'email_bcc': fields.char('Bcc', help='Blind Carbon Copy Email Recipients', size=256),
'message_id': fields.char('Message Id', size=1024, readonly=True, help="Message Id on Email.", select=True),
'references': fields.text('References', readonly=True, help="References emails."),
'description': fields.text('Description'),

View File

@ -159,7 +159,7 @@ class project_issue(osv.osv, crm.crm_case):
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'email_from': fields.char('Email', size=128, help="These people will receive email."),
'email_cc': fields.text('Watchers Emails', size=252, help="These people\
'email_cc': fields.char('Watchers Emails', size=256, help="These people\
will receive a copy of the future" \
" communication between partner and users by email"),
'date_open': fields.datetime('Opened', readonly=True),

View File

@ -36,9 +36,7 @@
'author': 'Tiny',
'website': 'http://www.openerp.com',
'depends': ['base', 'account', 'stock', 'process', 'procurement'],
'init_xml': [],
'update_xml': [
'data': [
'security/purchase_security.xml',
'security/ir.model.access.csv',
'purchase_workflow.xml',
@ -60,8 +58,9 @@
'test/purchase_from_order.yml',
'test/purchase_from_manual.yml',
# 'test/purchase_from_picking.yml',
'purchase_unit_test.xml'
],
'demo_xml': ['purchase_demo.xml','purchase_unit_test.xml'],
'demo': ['purchase_demo.xml'],
'installable': True,
'active': False,
'certificate': '0057234283549',

View File

@ -720,7 +720,7 @@ purchase_order_line()
class procurement_order(osv.osv):
_inherit = 'procurement.order'
_columns = {
'purchase_id': fields.many2one('purchase.order', 'Latest Requisition'),
'purchase_id': fields.many2one('purchase.order', 'Purchase Order'),
}
def action_po_assign(self, cr, uid, ids, context={}):

View File

@ -54,14 +54,14 @@ class purchase_report(osv.osv):
'validator' : fields.many2one('res.users', 'Validated By', readonly=True),
'company_id':fields.many2one('res.company', 'Company', readonly=True),
'user_id':fields.many2one('res.users', 'Responsible', readonly=True),
'delay':fields.float('Days to Validate', digits=(16,2), readonly=True, group_operator="avg"),
'delay_pass':fields.float('Days to Deliver', digits=(16,2), readonly=True, group_operator="avg"),
'delay':fields.float('Days to Validate', digits=(16,2), readonly=True),
'delay_pass':fields.float('Days to Deliver', digits=(16,2), readonly=True),
'quantity': fields.float('# of Products', readonly=True),
'price_total': fields.float('Total Price', readonly=True),
'price_average': fields.float('Unit Price', readonly=True, group_operator="avg"),
'price_average': fields.float('Average Price', readonly=True, group_operator="avg"),
'negociation': fields.float('Purchase-Standard Price', readonly=True, group_operator="avg"),
'price_standard': fields.float('Products Value', readonly=True, group_operator="sum"),
'nbr': fields.integer('# of PO Lines', readonly=True),
'nbr': fields.integer('# of Lines', 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),

View File

@ -33,14 +33,14 @@
<field name="company_id" invisible="1"/>
<field name="state" invisible="1"/>
<field name="location_id" invisible="1"/>
<field name="nbr"/>
<field name="nbr" sum="# of Lines"/>
<field name="quantity" sum="# of Products"/>
<field name="price_average" avg="Average Price"/>
<field name="price_average" sum="Average Price"/>
<field name="price_total" sum="Total Price"/>
<field name="price_standard" sum="Products Costs"/>
<field name="price_standard" sum="Products Value"/>
<field name="negociation" widget="progressbar"/>
<field name="delay"/>
<field name="delay_pass"/>
<field name="delay" sum="Days to Validate"/>
<field name="delay_pass" sum="Days to Deliver"/>
</tree>
</field>
</record>
@ -142,10 +142,11 @@
<record id="action_purchase_order_report_all" model="ir.actions.act_window">
<field name="name">Purchase Orders</field>
<field name="name">Purchase Analysis</field>
<field name="res_model">purchase.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="view_id" ref="view_purchase_order_tree"></field>
<field name="context">{'search_default_month':1,'search_default_group_partner_id':1,'search_default_group_product_id': 1, 'search_default_orders': 1, 'group_by_no_leaf':1,'group_by':[]}</field>
</record>

View File

@ -155,14 +155,17 @@ product_product()
class procurement_order(osv.osv):
_inherit = 'procurement.order'
_columns = {
'requisition_id' : fields.many2one('purchase.requisition','Latest Requisition')
}
def make_po(self, cr, uid, ids, context=None):
sequence_obj = self.pool.get('ir.sequence')
res = super(procurement_order, self).make_po(cr, uid, ids, context=context)
for proc_id, po_id in res.items():
procurement = self.browse(cr, uid, proc_id)
requisition_id=False
if procurement.product_id.purchase_requisition:
self.pool.get('purchase.requisition').create(cr, uid, {
requisition_id=self.pool.get('purchase.requisition').create(cr, uid, {
'name': sequence_obj.get(cr, uid, 'purchase.order.requisition'),
'origin': procurement.name,
'date_end': procurement.date_planned,
@ -174,6 +177,7 @@ class procurement_order(osv.osv):
})],
'purchase_ids': [(6,0,[po_id])]
})
self.write(cr,uid,proc_id,{'requisition_id':requisition_id})
return res
procurement_order()

View File

@ -168,6 +168,17 @@
</field>
</field>
</record>
<record model="ir.ui.view" id="procurement_normal_form_view_inherit">
<field name="name">procurement.form.inherit</field>
<field name="type">form</field>
<field name="model">procurement.order</field>
<field name="inherit_id" ref="procurement.procurement_form_view"/>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page/field[@name='close_move']" position="after">
<field name="requisition_id"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -74,7 +74,7 @@ class sale_report(osv.osv):
tools.drop_view_if_exists(cr, 'sale_report')
cr.execute("""
create or replace view sale_report as (
select el.*,
select el.*,
-- (select count(1) from sale_order_line where order_id = s.id) as nbr,
(select 1) as nbr,
s.date_order as date,
@ -86,28 +86,46 @@ class sale_report(osv.osv):
s.user_id as user_id,
s.shop_id as shop_id,
s.company_id as company_id,
extract(epoch from (s.date_confirm-s.create_date))/(24*60*60)::decimal(16,2) as delay,
extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay,
s.state,
s.shipped,
s.shipped::integer as shipped_qty_1,
s.pricelist_id as pricelist_id,
s.project_id as analytic_account_id
from
sale_order s,
(
select l.id as id,
l.product_id as product_id,
u.name as uom_name,
sum(l.product_uom_qty * u.factor) as product_uom_qty,
sum(l.product_uom_qty*l.price_unit) as price_total,
(sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty * u.factor)*count(l.product_id))::decimal(16,2) as price_average,
pt.categ_id, l.order_id
from
sale_order_line l
left join product_uom u on (u.id=l.product_uom)
left join product_template pt on (pt.id=l.product_id)
group by l.id, l.order_id, l.product_id, u.name, pt.categ_id) el
where s.id = el.order_id
from
sale_order s,
(
select l.id as id,
l.product_id as product_id,
u.name as uom_name,
sum(l.product_uom_qty * u.factor) as product_uom_qty,
sum(l.product_uom_qty*l.price_unit) as price_total,
(sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty * u.factor)*count(l.product_id))::decimal(16,2) as price_average,
pt.categ_id, l.order_id
from
sale_order_line l
left join product_uom u on (u.id=l.product_uom)
left join product_template pt on (pt.id=l.product_id)
group by l.id, l.order_id, l.product_id, u.name, pt.categ_id) el
where s.id = el.order_id
group by el.id,
el.product_id,
el.uom_name,
el.product_uom_qty,
el.price_total,
el.price_average,
el.categ_id,
el.order_id,
s.date_order,
s.date_confirm,
s.partner_id,
s.user_id,
s.shop_id,
s.company_id,
s.state,
s.shipped,
s.pricelist_id,
s.project_id
)
""")
sale_report()

View File

@ -20,11 +20,11 @@
<field name="categ_id" invisible="1"/>
<field name="nbr" sum="# of Lines"/>
<field name="product_uom_qty" sum="# of Qty"/>
<field name="shipped_qty_1"/>
<field name="uom_name" invisible="context.get('set_visible',False)"/>
<field name="price_average" avg="Average Price"/>
<field name="shipped_qty_1" sum="Shipped Qty"/>
<field name="uom_name" invisible="not context.get('set_visible',False)"/>
<field name="price_average" sum="Average Price"/>
<field name="price_total" sum="Total Price"/>
<field name="delay" avg="Commitment Delay"/>
<field name="delay" sum="Commitment Delay"/>
<field name="state" invisible="1"/>
<field name="analytic_account_id" invisible="1"/>
</tree>
@ -122,6 +122,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="search_view_id" ref="view_order_product_search"/>
<field name="view_id" ref="view_order_product_tree"/>
<field name="context">{'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}</field>
</record>