[MERGE] forward port of branch 7.0 up to 209ce6f
This commit is contained in:
commit
4a3c4713e9
|
@ -182,8 +182,10 @@
|
||||||
<field name="date_due"/>
|
<field name="date_due"/>
|
||||||
<field domain="[('company_id', '=', company_id), ('type', '=', 'payable')]"
|
<field domain="[('company_id', '=', company_id), ('type', '=', 'payable')]"
|
||||||
name="account_id" groups="account.group_account_user"/>
|
name="account_id" groups="account.group_account_user"/>
|
||||||
|
<field name="internal_number" invisible="1"/>
|
||||||
<field name="journal_id" groups="account.group_account_user"
|
<field name="journal_id" groups="account.group_account_user"
|
||||||
on_change="onchange_journal_id(journal_id, context)" options="{'no_create': True}"/>
|
on_change="onchange_journal_id(journal_id, context)" options="{'no_create': True}"
|
||||||
|
attrs="{'readonly':[('internal_number','!=',False)]}"/>
|
||||||
<field name="currency_id" groups="base.group_multi_currency"/>
|
<field name="currency_id" groups="base.group_multi_currency"/>
|
||||||
<field name="check_total" groups="account.group_supplier_inv_check_total"/>
|
<field name="check_total" groups="account.group_supplier_inv_check_total"/>
|
||||||
</group>
|
</group>
|
||||||
|
@ -328,8 +330,10 @@
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="date_invoice"/>
|
<field name="date_invoice"/>
|
||||||
|
<field name="internal_number" invisible="1"/>
|
||||||
<field name="journal_id" groups="account.group_account_user"
|
<field name="journal_id" groups="account.group_account_user"
|
||||||
on_change="onchange_journal_id(journal_id, context)" options="{'no_create': True}"/>
|
on_change="onchange_journal_id(journal_id, context)" options="{'no_create': True}"
|
||||||
|
attrs="{'readonly':[('internal_number','!=',False)]}"/>
|
||||||
<field domain="[('company_id', '=', company_id),('type','=', 'receivable')]"
|
<field domain="[('company_id', '=', company_id),('type','=', 'receivable')]"
|
||||||
name="account_id" groups="account.group_account_user"/>
|
name="account_id" groups="account.group_account_user"/>
|
||||||
|
|
||||||
|
|
|
@ -439,7 +439,7 @@ class account_move_line(osv.osv):
|
||||||
'debit': fields.float('Debit', digits_compute=dp.get_precision('Account')),
|
'debit': fields.float('Debit', digits_compute=dp.get_precision('Account')),
|
||||||
'credit': fields.float('Credit', digits_compute=dp.get_precision('Account')),
|
'credit': fields.float('Credit', digits_compute=dp.get_precision('Account')),
|
||||||
'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", domain=[('type','<>','view'), ('type', '<>', 'closed')], select=2),
|
'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", domain=[('type','<>','view'), ('type', '<>', 'closed')], select=2),
|
||||||
'move_id': fields.many2one('account.move', 'Journal Entry', ondelete="cascade", help="The move of this entry line.", select=2, required=True),
|
'move_id': fields.many2one('account.move', 'Journal Entry', ondelete="cascade", help="The move of this entry line.", select=2, required=True, auto_join=True),
|
||||||
'narration': fields.related('move_id','narration', type='text', relation='account.move', string='Internal Note'),
|
'narration': fields.related('move_id','narration', type='text', relation='account.move', string='Internal Note'),
|
||||||
'ref': fields.related('move_id', 'ref', string='Reference', type='char', size=64, store=True),
|
'ref': fields.related('move_id', 'ref', string='Reference', type='char', size=64, store=True),
|
||||||
'statement_id': fields.many2one('account.bank.statement', 'Statement', help="The bank statement used for bank reconciliation", select=1),
|
'statement_id': fields.many2one('account.bank.statement', 'Statement', help="The bank statement used for bank reconciliation", select=1),
|
||||||
|
|
|
@ -315,6 +315,7 @@ class res_partner(osv.osv):
|
||||||
('reconcile_id', '=', False),
|
('reconcile_id', '=', False),
|
||||||
('state', '!=', 'draft'),
|
('state', '!=', 'draft'),
|
||||||
('company_id', '=', company_id),
|
('company_id', '=', company_id),
|
||||||
|
('date_maturity', '<=', fields.date.context_today(self,cr,uid)),
|
||||||
], context=context):
|
], context=context):
|
||||||
raise osv.except_osv(_('Error!'),_("The partner does not have any accounting entries to print in the overdue report for the current company."))
|
raise osv.except_osv(_('Error!'),_("The partner does not have any accounting entries to print in the overdue report for the current company."))
|
||||||
self.message_post(cr, uid, [ids[0]], body=_('Printed overdue payments report'), context=context)
|
self.message_post(cr, uid, [ids[0]], body=_('Printed overdue payments report'), context=context)
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from openerp.osv import fields
|
||||||
|
|
||||||
from openerp.report import report_sxw
|
from openerp.report import report_sxw
|
||||||
|
|
||||||
|
@ -54,6 +55,7 @@ class report_rappel(report_sxw.rml_parse):
|
||||||
('reconcile_id', '=', False),
|
('reconcile_id', '=', False),
|
||||||
('state', '!=', 'draft'),
|
('state', '!=', 'draft'),
|
||||||
('company_id', '=', company_id),
|
('company_id', '=', company_id),
|
||||||
|
('date_maturity', '<=', fields.date.context_today(self,self.cr,self.uid)),
|
||||||
])
|
])
|
||||||
|
|
||||||
# lines_per_currency = {currency: [line data, ...], ...}
|
# lines_per_currency = {currency: [line data, ...], ...}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<field name="type" invisible="context.get('default_type', False)"/>
|
<field name="type" invisible="context.get('default_type', False)"/>
|
||||||
<field name="template_id" on_change="on_change_template(template_id,context)" domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
|
<field name="template_id" on_change="on_change_template(template_id,context)" domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
|
||||||
<field name="code"/>
|
<field name="code"/>
|
||||||
<field name="parent_id" on_change="on_change_parent(parent_id)" attrs="{'invisible': [('type','in',['contract'])]}"/>
|
<field name="parent_id" on_change="on_change_parent(parent_id)" />
|
||||||
<field name="company_id" on_change="on_change_company(company_id)" widget="selection" groups="base.group_multi_company" attrs="{'required': [('type','<>','view')]}"/>
|
<field name="company_id" on_change="on_change_company(company_id)" widget="selection" groups="base.group_multi_company" attrs="{'required': [('type','<>','view')]}"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
|
||||||
from openerp import tools
|
from openerp import tools, SUPERUSER_ID
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
|
|
||||||
class board_board(osv.osv):
|
class board_board(osv.osv):
|
||||||
|
@ -144,7 +144,7 @@ class board_create(osv.osv_memory):
|
||||||
''')
|
''')
|
||||||
}, context=context)
|
}, context=context)
|
||||||
|
|
||||||
menu_id = self.pool.get('ir.ui.menu').create(cr, uid, {
|
menu_id = self.pool.get('ir.ui.menu').create(cr, SUPERUSER_ID, {
|
||||||
'name': this.name,
|
'name': this.name,
|
||||||
'parent_id': this.menu_parent_id.id,
|
'parent_id': this.menu_parent_id.id,
|
||||||
'action': 'ir.actions.act_window,%s' % (action_id,)
|
'action': 'ir.actions.act_window,%s' % (action_id,)
|
||||||
|
|
|
@ -328,6 +328,7 @@ class crm_lead(format_address, osv.osv):
|
||||||
partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
|
partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
|
||||||
values = {
|
values = {
|
||||||
'partner_name': partner.name,
|
'partner_name': partner.name,
|
||||||
|
'title': partner.title and partner.title.id or False,
|
||||||
'street': partner.street,
|
'street': partner.street,
|
||||||
'street2': partner.street2,
|
'street2': partner.street2,
|
||||||
'city': partner.city,
|
'city': partner.city,
|
||||||
|
@ -338,6 +339,7 @@ class crm_lead(format_address, osv.osv):
|
||||||
'mobile': partner.mobile,
|
'mobile': partner.mobile,
|
||||||
'fax': partner.fax,
|
'fax': partner.fax,
|
||||||
'zip': partner.zip,
|
'zip': partner.zip,
|
||||||
|
'function': partner.function,
|
||||||
}
|
}
|
||||||
return {'value': values}
|
return {'value': values}
|
||||||
|
|
||||||
|
|
|
@ -528,12 +528,13 @@ class hr_timesheet_sheet_sheet_day(osv.osv):
|
||||||
MAX(id) as id,
|
MAX(id) as id,
|
||||||
name,
|
name,
|
||||||
sheet_id,
|
sheet_id,
|
||||||
|
timezone,
|
||||||
SUM(total_timesheet) as total_timesheet,
|
SUM(total_timesheet) as total_timesheet,
|
||||||
CASE WHEN SUM(total_attendance) < 0
|
CASE WHEN SUM(orphan_attendances) != 0
|
||||||
THEN (SUM(total_attendance) +
|
THEN (SUM(total_attendance) +
|
||||||
CASE WHEN current_date <> name
|
CASE WHEN current_date <> name
|
||||||
THEN 1440
|
THEN 1440
|
||||||
ELSE (EXTRACT(hour FROM current_time AT TIME ZONE 'UTC') * 60) + EXTRACT(minute FROM current_time AT TIME ZONE 'UTC')
|
ELSE (EXTRACT(hour FROM current_time AT TIME ZONE 'UTC' AT TIME ZONE coalesce(timezone, 'UTC')) * 60) + EXTRACT(minute FROM current_time AT TIME ZONE 'UTC' AT TIME ZONE coalesce(timezone, 'UTC'))
|
||||||
END
|
END
|
||||||
)
|
)
|
||||||
ELSE SUM(total_attendance)
|
ELSE SUM(total_attendance)
|
||||||
|
@ -542,21 +543,25 @@ class hr_timesheet_sheet_sheet_day(osv.osv):
|
||||||
((
|
((
|
||||||
select
|
select
|
||||||
min(hrt.id) as id,
|
min(hrt.id) as id,
|
||||||
|
'UTC' as timezone,
|
||||||
l.date::date as name,
|
l.date::date as name,
|
||||||
s.id as sheet_id,
|
s.id as sheet_id,
|
||||||
sum(l.unit_amount) as total_timesheet,
|
sum(l.unit_amount) as total_timesheet,
|
||||||
|
0 as orphan_attendances,
|
||||||
0.0 as total_attendance
|
0.0 as total_attendance
|
||||||
from
|
from
|
||||||
hr_analytic_timesheet hrt
|
hr_analytic_timesheet hrt
|
||||||
JOIN account_analytic_line l ON l.id = hrt.line_id
|
JOIN account_analytic_line l ON l.id = hrt.line_id
|
||||||
LEFT JOIN hr_timesheet_sheet_sheet s ON s.id = hrt.sheet_id
|
LEFT JOIN hr_timesheet_sheet_sheet s ON s.id = hrt.sheet_id
|
||||||
group by l.date::date, s.id
|
group by l.date::date, s.id, timezone
|
||||||
) union (
|
) union (
|
||||||
select
|
select
|
||||||
-min(a.id) as id,
|
-min(a.id) as id,
|
||||||
|
p.tz as timezone,
|
||||||
(a.name AT TIME ZONE 'UTC' AT TIME ZONE coalesce(p.tz, 'UTC'))::date as name,
|
(a.name AT TIME ZONE 'UTC' AT TIME ZONE coalesce(p.tz, 'UTC'))::date as name,
|
||||||
s.id as sheet_id,
|
s.id as sheet_id,
|
||||||
0.0 as total_timesheet,
|
0.0 as total_timesheet,
|
||||||
|
SUM(CASE WHEN a.action = 'sign_in' THEN -1 ELSE 1 END) as orphan_attendances,
|
||||||
SUM(((EXTRACT(hour FROM (a.name AT TIME ZONE 'UTC' AT TIME ZONE coalesce(p.tz, 'UTC'))) * 60) + EXTRACT(minute FROM (a.name AT TIME ZONE 'UTC' AT TIME ZONE coalesce(p.tz, 'UTC')))) * (CASE WHEN a.action = 'sign_in' THEN -1 ELSE 1 END)) as total_attendance
|
SUM(((EXTRACT(hour FROM (a.name AT TIME ZONE 'UTC' AT TIME ZONE coalesce(p.tz, 'UTC'))) * 60) + EXTRACT(minute FROM (a.name AT TIME ZONE 'UTC' AT TIME ZONE coalesce(p.tz, 'UTC')))) * (CASE WHEN a.action = 'sign_in' THEN -1 ELSE 1 END)) as total_attendance
|
||||||
from
|
from
|
||||||
hr_attendance a
|
hr_attendance a
|
||||||
|
@ -571,9 +576,9 @@ class hr_timesheet_sheet_sheet_day(osv.osv):
|
||||||
LEFT JOIN res_partner p
|
LEFT JOIN res_partner p
|
||||||
ON u.partner_id = p.id
|
ON u.partner_id = p.id
|
||||||
WHERE action in ('sign_in', 'sign_out')
|
WHERE action in ('sign_in', 'sign_out')
|
||||||
group by (a.name AT TIME ZONE 'UTC' AT TIME ZONE coalesce(p.tz, 'UTC'))::date, s.id
|
group by (a.name AT TIME ZONE 'UTC' AT TIME ZONE coalesce(p.tz, 'UTC'))::date, s.id, timezone
|
||||||
)) AS foo
|
)) AS foo
|
||||||
GROUP BY name, sheet_id
|
GROUP BY name, sheet_id, timezone
|
||||||
)) AS bar""")
|
)) AS bar""")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,35 @@
|
||||||
<field name="name">Volume</field>
|
<field name="name">Volume</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Precisions
|
||||||
|
-->
|
||||||
|
|
||||||
|
<record forcecreate="True" id="decimal_price" model="decimal.precision">
|
||||||
|
<field name="name">Product Price</field>
|
||||||
|
<field name="digits">2</field>
|
||||||
|
</record>
|
||||||
|
<record forcecreate="True" id="decimal_discount" model="decimal.precision">
|
||||||
|
<field name="name">Discount</field>
|
||||||
|
<field name="digits">2</field>
|
||||||
|
</record>
|
||||||
|
<record forcecreate="True" id="decimal_account" model="decimal.precision">
|
||||||
|
<field name="name">Account</field>
|
||||||
|
<field name="digits">2</field>
|
||||||
|
</record>
|
||||||
|
<record forcecreate="True" id="decimal_stock_weight" model="decimal.precision">
|
||||||
|
<field name="name">Stock Weight</field>
|
||||||
|
<field name="digits">2</field>
|
||||||
|
</record>
|
||||||
|
<record forcecreate="True" id="decimal_product_uom" model="decimal.precision">
|
||||||
|
<field name="name">Product Unit of Measure</field>
|
||||||
|
<field name="digits" eval="3"/>
|
||||||
|
</record>
|
||||||
|
<record forcecreate="True" id="decimal_product_uos" model="decimal.precision">
|
||||||
|
<field name="name">Product UoS</field>
|
||||||
|
<field name="digits" eval="3"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Resource: product.uom
|
Resource: product.uom
|
||||||
-->
|
-->
|
||||||
|
@ -163,30 +192,6 @@ parameter) will see those record just disappear.
|
||||||
<field eval="'product.pricelist,'+str(ref('list0'))" name="value"/>
|
<field eval="'product.pricelist,'+str(ref('list0'))" name="value"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record forcecreate="True" id="decimal_price" model="decimal.precision">
|
|
||||||
<field name="name">Product Price</field>
|
|
||||||
<field name="digits">2</field>
|
|
||||||
</record>
|
|
||||||
<record forcecreate="True" id="decimal_discount" model="decimal.precision">
|
|
||||||
<field name="name">Discount</field>
|
|
||||||
<field name="digits">2</field>
|
|
||||||
</record>
|
|
||||||
<record forcecreate="True" id="decimal_account" model="decimal.precision">
|
|
||||||
<field name="name">Account</field>
|
|
||||||
<field name="digits">2</field>
|
|
||||||
</record>
|
|
||||||
<record forcecreate="True" id="decimal_stock_weight" model="decimal.precision">
|
|
||||||
<field name="name">Stock Weight</field>
|
|
||||||
<field name="digits">2</field>
|
|
||||||
</record>
|
|
||||||
<record forcecreate="True" id="decimal_product_uom" model="decimal.precision">
|
|
||||||
<field name="name">Product Unit of Measure</field>
|
|
||||||
<field name="digits" eval="3"/>
|
|
||||||
</record>
|
|
||||||
<record forcecreate="True" id="decimal_product_uos" model="decimal.precision">
|
|
||||||
<field name="name">Product UoS</field>
|
|
||||||
<field name="digits" eval="3"/>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Product
|
Product
|
||||||
|
|
|
@ -316,7 +316,7 @@ class project(osv.osv):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
_constraints = [
|
_constraints = [
|
||||||
(_check_dates, 'Error! project start-date must be lower then project end-date.', ['date_start', 'date'])
|
(_check_dates, 'Error! project start-date must be lower than project end-date.', ['date_start', 'date'])
|
||||||
]
|
]
|
||||||
|
|
||||||
def set_template(self, cr, uid, ids, context=None):
|
def set_template(self, cr, uid, ids, context=None):
|
||||||
|
@ -872,7 +872,7 @@ class task(osv.osv):
|
||||||
|
|
||||||
_constraints = [
|
_constraints = [
|
||||||
(_check_recursion, 'Error ! You cannot create recursive tasks.', ['parent_ids']),
|
(_check_recursion, 'Error ! You cannot create recursive tasks.', ['parent_ids']),
|
||||||
(_check_dates, 'Error ! Task end-date must be greater then task start-date', ['date_start','date_end'])
|
(_check_dates, 'Error ! Task end-date must be greater than task start-date', ['date_start','date_end'])
|
||||||
]
|
]
|
||||||
|
|
||||||
# Override view according to the company definition
|
# Override view according to the company definition
|
||||||
|
|
|
@ -148,6 +148,19 @@ class purchase_order(osv.osv):
|
||||||
limit=1)
|
limit=1)
|
||||||
return res and res[0] or False
|
return res and res[0] or False
|
||||||
|
|
||||||
|
def _has_non_stockable_item(self, cr, uid, ids, *args):
|
||||||
|
res = dict.fromkeys(ids, False)
|
||||||
|
for order in self.browse(cr, uid, ids):
|
||||||
|
for order_line in order.order_line:
|
||||||
|
if (
|
||||||
|
not order_line.product_id
|
||||||
|
or
|
||||||
|
order_line.product_id
|
||||||
|
and order_line.product_id.type not in ('product', 'consu')
|
||||||
|
):
|
||||||
|
res[order.id] = True
|
||||||
|
return res
|
||||||
|
|
||||||
STATE_SELECTION = [
|
STATE_SELECTION = [
|
||||||
('draft', 'Draft PO'),
|
('draft', 'Draft PO'),
|
||||||
('sent', 'RFQ Sent'),
|
('sent', 'RFQ Sent'),
|
||||||
|
@ -224,6 +237,7 @@ class purchase_order(osv.osv):
|
||||||
'create_uid': fields.many2one('res.users', 'Responsible'),
|
'create_uid': fields.many2one('res.users', 'Responsible'),
|
||||||
'company_id': fields.many2one('res.company','Company',required=True,select=1, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}),
|
'company_id': fields.many2one('res.company','Company',required=True,select=1, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}),
|
||||||
'journal_id': fields.many2one('account.journal', 'Journal'),
|
'journal_id': fields.many2one('account.journal', 'Journal'),
|
||||||
|
'has_non_stockable_item': fields.function(_has_non_stockable_item, method=True, type='boolean', string='Contains a non-stockable item'),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'date_order': fields.date.context_today,
|
'date_order': fields.date.context_today,
|
||||||
|
@ -408,6 +422,7 @@ class purchase_order(osv.osv):
|
||||||
})
|
})
|
||||||
return action
|
return action
|
||||||
|
|
||||||
|
|
||||||
def wkf_approve_order(self, cr, uid, ids, context=None):
|
def wkf_approve_order(self, cr, uid, ids, context=None):
|
||||||
self.write(cr, uid, ids, {'state': 'approved', 'date_approve': fields.date.context_today(self,cr,uid,context=context)})
|
self.write(cr, uid, ids, {'state': 'approved', 'date_approve': fields.date.context_today(self,cr,uid,context=context)})
|
||||||
return True
|
return True
|
||||||
|
@ -473,6 +488,10 @@ class purchase_order(osv.osv):
|
||||||
for po in self.browse(cr, uid, ids, context=context):
|
for po in self.browse(cr, uid, ids, context=context):
|
||||||
if not po.order_line:
|
if not po.order_line:
|
||||||
raise osv.except_osv(_('Error!'),_('You cannot confirm a purchase order without any purchase order line.'))
|
raise osv.except_osv(_('Error!'),_('You cannot confirm a purchase order without any purchase order line.'))
|
||||||
|
if po.invoice_method == 'picking' and po.has_non_stockable_item is True:
|
||||||
|
raise osv.except_osv(
|
||||||
|
_('Error!'),
|
||||||
|
_("You cannot confirm a purchase order with Invoice Control Method 'Based on incoming shipments' that contains non-stockable items."))
|
||||||
for line in po.order_line:
|
for line in po.order_line:
|
||||||
if line.state=='draft':
|
if line.state=='draft':
|
||||||
todo.append(line.id)
|
todo.append(line.id)
|
||||||
|
|
|
@ -605,6 +605,14 @@ class sale_order_line(osv.osv):
|
||||||
res['value'].update({'product_packaging': False})
|
res['value'].update({'product_packaging': False})
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
# set product uom in context to get virtual stock in current uom
|
||||||
|
if res.get('value', {}).get('product_uom'):
|
||||||
|
# use the uom changed by super call
|
||||||
|
context.update({'uom': res['value']['product_uom']})
|
||||||
|
elif uom:
|
||||||
|
# fallback on selected
|
||||||
|
context.update({'uom': uom})
|
||||||
|
|
||||||
#update of result obtained in super function
|
#update of result obtained in super function
|
||||||
product_obj = product_obj.browse(cr, uid, product, context=context)
|
product_obj = product_obj.browse(cr, uid, product, context=context)
|
||||||
res['value']['delay'] = (product_obj.sale_delay or 0.0)
|
res['value']['delay'] = (product_obj.sale_delay or 0.0)
|
||||||
|
|
|
@ -1583,7 +1583,7 @@ class Export(http.Controller):
|
||||||
fields['.id'] = fields.pop('id', {'string': 'ID'})
|
fields['.id'] = fields.pop('id', {'string': 'ID'})
|
||||||
|
|
||||||
fields_sequence = sorted(fields.iteritems(),
|
fields_sequence = sorted(fields.iteritems(),
|
||||||
key=lambda field: field[1].get('string', ''))
|
key=lambda field: openerp.tools.ustr(field[1].get('string', '')))
|
||||||
|
|
||||||
records = []
|
records = []
|
||||||
for field_name, field in fields_sequence:
|
for field_name, field in fields_sequence:
|
||||||
|
|
|
@ -255,7 +255,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
||||||
this.dataset.ids.push(state.id);
|
this.dataset.ids.push(state.id);
|
||||||
}
|
}
|
||||||
this.dataset.select_id(state.id);
|
this.dataset.select_id(state.id);
|
||||||
this.do_show({ reload: warm });
|
this.do_show();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -2660,6 +2660,7 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we
|
||||||
this.$textarea = this.$el.find('textarea');
|
this.$textarea = this.$el.find('textarea');
|
||||||
this.auto_sized = false;
|
this.auto_sized = false;
|
||||||
this.default_height = this.$textarea.css('height');
|
this.default_height = this.$textarea.css('height');
|
||||||
|
if (this.default_height === '0px') this.default_height = '90px';
|
||||||
if (this.get("effective_readonly")) {
|
if (this.get("effective_readonly")) {
|
||||||
this.$textarea.attr('disabled', 'disabled');
|
this.$textarea.attr('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,21 +299,24 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
|
||||||
this.$pager
|
this.$pager
|
||||||
.on('click', 'a[data-pager-action]', function () {
|
.on('click', 'a[data-pager-action]', function () {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var max_page = Math.floor(self.dataset.size() / self.limit());
|
var max_page_index = Math.ceil(self.dataset.size() / self.limit()) - 1;
|
||||||
switch ($this.data('pager-action')) {
|
switch ($this.data('pager-action')) {
|
||||||
case 'first':
|
case 'first':
|
||||||
self.page = 0; break;
|
self.page = 0;
|
||||||
|
break;
|
||||||
case 'last':
|
case 'last':
|
||||||
self.page = max_page - 1;
|
self.page = max_page_index;
|
||||||
break;
|
break;
|
||||||
case 'next':
|
case 'next':
|
||||||
self.page += 1; break;
|
self.page += 1;
|
||||||
|
break;
|
||||||
case 'previous':
|
case 'previous':
|
||||||
self.page -= 1; break;
|
self.page -= 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (self.page < 0) {
|
if (self.page < 0) {
|
||||||
self.page = max_page;
|
self.page = max_page_index;
|
||||||
} else if (self.page > max_page) {
|
} else if (self.page > max_page_index) {
|
||||||
self.page = 0;
|
self.page = 0;
|
||||||
}
|
}
|
||||||
self.reload_content();
|
self.reload_content();
|
||||||
|
|
|
@ -109,7 +109,9 @@ class ir_attachment(osv.osv):
|
||||||
return fname
|
return fname
|
||||||
|
|
||||||
def _file_delete(self, cr, uid, location, fname):
|
def _file_delete(self, cr, uid, location, fname):
|
||||||
count = self.search(cr, 1, [('store_fname','=',fname)], count=True)
|
# using SQL to include files hidden through unlink or due to record rules
|
||||||
|
cr.execute("SELECT COUNT(*) FROM ir_attachment WHERE store_fname = %s", (fname,))
|
||||||
|
count = cr.fetchone()[0]
|
||||||
if count <= 1:
|
if count <= 1:
|
||||||
full_path = self._full_path(cr, uid, location, fname)
|
full_path = self._full_path(cr, uid, location, fname)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -118,12 +118,13 @@ class ir_filters(osv.osv):
|
||||||
]
|
]
|
||||||
|
|
||||||
def _auto_init(self, cr, context=None):
|
def _auto_init(self, cr, context=None):
|
||||||
super(ir_filters, self)._auto_init(cr, context)
|
result = super(ir_filters, self)._auto_init(cr, context)
|
||||||
# Use unique index to implement unique constraint on the lowercase name (not possible using a constraint)
|
# Use unique index to implement unique constraint on the lowercase name (not possible using a constraint)
|
||||||
cr.execute("SELECT indexname FROM pg_indexes WHERE indexname = 'ir_filters_name_model_uid_unique_index'")
|
cr.execute("SELECT indexname FROM pg_indexes WHERE indexname = 'ir_filters_name_model_uid_unique_index'")
|
||||||
if not cr.fetchone():
|
if not cr.fetchone():
|
||||||
cr.execute("""CREATE UNIQUE INDEX "ir_filters_name_model_uid_unique_index" ON ir_filters
|
cr.execute("""CREATE UNIQUE INDEX "ir_filters_name_model_uid_unique_index" ON ir_filters
|
||||||
(lower(name), model_id, COALESCE(user_id,-1))""")
|
(lower(name), model_id, COALESCE(user_id,-1))""")
|
||||||
|
return result
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Filter Name', size=64, translate=True, required=True),
|
'name': fields.char('Filter Name', size=64, translate=True, required=True),
|
||||||
|
|
Loading…
Reference in New Issue