[MERGE] merge from trunk-dev-addons-3

bzr revid: vth@tinyerp.com-20101103053244-lvdzf7pdgijhkptu
This commit is contained in:
vth 2010-11-03 11:02:44 +05:30
commit db1a501157
14 changed files with 91 additions and 88 deletions

View File

@ -2541,8 +2541,8 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Bank Accounts', required=True),
'code_digits':fields.integer('# of Digits', required=True, help="No. of Digits to use for account code"),
'seq_journal':fields.boolean('Separated Journal Sequences', help="Check this box if you want to use a different sequence for each created journal. Otherwise, all will use the same sequence."),
"sale_tax": fields.many2one("account.tax.template", "Sale Tax"),
"purchase_tax": fields.many2one("account.tax.template", "Purchase Tax"),
"sale_tax": fields.many2one("account.tax.template", "Default Sale Tax"),
"purchase_tax": fields.many2one("account.tax.template", "Default Purchase Tax"),
}
def onchange_chart_template_id(self, cr, uid, ids, chart_template_id=False, context=None):
res = {}
@ -2550,12 +2550,12 @@ class wizard_multi_charts_accounts(osv.osv_memory):
res['value']["sale_tax"] = False
res['value']["purchase_tax"] = False
if chart_template_id:
ids = self.pool.get('account.tax.template').search(cr, uid, [("chart_template_id"
, "=", chart_template_id)], order="sequence")
if len(ids) > 0:
id=ids[0]
res['value']["sale_tax"] = id
res['value']["purchase_tax"] = id
sale_tax_ids = self.pool.get('account.tax.template').search(cr, uid, [("chart_template_id"
, "=", chart_template_id), ('type_tax_use', 'in', ('sale','all'))], order="sequence")
purchase_tax_ids = self.pool.get('account.tax.template').search(cr, uid, [("chart_template_id"
, "=", chart_template_id), ('type_tax_use', 'in', ('purchase','all'))], order="sequence")
res['value']["sale_tax"] = sale_tax_ids and sale_tax_ids[0] or False
res['value']["purchase_tax"] = purchase_tax_ids and purchase_tax_ids[0] or False
return res
def _get_chart(self, cr, uid, context={}):

View File

@ -1101,6 +1101,10 @@ class account_move_line(osv.osv):
journal_obj = self.pool.get('account.journal')
if context is None:
context = {}
if vals.get('move_id', False):
company_id = self.pool.get('account.move').read(cr, uid, vals['move_id'], ['company_id']).get('company_id', False)
if company_id:
vals['company_id'] = company_id[0]
self._check_date(cr, uid, vals, context, check)
if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']:
raise osv.except_osv(_('Bad account!'), _('You can not use an inactive account!'))

View File

@ -2419,8 +2419,8 @@
<field name ="code_digits" groups="base.group_extended"/>
<field name="chart_template_id" widget="selection" on_change="onchange_chart_template_id(chart_template_id)"/>
<field name ="seq_journal" groups="base.group_extended"/>
<field name="sale_tax" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False)]"/>
<field name="purchase_tax" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False)]"/>
<field name="sale_tax" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','in',('sale','all'))]"/>
<field name="purchase_tax" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','in',('purchase', 'all'))]"/>
<field colspan="4" mode="tree" name="bank_accounts_id" nolabel="1" widget="one2many_list">
<form string="Bank Information">
<field name="acc_name"/>
@ -2467,7 +2467,7 @@ action = self.pool.get('res.config').next(cr, uid, [], context)
<field name="name">New Company Financial Setting</field>
<field eval="1" name="sequence"/>
<field name="parent_id" ref="account.menu_finance_accounting"/>
<field name="icon">STOCK_JUSTIFY_FILL</field>
<field name="icon">STOCK_EXECUTE</field>
<field name="action" ref="ir_actions_server_action_wizard_multi_chart"/>
</record>

View File

@ -159,5 +159,6 @@
sequence="1"
id="menu_board_crm" icon="terp-graph"
groups="base.group_sale_salesman"/>
<menuitem icon="terp-partner" id="base.menu_base_partner" name="Sales" sequence="0" action="open_board_crm"/>
</data>
</openerp>

View File

@ -128,8 +128,8 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="mailgate_message_tree_view"/>
<field name="context">{'type':'imap'}</field>
<field name="domain">[('type','=','imap')]</field>
<field name="context">{'server_type':'imap'}</field>
<field name="domain">[('server_type','=','imap')]</field>
</record>
<menuitem
@ -143,8 +143,8 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="mailgate_message_tree_view"/>
<field name="context">{'type':'pop'}</field>
<field name="domain">[('type','=','pop')]</field>
<field name="context">{'server_type':'pop'}</field>
<field name="domain">[('server_type','=','pop')]</field>
</record>
<menuitem

