[MERGE] forward port of branch 8.0 up to 6140300

This commit is contained in:
Christophe Simonis
2016-06-07 18:01:12 +02:00
2 changed files with 5 additions and 4 deletions
@@ -665,7 +665,7 @@ class account_analytic_account(osv.osv):
if not partner:
raise UserError(_("You must first select a Customer for Contract %s!") % contract.name )
fpos_id = fpos_obj.get_fiscal_position(cr, uid, partner.company_id.id, partner.id, context=context)
fpos_id = fpos_obj.get_fiscal_position(cr, uid, context.get('force_company') or partner.company_id.id, partner.id, context=context)
journal_ids = journal_obj.search(cr, uid, [('type', '=','sale'),('company_id', '=', contract.company_id.id or False)], limit=1)
if not journal_ids:
raise UserError(_('Please define a sale journal for the company "%s".') % (contract.company_id.name or '', ))
@@ -751,9 +751,10 @@ class account_analytic_account(osv.osv):
if contract_ids:
cr.execute('SELECT company_id, array_agg(id) as ids FROM account_analytic_account WHERE id IN %s GROUP BY company_id', (tuple(contract_ids),))
for company_id, ids in cr.fetchall():
for contract in self.browse(cr, uid, ids, context=dict(context, company_id=company_id, force_company=company_id)):
context_contract = dict(context, company_id=company_id, force_company=company_id)
for contract in self.browse(cr, uid, ids, context=context_contract):
try:
invoice_values = self._prepare_invoice(cr, uid, contract, context=context)
invoice_values = self._prepare_invoice(cr, uid, contract, context=context_contract)
invoice_ids.append(self.pool['account.invoice'].create(cr, uid, invoice_values, context=context))
next_date = datetime.datetime.strptime(contract.recurring_next_date or current_date, "%Y-%m-%d")
interval = contract.recurring_interval
+1 -1
View File
@@ -174,11 +174,11 @@
<label for="employee_id" class="oe_edit_only"/>
<h1>
<field name="employee_id" class="oe_inline" attrs="{'readonly': [('state', '=', 'done')]}" on_change="onchange_employee_id(employee_id)"/>
<field name="date" attrs="{'readonly': [('state', '=', 'done')]}"/>
</h1>
<label for="plan_id" class="oe_edit_only"/>
<h2><field name="plan_id" attrs="{'readonly': [('state', '=', 'done')]}"/></h2>
<group>
<field name="date" attrs="{'readonly': [('state', '=', 'done')]}"/>
<group colspan="4" attrs="{'invisible':['|', ('state','=','draft'), ('state', '=', 'wait')]}">
<field name="rating" attrs="{'readonly':[('state','&lt;&gt;','progress')]}"/>
<field name="date_close" readonly="1"/>