[MERGE] forward port branch saas-11 up to 6ceecffcad
This commit is contained in:
@@ -33,7 +33,7 @@ class BaseConfigSettings(models.TransientModel):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def get_oauth_providers(self, fields):
|
def get_oauth_providers(self, fields):
|
||||||
google_provider = self.env.ref('auth_oauth.provider_google')
|
google_provider = self.env.ref('auth_oauth.provider_google', False)
|
||||||
return {
|
return {
|
||||||
'auth_oauth_google_enabled': google_provider.enabled,
|
'auth_oauth_google_enabled': google_provider.enabled,
|
||||||
'auth_oauth_google_client_id': google_provider.client_id,
|
'auth_oauth_google_client_id': google_provider.client_id,
|
||||||
@@ -43,7 +43,7 @@ class BaseConfigSettings(models.TransientModel):
|
|||||||
@api.multi
|
@api.multi
|
||||||
def set_oauth_providers(self):
|
def set_oauth_providers(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
google_provider = self.env.ref('auth_oauth.provider_google')
|
google_provider = self.env.ref('auth_oauth.provider_google', False)
|
||||||
rg = {
|
rg = {
|
||||||
'enabled': self.auth_oauth_google_enabled,
|
'enabled': self.auth_oauth_google_enabled,
|
||||||
'client_id': self.auth_oauth_google_client_id,
|
'client_id': self.auth_oauth_google_client_id,
|
||||||
|
|||||||
@@ -611,11 +611,11 @@ class PosOrder(models.Model):
|
|||||||
'location_id': location_id,
|
'location_id': location_id,
|
||||||
'location_dest_id': destination_id,
|
'location_dest_id': destination_id,
|
||||||
}
|
}
|
||||||
pos_qty = any([x.qty > 0 for x in order.lines])
|
pos_qty = any([x.qty > 0 for x in order.lines if x.product_id.type in ['product', 'consu']])
|
||||||
if pos_qty:
|
if pos_qty:
|
||||||
order_picking = Picking.create(picking_vals.copy())
|
order_picking = Picking.create(picking_vals.copy())
|
||||||
order_picking.message_post(body=message)
|
order_picking.message_post(body=message)
|
||||||
neg_qty = any([x.qty < 0 for x in order.lines])
|
neg_qty = any([x.qty < 0 for x in order.lines if x.product_id.type in ['product', 'consu']])
|
||||||
if neg_qty:
|
if neg_qty:
|
||||||
return_vals = picking_vals.copy()
|
return_vals = picking_vals.copy()
|
||||||
return_vals.update({
|
return_vals.update({
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ class SaleReport(models.Model):
|
|||||||
margin = fields.Float('Margin')
|
margin = fields.Float('Margin')
|
||||||
|
|
||||||
def _select(self):
|
def _select(self):
|
||||||
return super(SaleReport, self)._select() + ", SUM(l.margin) AS margin"
|
return super(SaleReport, self)._select() + ", SUM(l.margin / COALESCE(cr.rate, 1.0)) AS margin"
|
||||||
|
|||||||
@@ -160,9 +160,10 @@ var FormView = View.extend(common.FieldManagerMixin, {
|
|||||||
if (this.fields_view.toolbar) {
|
if (this.fields_view.toolbar) {
|
||||||
this.sidebar.add_toolbar(this.fields_view.toolbar);
|
this.sidebar.add_toolbar(this.fields_view.toolbar);
|
||||||
}
|
}
|
||||||
|
var canDuplicate = this.is_action_enabled('create') && this.is_action_enabled('duplicate');
|
||||||
this.sidebar.add_items('other', _.compact([
|
this.sidebar.add_items('other', _.compact([
|
||||||
this.is_action_enabled('delete') && { label: _t('Delete'), callback: this.on_button_delete },
|
this.is_action_enabled('delete') && { label: _t('Delete'), callback: this.on_button_delete },
|
||||||
this.is_action_enabled('create') && { label: _t('Duplicate'), callback: this.on_button_duplicate }
|
canDuplicate && { label: _t('Duplicate'), callback: this.on_button_duplicate }
|
||||||
]));
|
]));
|
||||||
|
|
||||||
this.sidebar.appendTo($node);
|
this.sidebar.appendTo($node);
|
||||||
|
|||||||
@@ -741,14 +741,15 @@ var KanbanView = View.extend({
|
|||||||
add_new_column: function (event) {
|
add_new_column: function (event) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var model = new Model(this.relation, this.search_context);
|
var model = new Model(this.relation, this.search_context);
|
||||||
model.call('create', [{name: event.data.value}], {
|
var name = event.data.value;
|
||||||
|
model.call('name_create', [name], {
|
||||||
context: this.search_context,
|
context: this.search_context,
|
||||||
}).then(function (id) {
|
}).then(function (result) {
|
||||||
var dataset = new data.DataSetSearch(self, self.model, self.dataset.get_context(), []);
|
var dataset = new data.DataSetSearch(self, self.model, self.dataset.get_context(), []);
|
||||||
var group_data = {
|
var group_data = {
|
||||||
records: [],
|
records: [],
|
||||||
title: event.data.value,
|
title: event.data.value,
|
||||||
id: id,
|
id: result[0],
|
||||||
attributes: {folded: false},
|
attributes: {folded: false},
|
||||||
dataset: dataset,
|
dataset: dataset,
|
||||||
values: {},
|
values: {},
|
||||||
|
|||||||
@@ -221,7 +221,7 @@
|
|||||||
<record id="view_model_fields_form" model="ir.ui.view">
|
<record id="view_model_fields_form" model="ir.ui.view">
|
||||||
<field name="model">ir.model.fields</field>
|
<field name="model">ir.model.fields</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Fields">
|
<form string="Fields" duplicate="false">
|
||||||
<sheet>
|
<sheet>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
@@ -333,7 +333,7 @@
|
|||||||
<record id="view_model_fields_tree" model="ir.ui.view">
|
<record id="view_model_fields_tree" model="ir.ui.view">
|
||||||
<field name="model">ir.model.fields</field>
|
<field name="model">ir.model.fields</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="Fields">
|
<tree string="Fields" duplicate="false">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="field_description"/>
|
<field name="field_description"/>
|
||||||
<field name="model_id"/>
|
<field name="model_id"/>
|
||||||
|
|||||||
@@ -13,6 +13,19 @@ class Company(models.Model):
|
|||||||
_description = 'Companies'
|
_description = 'Companies'
|
||||||
_order = 'sequence, name'
|
_order = 'sequence, name'
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def copy(self, default=None):
|
||||||
|
"""
|
||||||
|
Duplicating a company without specifying a partner duplicate the partner
|
||||||
|
"""
|
||||||
|
self.ensure_one()
|
||||||
|
default = dict(default or {})
|
||||||
|
if not default.get('name') and not default.get('partner_id'):
|
||||||
|
copy_partner = self.partner_id.copy()
|
||||||
|
default['partner_id'] = copy_partner.id
|
||||||
|
default['name'] = copy_partner.name
|
||||||
|
return super(Company, self).copy(default)
|
||||||
|
|
||||||
_header = """
|
_header = """
|
||||||
<header>
|
<header>
|
||||||
<pageTemplate>
|
<pageTemplate>
|
||||||
|
|||||||
Reference in New Issue
Block a user