[MERGE] Merge from main addons

bzr revid: mra@tinyerp.com-20120831042339-golr9r257rq8e5u6
This commit is contained in:
Mustufa Rangwala (OpenERP) 2012-08-31 09:53:39 +05:30
commit 268a8a038c
38 changed files with 253 additions and 629 deletions

View File

@ -746,9 +746,11 @@ class account_journal(osv.osv):
'profit_account_id' : fields.many2one('account.account', 'Profit Account'),
'loss_account_id' : fields.many2one('account.account', 'Loss Account'),
'internal_account_id' : fields.many2one('account.account', 'Internal Transfers Account', select=1),
'cash_control' : fields.boolean('Cash Control', help='If you want the journal should be control at opening/closing, check this option'),
}
_defaults = {
'cash_control' : False,
'with_last_closing_balance' : False,
'user_id': lambda self, cr, uid, context: uid,
'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,

View File

@ -194,12 +194,27 @@ class account_cash_statement(osv.osv):
journal = self.pool.get('account.journal').browse(cr, uid, vals['journal_id'], context=context)
if journal and (journal.type == 'cash') and not vals.get('details_ids'):
vals['details_ids'] = []
last_pieces = None
if journal.with_last_closing_balance == True:
domain = [('journal_id', '=', journal.id),
('state', '=', 'confirm')]
last_bank_statement_ids = self.search(cr, uid, domain, limit=1, order='create_date desc', context=context)
if last_bank_statement_ids:
last_bank_statement = self.browse(cr, uid, last_bank_statement_ids[0], context=context)
last_pieces = dict(
(line.pieces, line.number_closing) for line in last_bank_statement.details_ids
)
for value in journal.cashbox_line_ids:
nested_values = {
'number_closing' : 0,
'number_opening' : 0,
'number_opening' : last_pieces.get(value.pieces, 0) if isinstance(last_pieces, dict) else 0,
'pieces' : value.pieces
}
vals['details_ids'].append([0, False, nested_values])
res_id = super(account_cash_statement, self).create(cr, uid, vals, context=context)

View File

@ -515,7 +515,7 @@
<separator colspan="4" string="Accounts Allowed (empty for no control)"/>
<field colspan="4" name="account_control_ids" nolabel="1"/>
</page>
<page string="Cash Registers" attrs="{'invisible':[('type', '!=', 'cash')]}">
<page string="Cash Registers">
<group>
<group string="Accounts">
<field name="profit_account_id"/>
@ -524,10 +524,11 @@
</group>
<group string="Miscellaneous">
<field name="with_last_closing_balance"/>
<field name="cash_control"/>
</group>
</group>
<separator string="Available Coins" colspan="4" />
<field name="cashbox_line_ids" nolabel="1" string="Unit Of Currency Definition" colspan="4">
<separator string="Available Coins" colspan="4" attrs="{'invisible' : [('cash_control', '=', False)] }"/>
<field name="cashbox_line_ids" nolabel="1" string="Unit Of Currency Definition" colspan="4" attrs="{'invisible' : [('cash_control', '=', False)]}">
<tree string="CashBox Lines" editable="bottom">
<field name="pieces" />
</tree>

View File

@ -381,6 +381,11 @@
<field name="name">Cash Journal - (test)</field>
<field name="code">TCSH</field>
<field name="type">cash</field>
<field name="profit_account_id" model="account.account" ref="rsa" />
<field name="loss_account_id" model="account.account" ref="rsa" />
<field name="internal_account_id" model="account.account" ref="chart0" />
<field name="with_last_closing_balance" eval="True" />
<field name="cash_control" eval="True" />
<field name="view_id" ref="account_journal_bank_view"/>
<field name="sequence_id" ref="sequence_cash_journal"/>
<field model="account.account" name="default_debit_account_id" ref="cash"/>

View File

@ -23,6 +23,7 @@
<label for="quantity_max"/>
<div>
<field name="quantity_max" class="oe_inline"/>
<field name="company_uom_id" readonly="1" class="oe_inline"/>
</div>
</xpath>
<xpath expr='//group[@name="invoice_on_timesheets"]' position="replace">

View File

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

View File

@ -1,41 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Projects Management: hr_expense link',
'version': '1.1',
'category': 'Hidden',
'description': """
This module is for modifying project view to show some data related to the hr_expense module.
=============================================================================================
""",
'author': 'OpenERP S.A.',
'website': 'http://www.openerp.com/',
'depends': ['analytic_contract_hr_expense','project'],
'data': ['analytic_contract_expense_project_view.xml'],
'demo': [],
'css' : [],
'installable': True,
'auto_install': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,37 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import osv
class project_project(osv.osv):
_inherit = "project.project"
def open_hr_expense(self, cr, uid, ids, context=None):
account_ids = [x.analytic_account_id.id for x in self.browse(cr, uid, ids, context=context)]
return self.pool.get('account.analytic.account').open_hr_expense(cr, uid, account_ids, context=context)
def hr_to_invoice_expense(self, cr, uid, ids, context=None):
account_ids = [x.analytic_account_id.id for x in self.browse(cr, uid, ids, context=context)]
return self.pool.get('account.analytic.account').hr_to_invoice_expense(cr, uid, account_ids, context=context)
project_project()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="project_form_expense_form" model="ir.ui.view">
<field name="name">project.project.form.expense.inherit</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="analytic_contract_project.project_account_analytic_account_form"/>
<field eval="20" name="priority"/>
<field name="arch" type="xml">
<xpath expr='//tr[@name="total"]' position='before'>
<tr>
<td>
<label for="charge_expenses"/>
</td><td>
<field name="charge_expenses"/>
</td><td>
<field class="oe_inline" name="est_expenses" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
</td><td>
<field class="oe_inline" name="expense_invoiced" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
</td><td>
<field class="oe_inline" name="remaining_expense" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
</td><td>
<field class="oe_inline" name="expense_to_invoice" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
</td><td>
<button name="open_hr_expense" string="All Expenses" type="object" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
<button name="hr_to_invoice_expense" string="Expenses to Invoice" type="object" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
</td>
</tr>
</xpath>
</field>
</record>
</data>
</openerp>

View File

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

View File

@ -1,38 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name' : 'Contract on Project',
'version': '1.1',
'author' : 'OpenERP SA',
'category': 'Hidden',
'website' : 'http://www.openerp.com',
'depends' : ['project', 'account_analytic_analysis'],
'description': """
Add "Contract Data" in project view.
====================================
""",
'data': ['analytic_contract_project_view.xml'],
'demo': [],
'installable': True,
'auto_install': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,84 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
class project_project(osv.osv):
_inherit = 'project.project'
_defaults = {
'use_timesheets': True,
}
def open_sale_order_lines(self,cr,uid,ids,context=None):
account_ids = [x.analytic_account_id.id for x in self.browse(cr, uid, ids, context=context)]
return self.pool.get('account.analytic.account').open_sale_order_lines(cr, uid, account_ids, context=context)
def open_timesheets_to_invoice(self,cr,uid,ids,context=None):
if context is None:
context = {}
analytic_account_id = self.browse(cr, uid, ids[0], context=context).analytic_account_id.id
context.update({'search_default_account_id': analytic_account_id, 'default_account_id': analytic_account_id, 'search_default_to_invoice': 1})
return {
'type': 'ir.actions.act_window',
'name': _('Timesheet Lines to Invoice'),
'view_type': 'form',
'view_mode': 'tree,form',
'context': context,
'domain' : [('invoice_id','=',False),('to_invoice','!=',False), ('journal_id.type', '=', 'general')],
'res_model': 'account.analytic.line',
'nodestroy': True,
}
def open_timesheets(self, cr, uid, ids, context=None):
""" open Timesheets view """
project = self.browse(cr, uid, ids[0], context)
try:
journal_id = self.pool.get('ir.model.data').get_object(cr, uid, 'hr_timesheet', 'analytic_journal').id
except ValueError:
journal_id = False
view_context = {
'search_default_account_id': [project.analytic_account_id.id],
'default_account_id': project.analytic_account_id.id,
'default_journal_id': journal_id,
}
return {
'type': 'ir.actions.act_window',
'name': _('Bill Tasks Works'),
'res_model': 'account.analytic.line',
'view_type': 'form',
'view_mode': 'tree,form',
'context': view_context,
'nodestroy': True,
}
project_project()
class task(osv.osv):
_inherit = "project.task"
def create(self, cr, uid, vals, context=None):
task_id = super(task, self).create(cr, uid, vals, context=context)
task_browse = self.browse(cr, uid, task_id, context=context)
if task_browse.project_id.analytic_account_id:
self.pool.get('account.analytic.account').message_append_note(cr, uid, [task_browse.project_id.analytic_account_id.id], body=_("Task <em>%s</em> has been <b>created</b>.") % (task_browse.name), context=context)
return task_id
task()

View File

@ -1,127 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="project_account_analytic_account_form" model="ir.ui.view">
<field name="name">project.project.form.inherit</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/>
<field eval="18" name="priority"/>
<field name="arch" type="xml">
<xpath expr='//page[@name="team"]' position='after'>
<page string="Contract Data">
<group>
<group string="Validity">
<label for="date_start" string="Duration"/>
<div name="duration">
<field name="date_start" class="oe_inline"/>
<label attrs="{'invisible':[('date','=',False)]}" class="oe_inline" string=" - "/>
<field name="date" class="oe_inline"/>
</div>
<label for="quantity_max"/>
<div>
<field name="quantity_max" class="oe_inline"/>
<field name="company_uom_id" readonly="1" class="oe_inline"/> / Remaining:
<field name="remaining_hours" class="oe_inline"/>
<field name="company_uom_id" readonly="1" class="oe_inline"/>
</div>
</group>
<group string="Invoice Options">
<field name="manager_id" />
<field name="pricelist_id" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/>
<field name="to_invoice" widget="selection" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/>
</group>
</group>
<separator name="toinvoice" string="Invoicing"/>
<table width="100%%">
<tr>
<th></th>
<th></th>
<th><label string="Est.Tot"/></th>
<th><label string="Invoiced"/></th>
<th><label string="Remaining"/></th>
<th><label string="To Invoice"/></th>
<th></th>
</tr><tr>
<td>
<label for="fix_price_invoices"/>
</td><td>
<field name="fix_price_invoices" class="oe_inline"/>
</td><td>
<field class="oe_inline" name="amount_max" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
</td><td>
<field class="oe_inline" name="ca_invoiced" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
</td><td>
<field class="oe_inline" name="remaining_ca" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
</td><td>
<field class="oe_inline" name="fix_price_to_invoice" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
</td><td>
<button name="%(account_analytic_analysis.action_sales_order)d" string="All Sales" type="action" context="{'default_partner_id': [partner_id], 'search_default_partner_id': [partner_id], 'default_project_id': analytic_account_id, 'search_default_project_id': analytic_account_id}" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
<button name="open_sale_order_lines" string="Lines To Invoice" type="object" context="{'default_partner_id': [partner_id],'default_project_id': analytic_account_id,'search_default_uninvoiced': 1,'search_default_project_id': analytic_account_id,'search_default_partner_id': [partner_id]}" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/></td>
</tr><tr attrs="{'invisible':[('use_timesheets','=',False)]}">
<td>
<label for="invoice_on_timesheets"/>
</td><td>
<field name="invoice_on_timesheets"/>
</td><td>
<field class="oe_inline" name="hours_qtt_est" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</td><td>
<field class="oe_inline" name="timesheet_ca_invoiced" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</td><td>
<field class="oe_inline" name="remaining_hours_to_invoice" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</td><td>
<field class="oe_inline" name="ca_to_invoice" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
</td><td>
<button name="%(hr_timesheet.act_hr_timesheet_line_evry1_all_form)d" string="All Timesheets" type="action" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}" context="{'default_account_id': analytic_account_id,'search_default_account_id': analytic_account_id}"/>
<button name="open_timesheets_to_invoice" string="Timesheets to Invoice" type="object" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</td>
</tr><tr name="total">
<th>
<label string="Total"/>
</th><td>
</td><td>
<field name="est_total" class="oe_inline" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</td><td>
<field name="invoiced_total" class="oe_inline"/>
</td><td>
<field name="remaining_total" class="oe_inline"/>
</td><td>
<field name="toinvoice_total" class="oe_inline"/>
</td><td>
</td>
</tr>
</table>
<separator string="Terms and Conditions" name="description"/>
<field name="description"/>
</page>
</xpath>
</field>
</record>
<record id="project_invoice_form" model="ir.ui.view">
<field name="name">Inherit project form : Invoicing Data</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/>
<field name="arch" type="xml">
<xpath expr='//tr[@name="use_tasks_row"]' position='after'>
<tr>
<td><group><field name="use_timesheets"/></group></td>
<td><button icon="terp-gtk-go-back-rtl" name="open_timesheets" string="Timesheets" type="object" attrs="{'invisible':[('use_timesheets','=', 0)]}"/></td>
</tr>
</xpath>
</field>
</record>
<record id="contract_inherited_form" model="ir.ui.view">
<field name="name">Inherit contract form : adding UoM</field>
<field name="model">account.analytic.account</field>
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field name="priority">50</field>
<field name="arch" type="xml">
<xpath expr='//field[@name="quantity_max"]' position='after'>
<field name="company_uom_id" readonly="1" class="oe_inline"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -31,7 +31,10 @@ Allow users to sign up.
'website': 'http://www.openerp.com',
'installable': True,
'depends': ['base_setup'],
'data': ['res_config.xml'],
'data': [
'auth_signup_data.xml',
'res_config.xml',
],
'js': ['static/src/js/auth_signup.js'],
'qweb': ['static/src/xml/auth_signup.xml'],
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data noupdate="1">
<!-- Default template user for new users signing in -->
<record id="default_template_user" model="res.users">
<field name="name">Template User</field>
<field name="login">portaltemplate</field>
<!-- No password: this template user doesn't need to log in -->
<field name="password"></field>
<field name="active" eval="False"/>
<!-- Avoid auto-including this user in any default group, just like a typical portal member -->
<field name="groups_id" eval="[(5,)]"/>
</record>
<record id="default_template_user" model="ir.config_parameter">
<field name="key">auth_signup.template_user_id</field>
<field name="value" ref="default_template_user"/>
</record>
</data>
</openerp>