View File

@ -44,6 +44,12 @@ class report_custom(report_rml):
def create_xml(self, cr, uid, ids, data, context):
# Get the user id from the selected employee record
emp_id = data['form']['employee_id']
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
user_id = emp_obj.browse(cr, uid, emp_id).user_id.id
empl_name = emp_obj.browse(cr, uid, emp_id).name
# Computing the dates (start of month: som, and end of month: eom)
som = datetime.date(data['form']['year'], data['form']['month'], 1)
eom = som + datetime.timedelta(lengthmonth(som.year, som.month))
@ -63,7 +69,7 @@ class report_custom(report_rml):
"and product_uom_id = unit.id "\
"and line.user_id=%s and line.date >= %s and line.date < %s "
"order by line.date",
(uid, som.strftime('%Y-%m-%d'), eom.strftime('%Y-%m-%d')))
(user_id, som.strftime('%Y-%m-%d'), eom.strftime('%Y-%m-%d')))
# Sum attendence by account, then by day
accounts = {}
@ -84,7 +90,7 @@ class report_custom(report_rml):
<date>%s</date>
<company>%s</company>
</header>
''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)
''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,user_id).company_id.name)
account_xml = []
for account, telems in accounts.iteritems():
@ -96,10 +102,6 @@ class report_custom(report_rml):
account_xml.append('\n'.join([xml % (day, amount) for day, amount in telems.iteritems()]))
account_xml.append('</account>')
# Computing the employee
cr.execute("select name from res_users where id=%s", (str(uid)))
emp = cr.fetchone()[0]
# Computing the xml
xml = '''<?xml version="1.0" encoding="UTF-8" ?>
<report>
@ -107,7 +109,7 @@ class report_custom(report_rml):
<employee>%s</employee>
%s
</report>
''' % (header_xml,toxml(emp), '\n'.join(date_xml) + '\n'.join(account_xml))
''' % (header_xml,toxml(empl_name), '\n'.join(date_xml) + '\n'.join(account_xml))
return xml
report_custom('report.hr.analytical.timesheet', 'hr.employee', '', 'addons/hr_timesheet/report/user_timesheet.xsl')

View File

@ -33,7 +33,7 @@ def lengthmonth(year, month):
return 29
return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
def emp_create_xml(cr, id, som, eom):
def emp_create_xml(cr, id, som, eom, emp):
# Computing the attendence by analytical account
cr.execute(
"select line.date, (unit_amount * unit.factor) as amount "\
@ -58,10 +58,6 @@ def emp_create_xml(cr, id, som, eom):
'''
time_xml = ([xml % (day, amount) for day, amount in month.iteritems()])
# Computing the employee
cr.execute("select name from resource_resource where id=%s", (id,))
emp = cr.fetchone()[0]
# Computing the xml
xml = '''
<employee id="%d" name="%s">
@ -94,8 +90,9 @@ class report_custom(report_rml):
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
for id in data['form']['employee_ids']:
user = emp_obj.browse(cr, uid, id).user_id.id
empl_name = emp_obj.browse(cr, uid, id).name
if user:
emp_xml += emp_create_xml(cr, id, som, eom)
emp_xml += emp_create_xml(cr, user, som, eom, empl_name)
# Computing the xml
#Without this, report don't show non-ascii characters (TO CHECK)
date_xml = '\n'.join(date_xml)

View File

@ -20,12 +20,12 @@
##############################################################################
import time
import netsvc
from osv import fields, osv
from datetime import datetime
from dateutil.relativedelta import relativedelta
from osv import fields, osv
from tools.translate import _
import netsvc
class one2many_mod2(fields.one2many):
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):

View File

@ -1,15 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="sheet0" model="hr_timesheet_sheet.sheet">
<field name="name">Sheet 0</field>
<field name="user_id" ref="base.user_root"/>
<field name="employee_id" ref="hr.employee1" />
<field eval="time.strftime('%Y-%m-01', time.localtime(time.mktime(time.localtime()[0:2] + (0,)*7)-1))" name="date_from"/>
<field eval="time.strftime('%Y-%m-15', time.localtime(time.mktime(time.localtime()[0:2] + (0,)*7)-1))" name="date_current"/>
<field eval="time.strftime('%Y-%m-%d', time.localtime(time.mktime(time.localtime()[0:2] + (0,)*7)-1))" name="date_to"/>
</record>
<record id="sheet1" model="hr_timesheet_sheet.sheet">
<field name="name">Sheet 1</field>
<field name="user_id" ref="base.user_root"/>

View File

@ -1,41 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="html_view_form" model="ir.ui.view">
<field name="name">htmlform</field>
<field name="model">html.view</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Html Example">
<html>
<h2>This is Test Html Page </h2>
<table>
<tr>
<td>
Name :
</td>
<td>
<field name="name"/>
</td>
<td>
Company :
</td>
<td>
<field name="comp_id"/>
</td>
</tr>
</table>
<field name="bank_ids"/>
</html>
</form>
</field>
</record>
<record id="action_html_view_form" model="ir.actions.act_window">
<field name="name">Html Test</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">html.view</field>
<field name="view_type">form</field>
</record>
<menuitem action="action_html_view_form" id="html_form" parent="base.menu_address_book" sequence="40"/>
</data>
<data>
<record id="html_view_form" model="ir.ui.view">
<field name="name">htmlform</field>
<field name="model">html.view</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Html Example">
<html>
<h2>This is Test Html Page </h2>
<table>
<tr>
<td>
Name :
</td>
<td>
<field name="name"/>
</td>
<td>
Company :
</td>
<td>
<field name="comp_id"/>
</td>
</tr>
</table>
<field name="bank_ids"/>
</html>
</form>
</field>
</record>
<record id="action_html_view_form" model="ir.actions.act_window">
<field name="name">Html Test</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">html.view</field>
<field name="view_type">form</field>
</record>
<menuitem action="action_html_view_form" id="html_form" parent="base.menu_address_book" sequence="40"/>
</data>
</openerp>

View File

@ -11,7 +11,7 @@ company customize which Pad installation should be used to link to new pads
'author': 'OpenERP SA',
'website': 'http://openerp.com',
'depends': ['base'],
'update_xml': [
'data': [
'company_pad.xml'
],
'installable': True,

View File

@ -297,10 +297,10 @@ class purchase_order(osv.osv):
managers.append(manager.id)
for manager_id in managers:
request.create(cr, uid,{
'name' : "Purchase amount over the limit",
'name' : _("Purchase amount over the limit"),
'act_from' : uid,
'act_to' : manager_id,
'body': 'Somebody has just confirmed a purchase with an amount over the defined limit',
'body': _('Somebody has just confirmed a purchase with an amount over the defined limit'),
'ref_partner_id': po.partner_id.id,
'ref_doc1': 'purchase.order,%d' % (po.id,),
})

View File

@ -41,7 +41,7 @@
parent="base.menu_purchase_root" sequence="4"/>
<menuitem action="stock.action_picking_tree4" id="menu_action_picking_tree4" parent="menu_procurement_management_inventory"
name="Incoming Shipments" sequence="9"
groups="base.group_extended"/>
groups="base.group_extended"/>
<menuitem action="stock.action_reception_picking_move" id="menu_action_picking_tree_in_move"
parent="menu_procurement_management_inventory" sequence="11"/>
@ -147,8 +147,7 @@
<button name="purchase_confirm" states="draft" string="Convert to Purchase Order" icon="gtk-go-forward"/>
<button name="purchase_appbuyer" states="wait_auth" string="Approve Purchase" icon="gtk-ok"/>
<button name="purchase_approve" states="confirmed" string="Approved by Supplier" icon="gtk-go-forward"/>
<button name="%(report_purchase_order)d" string="Print" states="approved" type="action" icon="gtk-print"/>
<button name="%(report_purchase_order)d" string="Print" states="approved" type="action" icon="gtk-print"/>
</group>
</page>
<page string="Delivery &amp; Invoices" groups="base.group_extended">
@ -199,7 +198,7 @@
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10" groups="base.group_extended">
<filter string="Supplier" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical"/>
<filter string="Origin" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'origin'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
@ -377,10 +376,11 @@
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by' : 'partner_id'}" />
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by' : 'product_id'}" />
<filter string="Supplier" icon="terp-personal" domain="[]" context="{'group_by' : 'partner_id'}" />
<filter icon="terp-gtk-jump-to-rtl" string="Order Reference" domain="[]" context="{'group_by' :'order_id'}"/>
<separator orientation="vertical"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by' : 'state'}" />
</group>
</search>

View File

@ -49,5 +49,12 @@
<field name="groups" eval="[(4, ref('base.group_sale_salesman'))]"/>
</record>
<record model="ir.rule" id="sale_order_line_comp_rule">
<field name="name">Sale Shop multi-company</field>
<field name="model_id" ref="model_sale_shop"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
</data>
</openerp>
</openerp>