[MERGE] Forward-port 7.0 up to 23cffab
This commit is contained in:
commit
b9275da8a5
|
@ -26,6 +26,7 @@ import openerp.exceptions
|
|||
|
||||
from openerp.osv import fields, osv, orm
|
||||
from openerp.tools.translate import _
|
||||
from openerp import SUPERUSER_ID
|
||||
|
||||
class account_invoice(osv.osv):
|
||||
def _amount_all(self, cr, uid, ids, name, args, context=None):
|
||||
|
@ -98,7 +99,7 @@ class account_invoice(osv.osv):
|
|||
ctx = context.copy()
|
||||
result = {}
|
||||
currency_obj = self.pool.get('res.currency')
|
||||
for invoice in self.browse(cr, uid, ids, context=context):
|
||||
for invoice in self.browse(cr, SUPERUSER_ID, ids, context=context):
|
||||
nb_inv_in_partial_rec = max_invoice_id = 0
|
||||
result[invoice.id] = 0.0
|
||||
if invoice.move_id:
|
||||
|
@ -319,7 +320,7 @@ class account_invoice(osv.osv):
|
|||
'account.move.reconcile': (_get_invoice_from_reconcile, None, 50),
|
||||
},
|
||||
help="Remaining amount due."),
|
||||
'payment_ids': fields.function(_compute_lines, relation='account.move.line', type="many2many", string='Payments'),
|
||||
'payment_ids': fields.function(_compute_lines, relation='account.move.line', type="many2many", string='Payments', groups='base.group_user'),
|
||||
'move_name': fields.char('Journal Entry', size=64, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'user_id': fields.many2one('res.users', 'Salesperson', readonly=True, track_visibility='onchange', states={'draft':[('readonly',False)]}),
|
||||
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
|
|
|
@ -273,7 +273,7 @@ class res_partner(osv.osv):
|
|||
if date <= current_date and aml['balance'] > 0:
|
||||
strbegin = "<TD><B>"
|
||||
strend = "</B></TD>"
|
||||
followup_table +="<TR>" + strbegin + str(aml['date']) + strend + strbegin + aml['name'] + strend + strbegin + aml['ref'] + strend + strbegin + str(date) + strend + strbegin + str(aml['balance']) + strend + strbegin + block + strend + "</TR>"
|
||||
followup_table +="<TR>" + strbegin + str(aml['date']) + strend + strbegin + aml['name'] + strend + strbegin + (aml['ref'] or '') + strend + strbegin + str(date) + strend + strbegin + str(aml['balance']) + strend + strbegin + block + strend + "</TR>"
|
||||
total = rml_parse.formatLang(total, dp='Account', currency_obj=currency)
|
||||
followup_table += '''<tr> </tr>
|
||||
</table>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
##############################################################################
|
||||
|
||||
from openerp.osv import osv, fields
|
||||
from openerp import SUPERUSER_ID
|
||||
|
||||
|
||||
class sale_order(osv.Model):
|
||||
|
@ -35,7 +36,7 @@ class sale_order(osv.Model):
|
|||
def _portal_payment_block(self, cr, uid, ids, fieldname, arg, context=None):
|
||||
result = dict.fromkeys(ids, False)
|
||||
payment_acquirer = self.pool['payment.acquirer']
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
for this in self.browse(cr, SUPERUSER_ID, ids, context=context):
|
||||
if this.state not in ('draft', 'cancel') and not this.invoiced:
|
||||
result[this.id] = payment_acquirer.render_payment_block(
|
||||
cr, uid, this.name, this.amount_total, this.pricelist_id.currency_id.id,
|
||||
|
|
|
@ -5,16 +5,8 @@ access_account_invoice,account.invoice,account.model_account_invoice,base.group_
|
|||
access_account_invoice_tax,account.invoice.tax,account.model_account_invoice_tax,base.group_portal,1,0,0,0
|
||||
access_account_invoice_line,account.invoice.line,account.model_account_invoice_line,base.group_portal,1,0,0,0
|
||||
access_account_journal,account.journal,account.model_account_journal,base.group_portal,1,0,0,0
|
||||
access_account_voucher,account.voucher,account_voucher.model_account_voucher,base.group_portal,1,0,0,0
|
||||
access_account_voucher_line,account.voucher.line,account_voucher.model_account_voucher_line,base.group_portal,1,0,0,0
|
||||
access_account_move,account.move,account.model_account_move,base.group_portal,1,0,0,0
|
||||
access_account_move_line,account.move.line,account.model_account_move_line,base.group_portal,1,0,0,0
|
||||
access_account_move_reconcile,account.move.reconcile,account.model_account_move_reconcile,base.group_portal,1,0,0,0
|
||||
access_account_fiscalyear,account.sequence.fiscalyear,account.model_account_sequence_fiscalyear,base.group_portal,1,0,0,0
|
||||
access_sale_shop,sale.shop,sale.model_sale_shop,base.group_portal,1,0,0,0
|
||||
access_product_list,product.pricelist,product.model_product_pricelist,base.group_portal,1,0,0,0
|
||||
access_res_partner,res.partner,base.model_res_partner,base.group_portal,1,0,0,0
|
||||
access_account_tax,account.tax,account.model_account_tax,base.group_portal,1,0,0,0
|
||||
access_account_fiscalyear,account.fiscalyear,account.model_account_fiscalyear,base.group_portal,1,0,0,0
|
||||
access_res_partner_category,res.partner.category,base.model_res_partner_category,base.group_portal,1,0,0,0
|
||||
access_account_period,account.period,account.model_account_period,base.group_portal,1,0,0,0
|
||||
access_account_account,account.account,account.model_account_account,base.group_portal,1,0,0,0
|
||||
|
|
|
|
@ -18,7 +18,7 @@ their documents through the portal.</field>
|
|||
<record id="portal_sale_order_user_rule" model="ir.rule">
|
||||
<field name="name">Portal Personal Quotations/Sales Orders</field>
|
||||
<field name="model_id" ref="sale.model_sale_order"/>
|
||||
<field name="domain_force">[('message_follower_ids','in',[user.partner_id.id])]</field>
|
||||
<field name="domain_force">[('message_follower_ids','child_of',[user.commercial_partner_id.id])]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
<field eval="1" name="perm_unlink"/>
|
||||
<field eval="1" name="perm_write"/>
|
||||
|
@ -26,17 +26,31 @@ their documents through the portal.</field>
|
|||
<field eval="0" name="perm_create"/>
|
||||
</record>
|
||||
|
||||
<record id="portal_sale_order_line_rule" model="ir.rule">
|
||||
<field name="name">Portal Sales Orders Line</field>
|
||||
<field name="model_id" ref="sale.model_sale_order_line"/>
|
||||
<field name="domain_force">[('order_id.message_follower_ids','child_of',[user.commercial_partner_id.id])]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="portal_account_invoice_user_rule" model="ir.rule">
|
||||
<field name="name">Portal Personal Account Invoices</field>
|
||||
<field name="model_id" ref="account.model_account_invoice"/>
|
||||
<field name="domain_force">[('message_follower_ids','in',[user.partner_id.id])]</field>
|
||||
<field name="domain_force">[('message_follower_ids','child_of',[user.commercial_partner_id.id])]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
|
||||
<record id="portal_account_invoice_line_rule" model="ir.rule">
|
||||
<field name="name">Portal Invoice Lines</field>
|
||||
<field name="model_id" ref="account.model_account_invoice_line"/>
|
||||
<field name="domain_force">[('invoice_id.message_follower_ids','child_of',[user.commercial_partner_id.id])]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
</record>
|
||||
|
||||
<record id="portal_personal_contact" model="ir.rule">
|
||||
<field name="name">Portal Personal Contacts</field>
|
||||
<field name="model_id" ref="base.model_res_partner"/>
|
||||
<field name="domain_force">[('message_follower_ids','in',[user.partner_id.id])]</field>
|
||||
<field name="domain_force">[('message_follower_ids','in',[user.commercial_partner_id.id])]</field>
|
||||
<field eval="0" name="perm_read"/>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
</record>
|
||||
|
|
|
@ -1709,16 +1709,18 @@ class ExportFormat(object):
|
|||
raise NotImplementedError()
|
||||
|
||||
def base(self, data, token):
|
||||
params = simplejson.loads(data)
|
||||
model, fields, ids, domain, import_compat = \
|
||||
operator.itemgetter('model', 'fields', 'ids', 'domain',
|
||||
'import_compat')(
|
||||
simplejson.loads(data))
|
||||
params)
|
||||
|
||||
Model = request.session.model(model)
|
||||
ids = ids or Model.search(domain, 0, False, False, request.context)
|
||||
context = dict(req.context or {}, **params.get('context', {}))
|
||||
ids = ids or Model.search(domain, 0, False, False, context)
|
||||
|
||||
field_names = map(operator.itemgetter('name'), fields)
|
||||
import_data = Model.export_data(ids, field_names, request.context).get('datas',[])
|
||||
import_data = Model.export_data(ids, field_names, context).get('datas',[])
|
||||
|
||||
if import_compat:
|
||||
columns_headers = field_names
|
||||
|
|
|
@ -407,6 +407,7 @@ instance.web.DataExport = instance.web.Dialog.extend({
|
|||
fields: exported_fields,
|
||||
ids: this.ids_to_export,
|
||||
domain: this.domain,
|
||||
context: this.dataset.context,
|
||||
import_compat: !!this.$el.find("#import_compat").val(),
|
||||
})},
|
||||
complete: instance.web.unblockUI,
|
||||
|
|
|
@ -159,8 +159,8 @@ class ir_cron(osv.osv):
|
|||
must not be committed/rolled back!
|
||||
"""
|
||||
try:
|
||||
now = fields.datetime.context_timestamp(job_cr, SUPERUSER_ID, datetime.now())
|
||||
nextcall = fields.datetime.context_timestamp(job_cr, SUPERUSER_ID, datetime.strptime(job['nextcall'], DEFAULT_SERVER_DATETIME_FORMAT))
|
||||
now = fields.datetime.context_timestamp(job_cr, job['user_id'], datetime.now())
|
||||
nextcall = fields.datetime.context_timestamp(job_cr, job['user_id'], datetime.strptime(job['nextcall'], DEFAULT_SERVER_DATETIME_FORMAT))
|
||||
numbercall = job['numbercall']
|
||||
|
||||
ok = False
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
<group col="4">
|
||||
<field name="name"/>
|
||||
<field name="shortcut"/>
|
||||
<field name="domain"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
@ -184,8 +183,7 @@
|
|||
<field name="fax"/>
|
||||
<field name="user_ids" invisible="1"/>
|
||||
<field name="email" widget="email" attrs="{'required': [('user_ids','!=', [])]}"/>
|
||||
<field name="title" domain="[('domain','=','contact')]" options='{"no_open": True}' attrs="{'invisible': [('is_company','=',True)]}" context="{'default_domain': 'contact'}"/>
|
||||
<field name="title" domain="[('domain','=','partner')]" options='{"no_open": True}' attrs="{'invisible': [('is_company','=',False)]}" context="{'default_domain': 'partner'}"/>
|
||||
<field name="title" domain="[('domain', '=', 'contact')]" options='{"no_open": True}'/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
|
|
|
@ -396,17 +396,16 @@ class datetime(_column):
|
|||
else:
|
||||
registry = openerp.modules.registry.RegistryManager.get(cr.dbname)
|
||||
tz_name = registry.get('res.users').read(cr, SUPERUSER_ID, uid, ['tz'])['tz']
|
||||
utc_timestamp = pytz.utc.localize(timestamp, is_dst=False) # UTC = no DST
|
||||
if tz_name:
|
||||
try:
|
||||
utc = pytz.timezone('UTC')
|
||||
context_tz = pytz.timezone(tz_name)
|
||||
utc_timestamp = utc.localize(timestamp, is_dst=False) # UTC = no DST
|
||||
return utc_timestamp.astimezone(context_tz)
|
||||
except Exception:
|
||||
_logger.debug("failed to compute context/client-specific timestamp, "
|
||||
"using the UTC value",
|
||||
exc_info=True)
|
||||
return timestamp
|
||||
return utc_timestamp
|
||||
|
||||
class binary(_column):
|
||||
_type = 'binary'
|
||||
|
|
Loading…
Reference in New Issue