View File

@ -29,13 +29,13 @@ class base_config_settings(osv.TransientModel):
'auth_signup_template_user_id': fields.many2one('res.users', 'Template user for new users created through signup'),
}
def get_default_signup(self, cr, uid, fields, context=None):
def get_default_auth_signup_template_user_id(self, cr, uid, fields, context=None):
icp = self.pool.get('ir.config_parameter')
return {
'auth_signup_template_user_id': icp.get_param(cr, uid, 'auth.signup_template_user_id', 0) or False
'auth_signup_template_user_id': icp.get_param(cr, uid, 'auth_signup.template_user_id', 0) or False
}
def set_signup(self, cr, uid, ids, context=None):
def set_auth_signup_template_user_id(self, cr, uid, ids, context=None):
config = self.browse(cr, uid, ids[0], context=context)
icp = self.pool.get('ir.config_parameter')
icp.set_param(cr, uid, 'auth.signup_template_user_id', config.auth_signup_template_user_id.id)
icp.set_param(cr, uid, 'auth_signup.template_user_id', config.auth_signup_template_user_id.id)

View File

@ -12,9 +12,9 @@
<field name="auth_signup_uninvited" class="oe_inline"/>
<label for="auth_signup_uninvited"/>
</div>
<div>
<div attrs="{'invisible':[('auth_signup_uninvited','=',False)]}">
<label for="auth_signup_template_user_id"/>
<field name="auth_signup_template_user_id" class="oe_inline"/>
<field name="auth_signup_template_user_id" class="oe_inline" domain="['|',('active','=',0),('active','=',1)]"/>
</div>
</xpath>
</field>

