[MERGE] forward port branch 10.0 up to 482fd04167
This commit is contained in:
@@ -350,6 +350,26 @@ class AccountChartTemplate(models.Model):
|
|||||||
new_xml_id = str(company.id)+'_'+template_xmlid.name
|
new_xml_id = str(company.id)+'_'+template_xmlid.name
|
||||||
return ir_model_data._update(model, template_xmlid.module, vals, xml_id=new_xml_id, store=True, noupdate=True, mode='init', res_id=False)
|
return ir_model_data._update(model, template_xmlid.module, vals, xml_id=new_xml_id, store=True, noupdate=True, mode='init', res_id=False)
|
||||||
|
|
||||||
|
def _get_account_vals(self, company, account_template, code_acc, tax_template_ref):
|
||||||
|
""" This method generates a dictionnary of all the values for the account that will be created.
|
||||||
|
"""
|
||||||
|
self.ensure_one()
|
||||||
|
tax_ids = []
|
||||||
|
for tax in account_template.tax_ids:
|
||||||
|
tax_ids.append(tax_template_ref[tax.id])
|
||||||
|
val = {
|
||||||
|
'name': account_template.name,
|
||||||
|
'currency_id': account_template.currency_id and account_template.currency_id.id or False,
|
||||||
|
'code': code_acc,
|
||||||
|
'user_type_id': account_template.user_type_id and account_template.user_type_id.id or False,
|
||||||
|
'reconcile': account_template.reconcile,
|
||||||
|
'note': account_template.note,
|
||||||
|
'tax_ids': [(6, 0, tax_ids)],
|
||||||
|
'company_id': company.id,
|
||||||
|
'tag_ids': [(6, 0, [t.id for t in account_template.tag_ids])],
|
||||||
|
}
|
||||||
|
return val
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def generate_account(self, tax_template_ref, acc_template_ref, code_digits, company):
|
def generate_account(self, tax_template_ref, acc_template_ref, code_digits, company):
|
||||||
""" This method for generating accounts from templates.
|
""" This method for generating accounts from templates.
|
||||||
@@ -365,25 +385,11 @@ class AccountChartTemplate(models.Model):
|
|||||||
account_tmpl_obj = self.env['account.account.template']
|
account_tmpl_obj = self.env['account.account.template']
|
||||||
acc_template = account_tmpl_obj.search([('nocreate', '!=', True), ('chart_template_id', '=', self.id)], order='id')
|
acc_template = account_tmpl_obj.search([('nocreate', '!=', True), ('chart_template_id', '=', self.id)], order='id')
|
||||||
for account_template in acc_template:
|
for account_template in acc_template:
|
||||||
tax_ids = []
|
|
||||||
for tax in account_template.tax_ids:
|
|
||||||
tax_ids.append(tax_template_ref[tax.id])
|
|
||||||
|
|
||||||
code_main = account_template.code and len(account_template.code) or 0
|
code_main = account_template.code and len(account_template.code) or 0
|
||||||
code_acc = account_template.code or ''
|
code_acc = account_template.code or ''
|
||||||
if code_main > 0 and code_main <= code_digits:
|
if code_main > 0 and code_main <= code_digits:
|
||||||
code_acc = str(code_acc) + (str('0'*(code_digits-code_main)))
|
code_acc = str(code_acc) + (str('0'*(code_digits-code_main)))
|
||||||
vals = {
|
vals = self._get_account_vals(company, account_template, code_acc, tax_template_ref)
|
||||||
'name': account_template.name,
|
|
||||||
'currency_id': account_template.currency_id and account_template.currency_id.id or False,
|
|
||||||
'code': code_acc,
|
|
||||||
'user_type_id': account_template.user_type_id and account_template.user_type_id.id or False,
|
|
||||||
'reconcile': account_template.reconcile,
|
|
||||||
'note': account_template.note,
|
|
||||||
'tax_ids': [(6, 0, tax_ids)],
|
|
||||||
'company_id': company.id,
|
|
||||||
'tag_ids': [(6, 0, [t.id for t in account_template.tag_ids])],
|
|
||||||
}
|
|
||||||
new_account = self.create_record_with_xmlid(company, account_template, 'account.account', vals)
|
new_account = self.create_record_with_xmlid(company, account_template, 'account.account', vals)
|
||||||
acc_template_ref[account_template.id] = new_account
|
acc_template_ref[account_template.id] = new_account
|
||||||
return acc_template_ref
|
return acc_template_ref
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
<th>Terms & Conditions</th>
|
<th>Terms & Conditions</th>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
<a class="fa fa-arrow-right" t-attf-href="#{prepare_backend_url('sales_team.action_sale_config', 'form')}&id=#{company_id.id}" target="_blank">
|
<a class="fa fa-arrow-right" t-attf-href="#{prepare_backend_url('sales_team.action_sale_config', 'form')}" target="_blank">
|
||||||
Change
|
Change
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ var FormViewBarcodeHandler = common.AbstractField.extend(BarcodeHandlerMixin, {
|
|||||||
this.__quantity_listener = _.bind(this._set_quantity_listener, this);
|
this.__quantity_listener = _.bind(this._set_quantity_listener, this);
|
||||||
BarcodeHandlerMixin.init.apply(this, arguments);
|
BarcodeHandlerMixin.init.apply(this, arguments);
|
||||||
|
|
||||||
|
this.process_barcode_mutex = new utils.Mutex();
|
||||||
|
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -153,25 +155,35 @@ var FormViewBarcodeHandler = common.AbstractField.extend(BarcodeHandlerMixin, {
|
|||||||
else if (this.form_view.get('actual_mode') === 'view')
|
else if (this.form_view.get('actual_mode') === 'view')
|
||||||
this._display_no_edit_mode_warning();
|
this._display_no_edit_mode_warning();
|
||||||
else {
|
else {
|
||||||
// Call hook method possibly implemented by subclass
|
var process_barcode = function () {
|
||||||
this.pre_onchange_hook(barcode).then(function(proceed) {
|
// this function can be passed to `Mutex.exec` in order to make sure
|
||||||
if (proceed === true) {
|
// that every ongoing onchanges in the form view are done
|
||||||
// Wait for hypothetical ongoing onchange to finish
|
var form_onchanges_mutex = function () {
|
||||||
self.form_view.onchanges_mutex.exec(function() {
|
return self.form_view.onchanges_mutex.def;
|
||||||
// A real onchange is triggered when a value actually changes (which can correspond
|
|
||||||
// to a widget's blur event per example). Commit the value of fields before
|
|
||||||
// programmatically triggering an onchange to be consistent with this.
|
|
||||||
var mutex_commit_value = new utils.Mutex();
|
|
||||||
_.each(self.form_view.fields, function(field) {
|
|
||||||
mutex_commit_value.exec(_.bind(field.commit_value, field));
|
|
||||||
});
|
|
||||||
return mutex_commit_value.def.then(function(){
|
|
||||||
// Trigger the barcode onchange
|
|
||||||
self.set_value(barcode);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
// before setting the barcode field with the received barcode, we commit
|
||||||
|
// every fields of the form view and we wait for their hypothetical ongoing
|
||||||
|
// onchanges to finish
|
||||||
|
var commit_mutex = new utils.Mutex();
|
||||||
|
_.each(self.form_view.fields, function (field) {
|
||||||
|
commit_mutex.exec(function () {
|
||||||
|
return field.commit_value();
|
||||||
|
});
|
||||||
|
commit_mutex.exec(form_onchanges_mutex);
|
||||||
|
});
|
||||||
|
|
||||||
|
return commit_mutex.def.then(function () {
|
||||||
|
return self.pre_onchange_hook(barcode).then(function (proceed) {
|
||||||
|
if (proceed) {
|
||||||
|
self.set_value(barcode); // set the barcode field with the received one
|
||||||
|
return form_onchanges_mutex(); // wait for its onchange to finish
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
this.process_barcode_mutex.exec(process_barcode);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -402,6 +402,20 @@ class GoogleCalendar(models.AbstractModel):
|
|||||||
data_json = json.dumps(data)
|
data_json = json.dumps(data)
|
||||||
return self.env['google.service']._do_request(url, data_json, headers, type='PUT')
|
return self.env['google.service']._do_request(url, data_json, headers, type='PUT')
|
||||||
|
|
||||||
|
def create_from_google(self, event, partner_id):
|
||||||
|
context_tmp = dict(self._context, NewMeeting=True)
|
||||||
|
res = self.with_context(context_tmp).update_from_google(False, event.GG.event, "create")
|
||||||
|
event.OE.event_id = res
|
||||||
|
meeting = self.env['calendar.event'].browse(res)
|
||||||
|
attendee_record = self.env['calendar.attendee'].search([('partner_id', '=', partner_id), ('event_id', '=', res)])
|
||||||
|
attendee_record.with_context(context_tmp).write({'oe_synchro_date': meeting.oe_update_date, 'google_internal_event_id': event.GG.event['id']})
|
||||||
|
if meeting.recurrency:
|
||||||
|
attendees = self.env['calendar.attendee'].sudo().search([('google_internal_event_id', '=ilike', '%s\_%%' % event.GG.event['id'])])
|
||||||
|
excluded_recurrent_event_ids = set(attendee.event_id for attendee in attendees)
|
||||||
|
for event in excluded_recurrent_event_ids:
|
||||||
|
event.write({'recurrent_id': meeting.id, 'recurrent_id_date': event.start, 'user_id': meeting.user_id.id})
|
||||||
|
return event
|
||||||
|
|
||||||
def update_from_google(self, event, single_event_dict, type):
|
def update_from_google(self, event, single_event_dict, type):
|
||||||
""" Update an event in Odoo with information from google calendar
|
""" Update an event in Odoo with information from google calendar
|
||||||
:param event : record od calendar.event to update
|
:param event : record od calendar.event to update
|
||||||
@@ -786,13 +800,8 @@ class GoogleCalendar(models.AbstractModel):
|
|||||||
if isinstance(actToDo, NothingToDo):
|
if isinstance(actToDo, NothingToDo):
|
||||||
continue
|
continue
|
||||||
elif isinstance(actToDo, Create):
|
elif isinstance(actToDo, Create):
|
||||||
context_tmp = {'newMeeting': True}
|
|
||||||
if actSrc == 'GG':
|
if actSrc == 'GG':
|
||||||
res = recs.with_context(context_tmp).update_from_google(False, event.GG.event, "create")
|
self.create_from_google(event, my_partner_id)
|
||||||
event.OE.event_id = res
|
|
||||||
meeting = CalendarEvent.browse(res)
|
|
||||||
attendee_records = CalendarAttendee.search([('partner_id', '=', my_partner_id), ('event_id', '=', res)])
|
|
||||||
attendee_records.with_context(context_tmp).write({'oe_synchro_date': meeting.oe_update_date, 'google_internal_event_id': event.GG.event['id']})
|
|
||||||
elif actSrc == 'OE':
|
elif actSrc == 'OE':
|
||||||
raise "Should be never here, creation for OE is done before update !"
|
raise "Should be never here, creation for OE is done before update !"
|
||||||
#TODO Add to batch
|
#TODO Add to batch
|
||||||
@@ -817,6 +826,12 @@ class GoogleCalendar(models.AbstractModel):
|
|||||||
main_ev = CalendarAttendee.with_context(context_novirtual).search([('google_internal_event_id', '=', event.GG.event['id'].rsplit('_', 1)[0])], limit=1)
|
main_ev = CalendarAttendee.with_context(context_novirtual).search([('google_internal_event_id', '=', event.GG.event['id'].rsplit('_', 1)[0])], limit=1)
|
||||||
event_to_synchronize[base_event][0][1].OE.event_id = main_ev.event_id.id
|
event_to_synchronize[base_event][0][1].OE.event_id = main_ev.event_id.id
|
||||||
|
|
||||||
|
if event_to_synchronize[base_event][0][1].OE.event_id:
|
||||||
|
parent_event['id'] = "%s-%s" % (event_to_synchronize[base_event][0][1].OE.event_id, new_google_event_id)
|
||||||
|
res = self.update_from_google(parent_event, event.GG.event, "copy")
|
||||||
|
else:
|
||||||
|
self.create_from_google(event, my_partner_id)
|
||||||
|
|
||||||
parent_event['id'] = "%s-%s" % (event_to_synchronize[base_event][0][1].OE.event_id, new_google_event_id)
|
parent_event['id'] = "%s-%s" % (event_to_synchronize[base_event][0][1].OE.event_id, new_google_event_id)
|
||||||
res = recs.update_from_google(parent_event, event.GG.event, "copy")
|
res = recs.update_from_google(parent_event, event.GG.event, "copy")
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -1568,28 +1568,28 @@
|
|||||||
<field name="code">4700</field>
|
<field name="code">4700</field>
|
||||||
<field name="reconcile" eval="True"/>
|
<field name="reconcile" eval="True"/>
|
||||||
<field name="name">Hacienda Pública, deudora por IVA</field>
|
<field name="name">Hacienda Pública, deudora por IVA</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
|
<field name="user_type_id" ref="account.data_account_type_current_assets"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_4708_child" model="account.account.template">
|
<record id="pgc_4708_child" model="account.account.template">
|
||||||
<field name="code">4708</field>
|
<field name="code">4708</field>
|
||||||
<field name="reconcile" eval="True"/>
|
<field name="reconcile" eval="True"/>
|
||||||
<field name="name">Hacienda Pública, deudora por subvenciones concedidas</field>
|
<field name="name">Hacienda Pública, deudora por subvenciones concedidas</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_current_assets"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_4709_child" model="account.account.template">
|
<record id="pgc_4709_child" model="account.account.template">
|
||||||
<field name="code">4709</field>
|
<field name="code">4709</field>
|
||||||
<field name="reconcile" eval="True"/>
|
<field name="reconcile" eval="True"/>
|
||||||
<field name="name">Hacienda Pública, deudora por devolución de impuestos</field>
|
<field name="name">Hacienda Pública, deudora por devolución de impuestos</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_current_assets"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_471_child" model="account.account.template">
|
<record id="pgc_471_child" model="account.account.template">
|
||||||
<field name="code">471</field>
|
<field name="code">471</field>
|
||||||
<field name="reconcile" eval="False"/>
|
<field name="reconcile" eval="False"/>
|
||||||
<field name="name">Organismos de la Seguridad Social, deudores</field>
|
<field name="name">Organismos de la Seguridad Social, deudores</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_current_assets"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_472_child" model="account.account.template">
|
<record id="pgc_472_child" model="account.account.template">
|
||||||
@@ -1603,77 +1603,77 @@
|
|||||||
<field name="code">473</field>
|
<field name="code">473</field>
|
||||||
<field name="reconcile" eval="True"/>
|
<field name="reconcile" eval="True"/>
|
||||||
<field name="name">Hacienda Pública, retenciones y pagos a cuenta</field>
|
<field name="name">Hacienda Pública, retenciones y pagos a cuenta</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_current_assets"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_4740_child" model="account.account.template">
|
<record id="pgc_4740_child" model="account.account.template">
|
||||||
<field name="code">4740</field>
|
<field name="code">4740</field>
|
||||||
<field name="reconcile" eval="False"/>
|
<field name="reconcile" eval="False"/>
|
||||||
<field name="name">Activos por diferencias temporarias deducibles</field>
|
<field name="name">Activos por diferencias temporarias deducibles</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_non_current_assets"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_4742_child" model="account.account.template">
|
<record id="pgc_4742_child" model="account.account.template">
|
||||||
<field name="code">4742</field>
|
<field name="code">4742</field>
|
||||||
<field name="reconcile" eval="False"/>
|
<field name="reconcile" eval="False"/>
|
||||||
<field name="name">Derechos por deducciones y bonificaciones pendientes de aplicar</field>
|
<field name="name">Derechos por deducciones y bonificaciones pendientes de aplicar</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_non_current_assets"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_4745_child" model="account.account.template">
|
<record id="pgc_4745_child" model="account.account.template">
|
||||||
<field name="code">4745</field>
|
<field name="code">4745</field>
|
||||||
<field name="reconcile" eval="False"/>
|
<field name="reconcile" eval="False"/>
|
||||||
<field name="name">Crédito por pérdidas a compensar del ejercicio</field>
|
<field name="name">Crédito por pérdidas a compensar del ejercicio</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_non_current_assets"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_4750_child" model="account.account.template">
|
<record id="pgc_4750_child" model="account.account.template">
|
||||||
<field name="code">4750</field>
|
<field name="code">4750</field>
|
||||||
<field name="reconcile" eval="True"/>
|
<field name="reconcile" eval="True"/>
|
||||||
<field name="name">Hacienda Pública, acreedora por IVA</field>
|
<field name="name">Hacienda Pública, acreedora por IVA</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_4751_child" model="account.account.template">
|
<record id="pgc_4751_child" model="account.account.template">
|
||||||
<field name="code">4751</field>
|
<field name="code">4751</field>
|
||||||
<field name="reconcile" eval="True"/>
|
<field name="reconcile" eval="True"/>
|
||||||
<field name="name">Hacienda Pública, acreedora por retenciones practicadas</field>
|
<field name="name">Hacienda Pública, acreedora por retenciones practicadas</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_4752_child" model="account.account.template">
|
<record id="pgc_4752_child" model="account.account.template">
|
||||||
<field name="code">4752</field>
|
<field name="code">4752</field>
|
||||||
<field name="reconcile" eval="True"/>
|
<field name="reconcile" eval="True"/>
|
||||||
<field name="name">Hacienda Pública, acreedora por impuesto sobre sociedades</field>
|
<field name="name">Hacienda Pública, acreedora por impuesto sobre sociedades</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_4758_child" model="account.account.template">
|
<record id="pgc_4758_child" model="account.account.template">
|
||||||
<field name="code">4758</field>
|
<field name="code">4758</field>
|
||||||
<field name="reconcile" eval="True"/>
|
<field name="reconcile" eval="True"/>
|
||||||
<field name="name">Hacienda Pública, acreedora por subvenciones a reintegrar</field>
|
<field name="name">Hacienda Pública, acreedora por subvenciones a reintegrar</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_476_child" model="account.account.template">
|
<record id="pgc_476_child" model="account.account.template">
|
||||||
<field name="code">476</field>
|
<field name="code">476</field>
|
||||||
<field name="reconcile" eval="False"/>
|
<field name="reconcile" eval="False"/>
|
||||||
<field name="name">Organismos de la Seguridad Social, acreedores</field>
|
<field name="name">Organismos de la Seguridad Social, acreedores</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_477_child" model="account.account.template">
|
<record id="pgc_477_child" model="account.account.template">
|
||||||
<field name="code">477</field>
|
<field name="code">477</field>
|
||||||
<field name="reconcile" eval="True"/>
|
<field name="reconcile" eval="True"/>
|
||||||
<field name="name">Hacienda Pública. IVA repercutido</field>
|
<field name="name">Hacienda Pública. IVA repercutido</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_479_child" model="account.account.template">
|
<record id="pgc_479_child" model="account.account.template">
|
||||||
<field name="code">479</field>
|
<field name="code">479</field>
|
||||||
<field name="reconcile" eval="False"/>
|
<field name="reconcile" eval="False"/>
|
||||||
<field name="name">Pasivos por diferencias temporarias imponibles</field>
|
<field name="name">Pasivos por diferencias temporarias imponibles</field>
|
||||||
<field name="user_type_id" ref="account.data_account_type_expenses"/>
|
<field name="user_type_id" ref="account.data_account_type_non_current_liabilities"/>
|
||||||
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="pgc_480_child" model="account.account.template">
|
<record id="pgc_480_child" model="account.account.template">
|
||||||
|
|||||||
@@ -271,8 +271,8 @@ class MrpProduction(models.Model):
|
|||||||
boms, lines = production.bom_id.explode(production.product_id, factor, picking_type=production.bom_id.picking_type_id)
|
boms, lines = production.bom_id.explode(production.product_id, factor, picking_type=production.bom_id.picking_type_id)
|
||||||
production._generate_raw_moves(lines)
|
production._generate_raw_moves(lines)
|
||||||
# Check for all draft moves whether they are mto or not
|
# Check for all draft moves whether they are mto or not
|
||||||
self._adjust_procure_method()
|
production._adjust_procure_method()
|
||||||
self.move_raw_ids.action_confirm()
|
production.move_raw_ids.action_confirm()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _generate_finished_moves(self):
|
def _generate_finished_moves(self):
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
|
import dateutil.parser
|
||||||
|
import pytz
|
||||||
|
|
||||||
from odoo import api, fields, models, _
|
from odoo import api, fields, models, _
|
||||||
from odoo.addons.payment.models.payment_acquirer import ValidationError
|
from odoo.addons.payment.models.payment_acquirer import ValidationError
|
||||||
from odoo.addons.payment_paypal.controllers.main import PaypalController
|
from odoo.addons.payment_paypal.controllers.main import PaypalController
|
||||||
@@ -193,7 +196,16 @@ class TxPaypal(models.Model):
|
|||||||
}
|
}
|
||||||
if status in ['Completed', 'Processed']:
|
if status in ['Completed', 'Processed']:
|
||||||
_logger.info('Validated Paypal payment for tx %s: set as done' % (self.reference))
|
_logger.info('Validated Paypal payment for tx %s: set as done' % (self.reference))
|
||||||
res.update(state='done', date_validate=data.get('payment_date', fields.datetime.now()))
|
try:
|
||||||
|
# dateutil and pytz don't recognize abbreviations PDT/PST
|
||||||
|
tzinfos = {
|
||||||
|
'PST': -8 * 3600,
|
||||||
|
'PDT': -7 * 3600,
|
||||||
|
}
|
||||||
|
date_validate = dateutil.parser.parse(data.get('payment_date'), tzinfos=tzinfos).astimezone(pytz.utc)
|
||||||
|
except:
|
||||||
|
date_validate = fields.Datetime.now()
|
||||||
|
res.update(state='done', date_validate=date_validate)
|
||||||
return self.write(res)
|
return self.write(res)
|
||||||
elif status in ['Pending', 'Expired']:
|
elif status in ['Pending', 'Expired']:
|
||||||
_logger.info('Received notification for Paypal payment %s: set as pending' % (self.reference))
|
_logger.info('Received notification for Paypal payment %s: set as pending' % (self.reference))
|
||||||
|
|||||||
@@ -187,4 +187,4 @@ class PaypalForm(PaypalCommon):
|
|||||||
# check
|
# check
|
||||||
self.assertEqual(tx.state, 'done', 'paypal: wrong state after receiving a valid pending notification')
|
self.assertEqual(tx.state, 'done', 'paypal: wrong state after receiving a valid pending notification')
|
||||||
self.assertEqual(tx.acquirer_reference, '08D73520KX778924N', 'paypal: wrong txn_id after receiving a valid pending notification')
|
self.assertEqual(tx.acquirer_reference, '08D73520KX778924N', 'paypal: wrong txn_id after receiving a valid pending notification')
|
||||||
self.assertEqual(tx.date_validate, '2013-11-18 03:21:19', 'paypal: wrong validation date')
|
self.assertEqual(tx.date_validate, '2013-11-18 11:21:19', 'paypal: wrong validation date')
|
||||||
|
|||||||
@@ -1432,6 +1432,7 @@ var ReceiptScreenWidget = ScreenWidget.extend({
|
|||||||
print_xml: function() {
|
print_xml: function() {
|
||||||
var env = {
|
var env = {
|
||||||
widget: this,
|
widget: this,
|
||||||
|
order: this.pos.get_order(),
|
||||||
receipt: this.pos.get_order().export_for_printing(),
|
receipt: this.pos.get_order().export_for_printing(),
|
||||||
paymentlines: this.pos.get_order().get_paymentlines()
|
paymentlines: this.pos.get_order().get_paymentlines()
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -502,10 +502,14 @@ class SaleOrder(models.Model):
|
|||||||
res = {}
|
res = {}
|
||||||
currency = self.currency_id or self.company_id.currency_id
|
currency = self.currency_id or self.company_id.currency_id
|
||||||
for line in self.order_line:
|
for line in self.order_line:
|
||||||
|
base_tax = 0
|
||||||
for tax in line.tax_id:
|
for tax in line.tax_id:
|
||||||
group = tax.tax_group_id
|
group = tax.tax_group_id
|
||||||
res.setdefault(group, 0.0)
|
res.setdefault(group, 0.0)
|
||||||
res[group] += tax.compute_all(line.price_reduce, quantity=line.product_uom_qty)['taxes'][0]['amount']
|
amount = tax.compute_all(line.price_reduce + base_tax, quantity=line.product_uom_qty)['taxes'][0]['amount']
|
||||||
|
res[group] += amount
|
||||||
|
if tax.include_base_amount:
|
||||||
|
base_tax += amount
|
||||||
res = sorted(res.items(), key=lambda l: l[0].sequence)
|
res = sorted(res.items(), key=lambda l: l[0].sequence)
|
||||||
res = map(lambda l: (l[0].name, l[1]), res)
|
res = map(lambda l: (l[0].name, l[1]), res)
|
||||||
return res
|
return res
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class Quant(models.Model):
|
|||||||
lot_id = fields.Many2one(
|
lot_id = fields.Many2one(
|
||||||
'stock.production.lot', 'Lot/Serial Number',
|
'stock.production.lot', 'Lot/Serial Number',
|
||||||
index=True, ondelete="restrict", readonly=True)
|
index=True, ondelete="restrict", readonly=True)
|
||||||
cost = fields.Float('Unit Cost')
|
cost = fields.Float('Unit Cost', group_operator='avg')
|
||||||
owner_id = fields.Many2one(
|
owner_id = fields.Many2one(
|
||||||
'res.partner', 'Owner',
|
'res.partner', 'Owner',
|
||||||
index=True, readonly=True,
|
index=True, readonly=True,
|
||||||
|
|||||||
@@ -641,7 +641,8 @@ ListView.include(/** @lends instance.web.ListView# */{
|
|||||||
if (saveInfo.created) {
|
if (saveInfo.created) {
|
||||||
return self.start_edition();
|
return self.start_edition();
|
||||||
}
|
}
|
||||||
var record = self.records[next_record](saveInfo.record);
|
var options = { wraparound: !self.is_action_enabled('create') };
|
||||||
|
var record = self.records[next_record](saveInfo.record, options);
|
||||||
if (record === undefined) {
|
if (record === undefined) {
|
||||||
return self.start_edition();
|
return self.start_edition();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -466,7 +466,7 @@ var SearchView = View.extend({
|
|||||||
*/
|
*/
|
||||||
select_completion: function (e, ui) {
|
select_completion: function (e, ui) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if(ui.item.facet.values && ui.item.facet.values.length && String(ui.item.facet.values[0].value).trim() !== "") {
|
if(ui.item.facet && ui.item.facet.values && ui.item.facet.values.length && String(ui.item.facet.values[0].value).trim() !== "") {
|
||||||
this.query.add(ui.item.facet);
|
this.query.add(ui.item.facet);
|
||||||
} else {
|
} else {
|
||||||
this.query.trigger('add');
|
this.query.trigger('add');
|
||||||
|
|||||||
@@ -161,6 +161,11 @@ var FieldTextHtmlSimple = widget.extend({
|
|||||||
return !this.get('value') || this.get('value') === "<p><br/></p>" || !this.get('value').match(/\S/);
|
return !this.get('value') || this.get('value') === "<p><br/></p>" || !this.get('value').match(/\S/);
|
||||||
},
|
},
|
||||||
commit_value: function () {
|
commit_value: function () {
|
||||||
|
/* Switch to WYSIWYG mode if currently in code view */
|
||||||
|
if (session.debug) {
|
||||||
|
var layoutInfo = this.$textarea.data('layoutInfo');
|
||||||
|
$.summernote.pluginEvents.codeview(undefined, undefined, layoutInfo, false);
|
||||||
|
}
|
||||||
if (this.options['style-inline']) {
|
if (this.options['style-inline']) {
|
||||||
transcoder.class_to_style(this.$content);
|
transcoder.class_to_style(this.$content);
|
||||||
transcoder.font_to_img(this.$content);
|
transcoder.font_to_img(this.$content);
|
||||||
@@ -377,6 +382,11 @@ var FieldTextHtml = widget.extend({
|
|||||||
this._dirty_flag = false;
|
this._dirty_flag = false;
|
||||||
return this.editor.save();
|
return this.editor.save();
|
||||||
} else if (this._dirty_flag && this.editor && this.editor.buildingBlock) {
|
} else if (this._dirty_flag && this.editor && this.editor.buildingBlock) {
|
||||||
|
/* Switch to WYSIWYG mode if currently in code view */
|
||||||
|
if (session.debug) {
|
||||||
|
var layoutInfo = this.editor.rte.editable().data('layoutInfo');
|
||||||
|
$.summernote.pluginEvents.codeview(undefined, undefined, layoutInfo, false);
|
||||||
|
}
|
||||||
this.editor.buildingBlock.clean_for_save();
|
this.editor.buildingBlock.clean_for_save();
|
||||||
this.internal_set_value( this.$content.html() );
|
this.internal_set_value( this.$content.html() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -511,12 +511,32 @@ function prettify_html(html) {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
$.summernote.pluginEvents.codeview = function (event, editor, layoutInfo) {
|
|
||||||
|
/*
|
||||||
|
* This override when clicking on the 'Code View' button has two aims:
|
||||||
|
*
|
||||||
|
* - have our own code view implementation for FieldTextHtml
|
||||||
|
* - add an 'enable' paramater to call the function directly and allow us to
|
||||||
|
* disable (false) or enable (true) the code view mode.
|
||||||
|
*/
|
||||||
|
$.summernote.pluginEvents.codeview = function (event, editor, layoutInfo, enable) {
|
||||||
|
if (layoutInfo === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (layoutInfo.toolbar) {
|
if (layoutInfo.toolbar) {
|
||||||
|
// if editor inline (FieldTextHtmlSimple)
|
||||||
|
var is_activated = $.summernote.eventHandler.modules.codeview.isActivated(layoutInfo);
|
||||||
|
if (is_activated === enable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
return eventHandler.modules.codeview.toggle(layoutInfo);
|
return eventHandler.modules.codeview.toggle(layoutInfo);
|
||||||
} else {
|
} else {
|
||||||
|
// if editor iframe (FieldTextHtml)
|
||||||
var $editor = layoutInfo.editor();
|
var $editor = layoutInfo.editor();
|
||||||
var $textarea = $editor.prev('textarea');
|
var $textarea = $editor.prev('textarea');
|
||||||
|
if ($textarea.is('textarea') === enable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$textarea.length) {
|
if (!$textarea.length) {
|
||||||
// init and create texarea
|
// init and create texarea
|
||||||
|
|||||||
@@ -710,24 +710,19 @@ var KanbanView = View.extend({
|
|||||||
var context = {};
|
var context = {};
|
||||||
context['default_' + this.group_by_field] = column.id;
|
context['default_' + this.group_by_field] = column.id;
|
||||||
var name = event.data.value;
|
var name = event.data.value;
|
||||||
this.dataset.name_create(name, context).then(function on_success (data) {
|
this.dataset.name_create(name).done(function(data) {
|
||||||
add_record(data[0]);
|
add_record(data[0]);
|
||||||
}, function on_fail (event) {
|
}).fail(function(error, event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var popup = new form_common.SelectCreatePopup(this);
|
var dialog = new form_common.FormViewDialog(self, {
|
||||||
popup.select_element(
|
res_model: self.model,
|
||||||
self.model,
|
context: _.extend({"default_name": name}, context),
|
||||||
{
|
title: _t("Create"),
|
||||||
title: _t("Create: "),
|
disable_multiple_selection: true,
|
||||||
initial_view: "form",
|
on_selected: function(element_ids) {
|
||||||
disable_multiple_selection: true
|
add_record(element_ids[0]);
|
||||||
},
|
}
|
||||||
[],
|
}).open();
|
||||||
{"default_name": name}
|
|
||||||
);
|
|
||||||
popup.on("elements_selected", self, function(element_ids) {
|
|
||||||
add_record(element_ids[0]);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function add_record(id) {
|
function add_record(id) {
|
||||||
|
|||||||
@@ -124,8 +124,11 @@ animation.registry.newsletter_popup = animation.Class.extend({
|
|||||||
|
|
||||||
odoo.define('mass_mailing.unsubscribe', function (require) {
|
odoo.define('mass_mailing.unsubscribe', function (require) {
|
||||||
var ajax = require('web.ajax');
|
var ajax = require('web.ajax');
|
||||||
|
var core = require('web.core');
|
||||||
require('web_editor.base'); // wait for implicit dependencies to load
|
require('web_editor.base'); // wait for implicit dependencies to load
|
||||||
|
|
||||||
|
var _t = core._t;
|
||||||
|
|
||||||
if (!$('.o_unsubscribe_form').length) {
|
if (!$('.o_unsubscribe_form').length) {
|
||||||
return $.Deferred().reject("DOM doesn't contain '.o_unsubscribe_form'");
|
return $.Deferred().reject("DOM doesn't contain '.o_unsubscribe_form'");
|
||||||
}
|
}
|
||||||
@@ -148,10 +151,10 @@ odoo.define('mass_mailing.unsubscribe', function (require) {
|
|||||||
|
|
||||||
ajax.jsonRpc('/mail/mailing/unsubscribe', 'call', {'opt_in_ids': checked_ids, 'opt_out_ids': unchecked_ids, 'email': email, 'mailing_id': mailing_id})
|
ajax.jsonRpc('/mail/mailing/unsubscribe', 'call', {'opt_in_ids': checked_ids, 'opt_out_ids': unchecked_ids, 'email': email, 'mailing_id': mailing_id})
|
||||||
.then(function(result) {
|
.then(function(result) {
|
||||||
$('.alert-info').html('Your changes has been saved.').removeClass('alert-info').addClass('alert-success');
|
$('.alert-info').html(_t('Your changes have been saved.')).removeClass('alert-info').addClass('alert-success');
|
||||||
})
|
})
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
$('.alert-info').html('You changes has not been saved, try again later.').removeClass('alert-info').addClass('alert-warning');
|
$('.alert-info').html(_t('Your changes have not been saved, try again later.')).removeClass('alert-info').addClass('alert-warning');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ class website_account(website_account):
|
|||||||
partner = request.env['res.users'].browse(request.uid).partner_id
|
partner = request.env['res.users'].browse(request.uid).partner_id
|
||||||
invoices = request.env['account.invoice'].sudo().search_count([('partner_id', '=', partner.id), ('state', 'not in', ['draft', 'cancel'])])
|
invoices = request.env['account.invoice'].sudo().search_count([('partner_id', '=', partner.id), ('state', 'not in', ['draft', 'cancel'])])
|
||||||
if invoices:
|
if invoices:
|
||||||
if data.get('vat', partner.vat) != partner.vat:
|
if (data.get('vat', partner.vat) or False) != partner.vat:
|
||||||
error['vat'] = 'error'
|
error['vat'] = 'error'
|
||||||
error_message.append(_('Changing VAT number is not allowed once invoices have been issued for your account. Please contact us directly for this operation.'))
|
error_message.append(_('Changing VAT number is not allowed once invoices have been issued for your account. Please contact us directly for this operation.'))
|
||||||
if data.get('name', partner.name) != partner.name:
|
if data.get('name', partner.name) != partner.name:
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# set server timezone in UTC before time module imported
|
||||||
|
__import__('os').environ['TZ'] = 'UTC'
|
||||||
__import__('pkg_resources').declare_namespace('odoo.addons')
|
__import__('pkg_resources').declare_namespace('odoo.addons')
|
||||||
import odoo
|
import odoo
|
||||||
|
|
||||||
|
|||||||
+5
-8
@@ -27,15 +27,12 @@ multi_process = False
|
|||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
# libc UTC hack
|
# libc UTC hack
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
# Make sure the OpenERP server runs in UTC. This is especially necessary
|
# Make sure the OpenERP server runs in UTC.
|
||||||
# under Windows as under Linux it seems the real import of time is
|
|
||||||
# sufficiently deferred so that setting the TZ environment variable
|
|
||||||
# in odoo.cli.server was working.
|
|
||||||
import os
|
import os
|
||||||
os.environ['TZ'] = 'UTC' # Set the timezone...
|
os.environ['TZ'] = 'UTC' # Set the timezone
|
||||||
import time # ... *then* import time.
|
import time
|
||||||
del os
|
if hasattr(time, 'tzset'):
|
||||||
del time
|
time.tzset()
|
||||||
|
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
# Shortcuts
|
# Shortcuts
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
|
|||||||
for (model,) in cr.fetchall():
|
for (model,) in cr.fetchall():
|
||||||
if model in registry:
|
if model in registry:
|
||||||
env[model]._check_removed_columns(log=True)
|
env[model]._check_removed_columns(log=True)
|
||||||
else:
|
elif _logger.isEnabledFor(logging.INFO): # more an info that a warning...
|
||||||
_logger.warning("Model %s is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)", model)
|
_logger.warning("Model %s is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)", model)
|
||||||
|
|
||||||
# Cleanup orphan records
|
# Cleanup orphan records
|
||||||
@@ -402,8 +402,10 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
|
|||||||
if update_module:
|
if update_module:
|
||||||
View = env['ir.ui.view']
|
View = env['ir.ui.view']
|
||||||
for model in registry:
|
for model in registry:
|
||||||
if not View._validate_custom_views(model):
|
try:
|
||||||
_logger.warning('invalid custom view(s) for model %s', model)
|
View._validate_custom_views(model)
|
||||||
|
except Exception as e:
|
||||||
|
_logger.warning('invalid custom view(s) for model %s: %s', model, tools.ustr(e))
|
||||||
|
|
||||||
if report.failures:
|
if report.failures:
|
||||||
_logger.error('At least one test failed when loading the modules.')
|
_logger.error('At least one test failed when loading the modules.')
|
||||||
|
|||||||
Reference in New Issue
Block a user