View File

@ -362,6 +362,10 @@
</group>
<group>
<field name="type"/>
<p colspan="2" class="oe_grey" attrs="{'invisible': [('type','=','normal')]}">
When processing a sale order for this product, the delivery order
will contain the raw materials, instead of the finished product.
</p>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<label for="product_uos_qty" groups="product.group_uos"/>
<div groups="product.group_uos" >
@ -678,11 +682,11 @@
</group>
<notebook>
<page string="Consumed Products">
<group groups="stock.group_locations">
<group>
<group>
<field name="bom_id" domain="[('product_id','=',product_id)]" context="{'default_product_id': product_id}" on_change="bom_id_change(bom_id)"/>
</group>
<group>
<group groups="stock.group_locations">
<field name="location_src_id" domain="[('usage','=','internal')]" on_change="location_id_change(location_src_id,location_dest_id)"/>
<field name="location_dest_id" domain="[('usage','=','internal')]"/>
</group>

View File

@ -12,6 +12,8 @@ class pad_common(osv.osv_memory):
def pad_generate_url(self, cr, uid, context=None):
pad_server = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.pad_server
# make sure pad server in the form of http://hostname
if not pad_server:
return ''
if not pad_server.startswith('http'):
pad_server = 'http://' + pad_server
pad_server = pad_server.rstrip('/')

View File

@ -27,15 +27,10 @@ class account_journal(osv.osv):
_columns = {
'journal_user': fields.boolean('PoS Payment Method', help="Check this box if this journal define a payment method that can be used in point of sales."),
'opening_control': fields.boolean('Opening Control', help="If you want the journal should be control at opening, check this option"),
'closing_control': fields.boolean('Closing Control', help="If you want the journal should be control at closing, check this option"),
'amount_authorized_diff' : fields.float('Amount Authorized Difference'),
'self_checkout_payment_method' : fields.boolean('Self Checkout Payment Method'),
}
_defaults = {
'opening_control' : False,
'closing_control' : False,
'self_checkout_payment_method' : False,
}
@ -46,6 +41,7 @@ class account_cash_statement(osv.osv):
_columns = {
'pos_session_id' : fields.many2one('pos.session'),
}
account_cash_statement()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -10,8 +10,6 @@
<page string="Point of Sale">
<group col="4" colspan="4">
<field name="journal_user"/>
<field name="opening_control"/>
<field name="closing_control"/>
<field name="amount_authorized_diff"/>
<field name="self_checkout_payment_method" />
</group>
@ -113,37 +111,5 @@
<field name="view_id" ref="account.view_bank_statement_form2"/>
<field name="act_window_id" ref="action_new_bank_statement_all_tree"/>
</record>
<!--
<menuitem name="Cash Register Management" parent="point_of_sale.menu_point_root"
id="menu_point_open_config" sequence="10"/>
<menuitem
name="Open Cash Registers" parent="menu_point_open_config"
string="Open Cash Registers"
action="action_pos_open_statement"
id="menu_open_statement" sequence="1" />
<menuitem
name="Close Cash Registers" parent="menu_point_open_config"
string="Close Cash Registers"
action="action_pos_close_statement"
id="menu_close_statement" sequence="2" />
<menuitem
parent="menu_point_open_config"
action="action_pos_confirm"
id="menu_wizard_pos_confirm" sequence="8" />
<menuitem
name="List of Cash Registers"
parent="menu_point_open_config"
action="action_new_bank_statement_all_tree"
id="menu_all_menu_all_register"
sequence="4"
/>
-->
</data>
</openerp>

View File

@ -74,6 +74,26 @@ class pos_config(osv.osv):
'group_by' : fields.boolean('Group Journal Items', help="Check this if you want to group the Journal Items by Product while closing a Session"),
}
def _check_cash_control(self, cr, uid, ids, context=None):
return all(
(sum(int(journal.cash_control) for journal in record.journal_ids) <= 1)
for record in self.browse(cr, uid, ids, context=context)
)
_constraints = [
(_check_cash_control, "You cannot have two cash controls in one Point Of Sale !", ['journal_ids']),
]
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
d = {
'sequence_id' : False,
}
d.update(default)
return super(pos_order, self).copy(cr, uid, id, d, context=context)
def name_get(self, cr, uid, ids, context=None):
result = []
states = {
@ -90,11 +110,6 @@ class pos_config(osv.osv):
result.append((record.id, record.name + ' ('+session.user_id.name+')')) #, '+states[session.state]+')'))
return result
def _default_payment_journal(self, cr, uid, context=None):
res = self.pool.get('account.journal').search(cr, uid, [('type', 'in', ('bank','cash'))], limit=2)
return res or []
def _default_sale_journal(self, cr, uid, context=None):
res = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale')], limit=1)
return res and res[0] or False
@ -107,7 +122,6 @@ class pos_config(osv.osv):
'state' : POS_CONFIG_STATE[0][0],
'shop_id': _default_shop,
'journal_id': _default_sale_journal,
'journal_ids': _default_payment_journal,
'group_by' : True,
}
@ -148,45 +162,20 @@ class pos_session(osv.osv):
('closed', 'Closed & Posted'),
]
def _compute_cash_journal_id(self, cr, uid, ids, fieldnames, args, context=None):
result = dict.fromkeys(ids, False)
for record in self.browse(cr, uid, ids, context=context):
for st in record.statement_ids:
if st.journal_id.type == 'cash':
result[record.id] = st.journal_id.id
break
return result
def _compute_cash_register_id(self, cr, uid, ids, fieldnames, args, context=None):
result = dict.fromkeys(ids, False)
for record in self.browse(cr, uid, ids, context=context):
for st in record.statement_ids:
if st.journal_id.type == 'cash':
result[record.id] = st.id
break
return result
def _compute_controls(self, cr, uid, ids, fieldnames, args, context=None):
result = {}
def _compute_cash_all(self, cr, uid, ids, fieldnames, args, context=None):
result = dict()
for record in self.browse(cr, uid, ids, context=context):
has_opening_control = False
has_closing_control = False
for journal in record.config_id.journal_ids:
if journal.opening_control == True:
has_opening_control = True
if journal.closing_control == True:
has_closing_control = True
if has_opening_control and has_closing_control:
break
values = {
'has_opening_control': has_opening_control,
'has_closing_control': has_closing_control,
result[record.id] = {
'cash_journal_id' : False,
'cash_register_id' : False,
'cash_control' : False,
}
result[record.id] = values
for st in record.statement_ids:
if st.journal_id.cash_control == True:
result[record.id]['cash_control'] = True
result[record.id]['cash_journal_id'] = st.journal_id.id
result[record.id]['cash_register_id'] = st.id
return result
@ -212,12 +201,17 @@ class pos_session(osv.osv):
required=True, readonly=True,
select=1),
'cash_journal_id' : fields.function(_compute_cash_journal_id, method=True,
type='many2one', relation='account.journal',
string='Cash Journal', store=True),
'cash_register_id' : fields.function(_compute_cash_register_id, method=True,
type='many2one', relation='account.bank.statement',
string='Cash Register', store=True),
'cash_control' : fields.function(_compute_cash_all,
multi='cash',
type='boolean', string='Has Cash Control'),
'cash_journal_id' : fields.function(_compute_cash_all,
multi='cash',
type='many2one', relation='account.journal',
string='Cash Journal', store=True),
'cash_register_id' : fields.function(_compute_cash_all,
multi='cash',
type='many2one', relation='account.bank.statement',
string='Cash Register', store=True),
'opening_details_ids' : fields.related('cash_register_id', 'opening_details_ids',
type='one2many', relation='account.cashbox.line',
@ -261,8 +255,6 @@ class pos_session(osv.osv):
'order_ids' : fields.one2many('pos.order', 'session_id', 'Orders'),
'statement_ids' : fields.one2many('account.bank.statement', 'pos_session_id', 'Bank Statement', readonly=True),
'has_opening_control' : fields.function(_compute_controls, string='Has Opening Control', multi='control', type='boolean'),
'has_closing_control' : fields.function(_compute_controls, string='Has Closing Control', multi='control', type='boolean'),
}
_defaults = {
@ -372,10 +364,8 @@ class pos_session(osv.osv):
def wkf_action_closing_control(self, cr, uid, ids, context=None):
for session in self.browse(cr, uid, ids, context=context):
for statement in session.statement_ids:
if statement.id <> session.cash_register_id.id:
if statement.balance_end<>statement.balance_end_real:
self.pool.get('account.bank.statement').write(cr, uid,
[statement.id], {'balance_end_real': statement.balance_end})
if statement != session.cash_register_id and statement.balance_end != statement.balance_end_real:
self.pool.get('account.bank.statement').write(cr, uid, [statement.id], {'balance_end_real': statement.balance_end})
return self.write(cr, uid, ids, {'state' : 'closing_control', 'stop_at' : time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
def wkf_action_close(self, cr, uid, ids, context=None):
@ -388,7 +378,7 @@ class pos_session(osv.osv):
if not self.pool.get('ir.model.access').check_groups(cr, uid, "point_of_sale.group_pos_manager"):
raise osv.except_osv( _('Error!'),
_("Your ending balance is too different from the theorical cash closing (%.2f), the maximum allowed is: %.2f. You can contact your manager to force it.") % (st.difference, st.journal_id.amount_authorized_diff))
if st.difference:
if st.difference and st.journal_id.cash_control == True:
if st.difference > 0.0:
name= _('Point of Sale Profit')
account_id = st.journal_id.profit_account_id.id
@ -406,6 +396,9 @@ class pos_session(osv.osv):
'account_id': account_id
}, context=context)
if st.journal_id.type == 'bank':
st.write({'balance_end_real' : st.balance_end})
getattr(st, 'button_confirm_%s' % st.journal_id.type)(context=context)
self._confirm_orders(cr, uid, ids, context=context)
self.write(cr, uid, ids, {'state' : 'closed'}, context=context)
@ -731,7 +724,7 @@ class pos_order(osv.osv):
'pos_statement_id' : order_id,
'journal_id' : journal_id,
'type' : 'customer',
'ref' : order.name,
'ref' : order.session_id.name,
})
statement_line_obj.create(cr, uid, args, context=context)
@ -1084,6 +1077,7 @@ class account_bank_statement_line(osv.osv):
_columns= {
'pos_statement_id': fields.many2one('pos.order', ondelete='cascade'),
}
account_bank_statement_line()
class pos_order_line(osv.osv):
@ -1284,8 +1278,30 @@ class product_product(osv.osv):
help="If you want to sell this product through the point of sale, select the category it belongs to."),
'to_weight' : fields.boolean('To Weight', help="This category contains products that should be weighted, mainly used for the self-checkout interface"),
}
def _default_pos_categ_id(self, cr, uid, context=None):
proxy = self.pool.get('ir.model.data')
try:
category_id = proxy.get_object_reference(cr, uid, 'point_of_sale', 'categ_others')[1]
except ValueError:
values = {
'name' : 'Others',
}
category_id = self.pool.get('pos.category').create(cr, uid, values, context=context)
values = {
'name' : 'categ_others',
'model' : 'pos.category',
'module' : 'point_of_sale',
'res_id' : category_id,
}
proxy.create(cr, uid, values, context=context)
return category_id
_defaults = {
'to_weight' : False,
'pos_categ_id' : _default_pos_categ_id,
}
def edit_ean(self, cr, uid, ids, context):

View File

@ -8,7 +8,7 @@
<field name="groups_id" eval="[(4,ref('group_pos_user'))]"/>
<field name="ean13">0410200000005</field>
</record>
<record id="account.cash_journal" model="account.journal">
<record id="account.cash_journal" model="account.journal">
<field eval="True" name="journal_user"/>
</record>
<record id="base.user_jsmith" model="res.users">
@ -36,6 +36,10 @@
<field name="groups_id" eval="[(4,ref('group_pos_user'))]"/>
</record>
<record model="pos.config" id="pos_config_main">
<field name="journal_ids" eval="[(6, 0, [ref('account.cash_journal'), ref('account.bank_journal')])]" />
</record>
<!-- Resource: pos.category -->
<record id="beverage" model="pos.category">

View File

@ -126,7 +126,7 @@
</field>
</record>
<record model="ir.ui.view" id="view_pos_order_tree">
<field name="name">Sales</field>
<field name="name">Orders</field>
<field name="model">pos.order</field>
<field name="arch" type="xml">
<tree string="POS Orders" colors="blue:state == 'draft';gray:state in ('done','cancel');black:state not in('done','cancel')">
@ -138,6 +138,7 @@
<field name="amount_total" sum="Amount total"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="state"/>
<field name="session_id" />
</tree>
</field>
</record>
@ -791,8 +792,7 @@
<field name="code" />
<field name="name" />
<field name="type" />
<field name="opening_control" />
<field name="closing_control" />
<field name="cash_control" />
</tree>
</field>
<group string="Material Interfaces" >
@ -878,10 +878,10 @@
<header>
<button name="open" type="workflow" string="Validate &amp; Open Session" states="opening_control" class="oe_highlight"/>
<button name="cashbox_control" type="workflow" string="End of Session"
attrs="{'invisible' : [('has_closing_control', '=', False),('state', '=', 'opened')]}"
attrs="{'invisible' : ['|', ('cash_control', '=', False),('state', '!=', 'opened')]}"
class="oe_highlight" />
<button name="close" type="workflow" string="Validate Closing &amp; Post Entries"
attrs="{'invisible' : [('has_closing_control', '=', True),('state', '=', 'opened')]}"
attrs="{'invisible' : ['|', ('cash_control', '=', True),('state', '!=', 'opened')]}"
class="oe_highlight" />
<button name="close" type="workflow" string="Validate Closing &amp; Post Entries" states="closing_control"
class="oe_highlight" />
@ -900,8 +900,7 @@
<field name="name" attrs="{'invisible': [('name','=','/')]}" class="oe_inline"/>
</h1>
<group>
<field name="has_opening_control" invisible="1" />
<field name="has_closing_control" invisible="1" />
<field name="cash_control" invisible="1" />
<group>
<field name="user_id"/>
<field name="config_id" attrs="{'invisible' : [('config_id', '&lt;&gt;', False)]}"/>
@ -912,26 +911,26 @@
</group>
<newline/>
<group string="Opening Cash Control">
<group string="Opening Cash Control" attrs="{'invisible' : ['|', ('cash_control', '=', False),('state', '=', 'closed')]}">
<field name="opening_details_ids" nolabel="1" colspan="2" attrs="{'readonly' : [('state', 'not in', ('opening_control',))]}">
<tree string="Opening Cashbox Lines" editable="bottom">
<field name="pieces" readonly="1" />
<field name="number_opening" string="Opening Unit Numbers" on_change="on_change_sub_opening(pieces, number_opening)" />
<field name="number_opening" on_change="on_change_sub_opening(pieces, number_opening)" />
<field name="subtotal_opening" string="Opening Subtotal" sum="Total"/>
</tree>
</field>
</group>
<group string="Closing Cash Control" attrs="{'invisible': [('state', '=', 'opening_control')]}">
<group string="Closing Cash Control" attrs="{'invisible': ['|', ('cash_control', '=', False), ('state', '!=', 'closing_control')]}">
<field name="details_ids" nolabel="1" colspan="2">
<tree string="Cashbox Lines" editable="bottom">
<field name="pieces" readonly="1" />
<field name="number_closing"/>
<field name="number_closing" />
<field name="subtotal_closing"/>
</tree>
</field>
</group>
<div>
<div attrs="{'invisible': [('state', '=', 'closed')]}">
<group class="oe_subtotal_footer oe_right">
<field name="cash_register_balance_start" readonly="1" string="Opening Balance" class="oe_subtotal_footer_separator"/>
<field name="cash_register_total_entry_encoding" attrs="{'invisible' : [('state', '=', 'opening_control')]}" string="+ Transactions"/>
@ -948,7 +947,7 @@
</div>
<group class="oe_subtotal_footer oe_right" attrs="{'invisible' : [('state', '=', 'opening_control')]}">
<group class="oe_subtotal_footer oe_right" attrs="{'invisible' : [('state', 'in', ('opening_control', 'closed'))]}">
<field name="cash_register_balance_end_real" class="oe_subtotal_footer_separator"/>
<field name="cash_register_difference" class="oe_subtotal_footer_separator"/>
</group>

View File

@ -126,14 +126,14 @@
<field name="act_from" ref="act_start" />
<field name="act_to" ref="act_opening_control" />
<field name="signal" eval="False" /> <!-- >start_to_opening_control</field> -->
<field name="condition">has_opening_control == True</field>
<field name="condition">cash_control == True</field>
</record>
<record model="workflow.transition" id="trans_start_to_open">
<field name="act_from" ref="act_start" />
<field name="act_to" ref="act_open" />
<field name="signal" eval="False" />
<field name="condition">has_opening_control == False</field>
<field name="condition">cash_control == False</field>
</record>
<!-- state:opening_control -> signal:open -> state:opened -> signal:cashbox_control -> state:closing_control -> signal:close -> state:close -->
@ -147,14 +147,14 @@
<field name="act_from" ref="act_open" />
<field name="act_to" ref="act_closing_control" />
<field name="signal">cashbox_control</field>
<field name="condition">has_closing_control == True</field>
<field name="condition">cash_control == True</field>
</record>
<record model="workflow.transition" id="trans_open_to_close">
<field name="act_from" ref="act_open" />
<field name="act_to" ref="act_close" />
<field name="signal">close</field>
<field name="condition">has_closing_control == False</field>
<field name="condition">cash_control == False</field>
</record>
<record model="workflow.transition" id="trans_closing_control_to_close">

View File

@ -65,7 +65,7 @@ class pos_open_statement(osv.osv_memory):
statement_id = statement_obj.create(cr, uid, data, context=context)
st_ids.append(int(statement_id))
if journal.opening_control:
if journal.cash_control:
statement_obj.button_open(cr, uid, [statement_id], context)
tree_res = mod_obj.get_object_reference(cr, uid, 'point_of_sale', 'view_cash_statement_pos_tree')

View File

@ -6,6 +6,8 @@
<field name="name">Portal</field>
<field name="group_id" ref="group_portal_member"/>
<field name="override_menu" eval="False"/>
<!-- Insert the template user from auth_signup in the portal members group -->
<field name="users" eval="[(4,ref('auth_signup.default_template_user'))]"/>
</record>
<!-- Mail group for the company's news -->

File diff suppressed because one or more lines are too long

View File

@ -210,7 +210,7 @@ class project(osv.osv):
'complete_name': fields.function(_complete_name, string="Project Name", type='char', size=250),
'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the project without removing it."),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of Projects."),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', help="Link this project to an analytic account if you need financial management on projects. It enables you to connect projects with budgets, planning, cost and revenue analysis, timesheets on projects, etc.", ondelete="cascade", required=True),
'analytic_account_id': fields.many2one('account.analytic.account', 'Contract/Analytic', help="Link this project to an analytic account if you need financial management on projects. It enables you to connect projects with budgets, planning, cost and revenue analysis, timesheets on projects, etc.", ondelete="cascade", required=True),
'priority': fields.integer('Sequence', help="Gives the sequence order when displaying the list of projects"),
'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project Members',
help="Project's members are users who can have an access to the tasks related to this project.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
@ -1265,7 +1265,7 @@ class account_analytic_account(osv.osv):
_inherit = 'account.analytic.account'
_description = 'Analytic Account'
_columns = {
'use_tasks': fields.boolean('Tasks Mgmt.',help="If check,this contract will be available in the project menu and you will be able to manage tasks or track issues"),
'use_tasks': fields.boolean('Tasks',help="If check,this contract will be available in the project menu and you will be able to manage tasks or track issues"),
'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'),
}

View File

@ -76,33 +76,29 @@
</header>
<sheet string="Project">
<field name="analytic_account_id" invisible="1" required="0"/>
<label for="name" class="oe_edit_only" string="Project Name"/>
<h1>
<field name="name" string="Project Name"/>
</h1>
<div attrs="{'invisible': [('alias_domain', '=', False)]}">
<field name="alias_id" invisible="1" required="0"/>
<label for="alias_name" class="oe_edit_only "/>
<field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" class="oe_inline"/>
<div class="oe_title">
<label for="name" class="oe_edit_only" string="Project Name"/>
<h1>
<field name="name" string="Project Name"/>
</h1>
<div name="options_active">
<field name="use_tasks" class="oe_inline"/>
<label for="use_tasks"/>
</div>
</div>
<div class="oe_right oe_button_box" name="buttons">
<button name="%(act_project_project_2_project_task_all)d" string="Tasks"
type="action" attrs="{'invisible':[('use_tasks','=', 0)]}"/>
<button name="%(base.action_attachment)d" string="Documents" type="action"/>
</div>
<group>
<group>
<field name="user_id" string="Project Manager" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
<field name="partner_id" string="Contact" on_change="onchange_partner_id(partner_id)"/>
<field name="privacy_visibility"/>
<field name="analytic_account_id" invisible="1" required="0"/>
</group>
<group>
<table>
<tr name="use_tasks_row">
<td><group><field name="use_tasks"/></group></td>
<td><button icon="terp-gtk-go-back-rtl" name="%(act_project_project_2_project_task_all)d" string="Tasks" type="action" attrs="{'invisible':[('use_tasks','=', 0)]}"/></td>
</tr>
<tr name="use_attachment_row">
<td/>
<td><button icon="terp-gtk-go-back-rtl" class="oe_btn_width" name="%(base.action_attachment)d" string="Documents" type="action"/></td>
</tr>
</table>
<field name="privacy_visibility"/>
<field name="analytic_account_id" readonly="1" required="0"/>
</group>
</group>
<notebook>
@ -126,6 +122,13 @@
</field>
</page>
<page string="Other Info">
<group string="Email Interface" colspan="2">
<div attrs="{'invisible': [('alias_domain', '=', False)]}">
<field name="alias_id" invisible="1" required="0"/>
<label for="alias_name" class="oe_edit_only "/>
<field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" class="oe_inline"/>
</div>
</group>
<group>
<group string="Administration">
<field name="planned_hours" widget="float_time"/>
@ -133,11 +136,11 @@
<field name="resource_calendar_id"/>
</group>
<group string="Miscellaneous" name="misc">
<field name="company_id" groups="base.group_multi_company" widget="selection" required="1"/>
<field name="parent_id" domain="[('id','!=',analytic_account_id)]" context="{'current_model': 'project.project'}"/>
<field name="priority"/>
<field name="active" attrs="{'invisible':[('state','in',['open', 'pending', 'template'])]}"/>
<field name="currency_id" groups="base.group_multi_company" required="1"/>
<field name="parent_id" domain="[('id','!=',analytic_account_id)]" context="{'current_model': 'project.project'}"/>
<field name="company_id" groups="base.group_multi_company" widget="selection" required="1"/>
</group>
</group>
</page>
@ -312,7 +315,7 @@
<field name="search_view_id" ref="view_project_project_filter"/>
<field name="context">{}</field>
<field name="help" type="html">
<p class="oe_form_nocontent_create">
<p class="oe_view_nocontent_create">
Click to start a new project.
</p>
<p>

View File

@ -569,7 +569,7 @@ class account_analytic_account(osv.osv):
_description = 'Analytic Account'
_columns = {
'use_issues' : fields.boolean('Issues Tracking', help="Check this field if this project manages issues"),
'use_issues' : fields.boolean('Issues', help="Check this field if this project manages issues"),
}
def on_change_template(self, cr, uid, ids, template_id, context=None):

View File

@ -355,11 +355,12 @@
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/>
<field name="arch" type="xml">
<xpath expr='//tr[@name="use_tasks_row"]' position='after'>
<tr>
<td><group><field name="use_issues"/></group></td>
<td><button icon="terp-gtk-go-back-rtl" name="%(act_project_project_2_project_issue_all)d" string="Issues" type="action" attrs="{'invisible':[('use_issues','=', 0)]}"/></td>
</tr>
<xpath expr='//div[@name="options_active"]' position='inside'>
<field name="use_issues" class="oe_inline"/>
<label for="use_issues"/>
</xpath>
<xpath expr='//div[@name="buttons"]' position='inside'>
<button name="%(act_project_project_2_project_issue_all)d" string="Issues" type="action" attrs="{'invisible':[('use_issues','=', 0)]}"/>
</xpath>
<field name="priority" position="before">
<field name="project_escalation_id"/>
@ -382,7 +383,7 @@
<xpath expr="//div[contains(@class, 'oe_kanban_project_list')]" position="inside">
<a t-if="record.use_issues.raw_value"
name="%(act_project_project_2_project_issue_all)d" type="action">
Issues(<field name="issue_count"/>)</a>
<field name="issue_count"/> Issues</a>
</xpath>
</field>
</record>

View File

@ -273,9 +273,9 @@ class account_analytic_account(osv.osv):
_inherit = 'account.analytic.account'
_description = 'Analytic Account'
_columns = {
'use_phases': fields.boolean('Phases Planing', help="Check this field if project manages phases"),
'use_phases': fields.boolean('Phases', help="Check this field if you plan to use phase-based scheduling"),
}
def on_change_template(self, cr, uid, ids, template_id, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
if template_id and 'value' in res:

View File

@ -96,11 +96,14 @@
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/>
<field name="arch" type="xml">
<xpath expr='//tr[@name="use_tasks_row"]' position='after'>
<tr>
<td><group><field name="use_phases"/></group></td>
<td><button icon="terp-gtk-go-back-rtl" name="%(act_project_phases)d" string="Phases" type="action" attrs="{'invisible':[('use_phases','=', 0)]}"/></td>
</tr>
<xpath expr="//div[@name='options_active']" position='inside'>
<field name="use_phases" class="oe_inline"/>
<label for="use_phases"/>
</xpath>
<xpath expr="//div[@name='buttons']" position='inside'>
<button icon="terp-gtk-go-back-rtl" name="%(act_project_phases)d"
string="Phases" type="action"
attrs="{'invisible':[('use_phases','=', 0)]}"/>
</xpath>
</field>
</record>
@ -347,11 +350,9 @@
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field eval="18" name="priority"/>
<field name="arch" type="xml">
<xpath expr='//separator[@name="project_sep"]' position='replace'>
<separator name="project_sep" string="Project Management" colspan="4"/> <!-- removal of invisible attribute -->
</xpath>
<xpath expr='//separator[@name="project_sep"]' position='after'>
<xpath expr='//div[@name="project"]' position='inside'>
<field name="use_phases"/>
<label for="use_phases"/>
</xpath>
</field>
</record>

View File

@ -48,7 +48,7 @@ with the effect of creating, editing and deleting either ways.
'test/work_timesheet.yml',
],
'installable': True,
'auto_install': False,
'auto_install': True,
'certificate': '0075123647453',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -28,33 +28,6 @@ from tools.translate import _
class project_project(osv.osv):
_inherit = 'project.project'
def _to_invoice(self, cr, uid, ids, field_name, arg, context=None):
account_analytic_line = self.pool.get("account.analytic.line")
res = {}
for project in self.browse(cr,uid,ids,context=context):
line_ids = account_analytic_line.search(cr, uid, [('account_id', '=', project.analytic_account_id.id), ('to_invoice','=',1), ('invoice_id','=',False)])
lines = account_analytic_line.browse(cr, uid, line_ids, context)
res[project.id] = {
'amount_to_invoice': sum(line.amount for line in lines),
'time_to_invoice': sum(line.unit_amount for line in lines),
}
return res
def _timesheet_count(self, cr, uid, ids, field_name, arg, context=None):
account_analytic_line = self.pool.get('account.analytic.line')
res = {}
for project in self.browse(cr, uid, ids, context):
line_ids = account_analytic_line.search(cr, uid, [('account_id', '=', project.analytic_account_id.id)])
res[project.id] = len(line_ids)
return res
_columns = {
'amount_to_invoice': fields.function(_to_invoice, string="Amount to Invoice", multi="sums"),
'time_to_invoice': fields.function(_to_invoice, string="Time to Invoice", multi="sums"),
'timesheet_count': fields.function(_timesheet_count, type='integer', string="Issue"),
}
def onchange_partner_id(self, cr, uid, ids, part=False, context=None):
res = super(project_project, self).onchange_partner_id(cr, uid, ids, part, context)
if part and res and ('value' in res):
@ -66,6 +39,31 @@ class project_project(osv.osv):
res['value'].update({'to_invoice': factor_id})
return res
_defaults = {
'use_timesheets': True,
}
def open_timesheets(self, cr, uid, ids, context=None):
""" open Timesheets view """
project = self.browse(cr, uid, ids[0], context)
try:
journal_id = self.pool.get('ir.model.data').get_object(cr, uid, 'hr_timesheet', 'analytic_journal').id
except ValueError:
journal_id = False
view_context = {
'search_default_account_id': [project.analytic_account_id.id],
'default_account_id': project.analytic_account_id.id,
'default_journal_id': journal_id,
}
return {
'type': 'ir.actions.act_window',
'name': _('Bill Tasks Works'),
'res_model': 'account.analytic.line',
'view_type': 'form',
'view_mode': 'tree,form',
'context': view_context,
'nodestroy': True,
}
project_project()
class project_work(osv.osv):

View File

@ -9,36 +9,29 @@
<field name="arch" type="xml">
<field name="use_tasks" position="after">
<field name="use_timesheets"/>
<field name="timesheet_count"/>
<field name="hours_quantity"/>
<field name="currency_id"/>
<field name="partner_id"/>
</field>
<xpath expr="//div[contains(@class, 'oe_kanban_project_list')]" position="inside">
<a t-if="record.use_timesheets.raw_value"
name="open_timesheets" type="object">Timesheets(<field name="timesheet_count"/>)</a>
</xpath>
<xpath expr="//tr[contains(@class, 'oe_kanban_project_deadline')]" position="before">
<tr class="oe_kanban_project_fields oe_kanban_project_invoice" t-if="record.partner_id.raw_value">
<th>Amount to invoice</th>
<td><field name="amount_to_invoice"/> <t t-esc="record.currency_id.raw_value[1].split(' ')[1][1]"/></td>
</tr>
<tr class="oe_kanban_project_fields oe_kanban_project_invoice" t-if="record.partner_id.raw_value">
<th>Time to Invoice</th>
<td><field name="time_to_invoice"/> <field name="company_uom_id"/></td>
</tr>
name="open_timesheets" type="object"><field name="hours_quantity"/> Timesheets</a>
</xpath>
</field>
</record>
<record id="project_invoice_form_cutomer" model="ir.ui.view">
<field name="name">Inherit project form : Customer</field>
<record id="project_invoice_form" model="ir.ui.view">
<field name="name">Inherit project form : Invoicing Data</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="analytic_contract_project.project_invoice_form"/>
<field name="inherit_id" ref="project.edit_project"/>
<field name="arch" type="xml">
<field name="partner_id" position="replace">
<field name="partner_id" on_change="onchange_partner_id(partner_id)" string="Contact" attrs="{'required':[('to_invoice','!=',False)]}"/>
</field>
<xpath expr='//div[@name="options_active"]' position='inside'>
<field name="use_timesheets" class="oe_inline"/>
<label for="use_timesheets"/>
</xpath>
<xpath expr='//div[@name="buttons"]' position="inside">
<button name="open_timesheets" string="Timesheets" type="object" attrs="{'invisible':[('use_timesheets','=', 0)]}"/>
</xpath>
</field>
</record>
@ -48,7 +41,6 @@
<field name="inherit_id" ref="project.view_project_project_filter"/>
<field name="arch" type="xml">
<xpath expr='//filter[@string="Project(s) Manager"]' position='after'>
<separator/>
<filter icon="terp-camera_test" string="Billable" domain="[('to_invoice','!=', False)]" help="Billable Project"/>
</xpath>
</field>
@ -98,7 +90,7 @@
Click to add a work to invoice.
</p><p>
You will find here all works made on tasks that you can
invoice.
invoice.
</p>
</field>
</record>

View File

@ -259,8 +259,8 @@
</div>
</form>
<tree string="Sales Order Lines" editable="bottom">
<field name="sequence" widget="handle"/>
<field name="state" invisible="1"/>
<field name="sequence" invisible="1"/>
<field name="delay" invisible="1"/>
<field name="tax_id" invisible="1"/>
<field name="type" invisible="1"/>