[MERGE] forward port branch saas-14 up to bf23946e3d
This commit is contained in:
@@ -1092,6 +1092,8 @@ class AccountInvoice(models.Model):
|
||||
:param date: payment date, defaults to fields.Date.context_today(self)
|
||||
:param writeoff_acc: account in which to create a writeoff if pay_amount < self.residual, so that the invoice is fully paid
|
||||
"""
|
||||
if isinstance( pay_journal, ( int, long ) ):
|
||||
pay_journal = self.env['account.journal'].browse([pay_journal])
|
||||
assert len(self) == 1, "Can only pay one invoice at a time."
|
||||
payment_type = self.type in ('out_invoice', 'in_refund') and 'inbound' or 'outbound'
|
||||
if payment_type == 'inbound':
|
||||
@@ -1122,6 +1124,8 @@ class AccountInvoice(models.Model):
|
||||
})
|
||||
payment.post()
|
||||
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def _track_subtype(self, init_values):
|
||||
self.ensure_one()
|
||||
|
||||
@@ -137,7 +137,8 @@ class account_journal(models.Model):
|
||||
currency = self.currency_id or self.company_id.currency_id
|
||||
number_to_reconcile = last_balance = account_sum = 0
|
||||
title = ''
|
||||
number_draft = number_waiting = number_late = sum_draft = sum_waiting = sum_late = 0
|
||||
number_draft = number_waiting = number_late = 0
|
||||
sum_draft = sum_waiting = sum_late = 0.0
|
||||
if self.type in ['bank', 'cash']:
|
||||
last_bank_stmt = self.env['account.bank.statement'].search([('journal_id', 'in', self.ids)], order="date desc, id desc", limit=1)
|
||||
last_balance = last_bank_stmt and last_bank_stmt[0].balance_end or 0
|
||||
@@ -163,30 +164,33 @@ class account_journal(models.Model):
|
||||
elif self.type in ['sale', 'purchase']:
|
||||
title = _('Bills to pay') if self.type == 'purchase' else _('Invoices owed to you')
|
||||
# optimization to find total and sum of invoice that are in draft, open state
|
||||
query = """SELECT state, amount_total, currency_id AS currency FROM account_invoice WHERE journal_id = %s AND state NOT IN ('paid', 'cancel');"""
|
||||
query = """SELECT state, amount_total, currency_id AS currency, type FROM account_invoice WHERE journal_id = %s AND state NOT IN ('paid', 'cancel');"""
|
||||
self.env.cr.execute(query, (self.id,))
|
||||
query_results = self.env.cr.dictfetchall()
|
||||
today = datetime.today()
|
||||
query = """SELECT amount_total, currency_id AS currency FROM account_invoice WHERE journal_id = %s AND date < %s AND state = 'open';"""
|
||||
query = """SELECT amount_total, currency_id AS currency, type FROM account_invoice WHERE journal_id = %s AND date < %s AND state = 'open';"""
|
||||
self.env.cr.execute(query, (self.id, today))
|
||||
late_query_results = self.env.cr.dictfetchall()
|
||||
sum_draft = 0.0
|
||||
number_draft = 0
|
||||
number_waiting = 0
|
||||
for result in query_results:
|
||||
if result['type'] in ['in_refund', 'out_refund']:
|
||||
factor = -1
|
||||
else:
|
||||
factor = 1
|
||||
cur = self.env['res.currency'].browse(result.get('currency'))
|
||||
if result.get('state') == 'draft':
|
||||
number_draft += 1
|
||||
sum_draft += cur.compute(result.get('amount_total'), currency)
|
||||
sum_draft += cur.compute(result.get('amount_total'), currency) * factor
|
||||
elif result.get('state') == 'open':
|
||||
number_waiting += 1
|
||||
sum_waiting += cur.compute(result.get('amount_total'), currency)
|
||||
sum_late = 0.0
|
||||
number_late = 0
|
||||
sum_waiting += cur.compute(result.get('amount_total'), currency) * factor
|
||||
for result in late_query_results:
|
||||
if result['type'] in ['in_refund', 'out_refund']:
|
||||
factor = -1
|
||||
else:
|
||||
factor = 1
|
||||
cur = self.env['res.currency'].browse(result.get('currency'))
|
||||
number_late += 1
|
||||
sum_late += cur.compute(result.get('amount_total'), currency)
|
||||
sum_late += cur.compute(result.get('amount_total'), currency) * factor
|
||||
|
||||
return {
|
||||
'number_to_reconcile': number_to_reconcile,
|
||||
|
||||
@@ -320,12 +320,9 @@ class ResPartner(models.Model):
|
||||
def _compute_issued_total(self):
|
||||
""" Returns the issued total as will be displayed on partner view """
|
||||
today = fields.Date.context_today(self)
|
||||
for partner in self:
|
||||
domain = partner.get_followup_lines_domain(today, overdue_only=True)
|
||||
issued_total = 0
|
||||
for aml in self.env['account.move.line'].search(domain):
|
||||
issued_total += aml.amount_residual
|
||||
partner.issued_total = issued_total
|
||||
domain = self.get_followup_lines_domain(today, overdue_only=True)
|
||||
for aml in self.env['account.move.line'].search(domain):
|
||||
aml.partner_id.issued_total += aml.amount_residual
|
||||
|
||||
@api.one
|
||||
def _compute_has_unreconciled_entries(self):
|
||||
|
||||
@@ -65,6 +65,14 @@
|
||||
<filter name="available" position="attributes">
|
||||
<attribute name="domain">[('employee_id', '=', False), ('department_id', '=', False)]</attribute>
|
||||
</filter>
|
||||
<field name="owner_user_id" position="after">
|
||||
<field name="employee_id"/>
|
||||
<field name="department_id"/>
|
||||
</field>
|
||||
<group position="inside">
|
||||
<filter string="Employee" domain="[]" context="{'group_by': 'employee_id'}"/>
|
||||
<filter string="Department" domain="[]" context="{'group_by': 'department_id'}"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<template id="message_origin_link">
|
||||
<p>This <t t-esc="self._description.lower()"/> has been <span t-if="edit">modified</span><span t-if="not edit">created</span> from:
|
||||
<t t-foreach="origin" t-as="o">
|
||||
<a href="#" t-att-data-oe-model="o._name" t-att-data-oe-id="o.id"> <t t-esc="o.name"/></a><span t-if="origin.ids[-1:] != o.ids">, </span>
|
||||
<a href="#" t-att-data-oe-model="o._name" t-att-data-oe-id="o.id"> <t t-esc="o.display_name"/></a><span t-if="origin.ids[-1:] != o.ids">, </span>
|
||||
</t>
|
||||
</p>
|
||||
</template>
|
||||
|
||||
@@ -410,7 +410,7 @@ class MrpProduction(models.Model):
|
||||
quantity = order.product_uom_id._compute_quantity(order.product_qty, order.bom_id.product_uom_id) / order.bom_id.product_qty
|
||||
boms, lines = order.bom_id.explode(order.product_id, quantity, picking_type=order.bom_id.picking_type_id)
|
||||
order._generate_workorders(boms)
|
||||
orders_to_plan.write({'state': 'planned'})
|
||||
return orders_to_plan.write({'state': 'planned'})
|
||||
|
||||
@api.multi
|
||||
def _generate_workorders(self, exploded_boms):
|
||||
@@ -539,17 +539,19 @@ class MrpProduction(models.Model):
|
||||
moves_to_cancel.action_cancel()
|
||||
self.write({'state': 'done', 'date_finished': fields.Datetime.now()})
|
||||
self.env["procurement.order"].search([('production_id', 'in', self.ids)]).check()
|
||||
self.write({'state': 'done'})
|
||||
return self.write({'state': 'done'})
|
||||
|
||||
@api.multi
|
||||
def do_unreserve(self):
|
||||
for production in self:
|
||||
production.move_raw_ids.filtered(lambda x: x.state not in ('done', 'cancel')).do_unreserve()
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def button_unreserve(self):
|
||||
self.ensure_one()
|
||||
self.do_unreserve()
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def button_scrap(self):
|
||||
|
||||
@@ -131,7 +131,7 @@ class MrpUnbuild(models.Model):
|
||||
produced_quant_ids = produce_moves.mapped('quant_ids').filtered(lambda quant: quant.qty > 0)
|
||||
consume_move.quant_ids.sudo().write({'produced_quant_ids': [(6, 0, produced_quant_ids.ids)]})
|
||||
|
||||
self.write({'state': 'done'})
|
||||
return self.write({'state': 'done'})
|
||||
|
||||
def _generate_consume_moves(self):
|
||||
moves = self.env['stock.move']
|
||||
|
||||
@@ -342,6 +342,7 @@ class MrpWorkorder(models.Model):
|
||||
self.final_lot_id = False
|
||||
if self.qty_produced >= self.production_id.product_qty:
|
||||
self.button_finish()
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def button_start(self):
|
||||
@@ -369,7 +370,7 @@ class MrpWorkorder(models.Model):
|
||||
'date_start': datetime.now(),
|
||||
'user_id': self.env.user.id
|
||||
})
|
||||
self.write({'state': 'progress',
|
||||
return self.write({'state': 'progress',
|
||||
'date_start': datetime.now(),
|
||||
})
|
||||
|
||||
@@ -377,7 +378,7 @@ class MrpWorkorder(models.Model):
|
||||
def button_finish(self):
|
||||
self.ensure_one()
|
||||
self.end_all()
|
||||
self.write({'state': 'done', 'date_finished': fields.Datetime.now()})
|
||||
return self.write({'state': 'done', 'date_finished': fields.Datetime.now()})
|
||||
|
||||
@api.multi
|
||||
def end_previous(self, doall=False):
|
||||
@@ -405,6 +406,7 @@ class MrpWorkorder(models.Model):
|
||||
if not len(loss_id):
|
||||
raise UserError(_("You need to define at least one unactive productivity loss in the category 'Performance'. Create one from the Manufacturing app, menu: Configuration / Productivity Losses."))
|
||||
timeline.copy({'date_start': maxdate, 'date_end': enddate, 'loss_id': loss_id.id})
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def end_all(self):
|
||||
@@ -413,22 +415,24 @@ class MrpWorkorder(models.Model):
|
||||
@api.multi
|
||||
def button_pending(self):
|
||||
self.end_previous()
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def button_unblock(self):
|
||||
for order in self:
|
||||
order.workcenter_id.unblock()
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def action_cancel(self):
|
||||
self.write({'state': 'cancel'})
|
||||
return self.write({'state': 'cancel'})
|
||||
|
||||
@api.multi
|
||||
def button_done(self):
|
||||
if any([x.state in ('done', 'cancel') for x in self]):
|
||||
raise UserError(_('A Manufacturing Order is already done or cancelled!'))
|
||||
self.end_all()
|
||||
self.write({'state': 'done',
|
||||
return self.write({'state': 'done',
|
||||
'date_finished': datetime.now()})
|
||||
|
||||
@api.multi
|
||||
|
||||
@@ -17,7 +17,9 @@ var FieldPad = form_common.AbstractField.extend(form_common.ReinitializeWidgetMi
|
||||
event.preventDefault();
|
||||
self.set("configured", true);
|
||||
});
|
||||
this.pad_loading_request = null;
|
||||
// CHANGES ONLY NEEDED UNTIL SAAS-15
|
||||
// deferred for request getting pad content (readonly) or new pad url (edit)
|
||||
this._pad_loading_deferred = null;
|
||||
},
|
||||
initialize_content: function() {
|
||||
var self = this;
|
||||
@@ -38,14 +40,25 @@ var FieldPad = form_common.AbstractField.extend(form_common.ReinitializeWidgetMi
|
||||
},
|
||||
render_value: function() {
|
||||
var self = this;
|
||||
$.when(this._configured_deferred, this.pad_loading_request).always(function() {
|
||||
$.when(this._configured_deferred).always(function() {
|
||||
if (!self.get('configured')){
|
||||
return;
|
||||
}
|
||||
|
||||
// reject previously ongoing _pad_loading_deferred
|
||||
if (self._pad_loading_deferred !== null) {
|
||||
self._pad_loading_deferred.reject();
|
||||
self.$('.oe_pad_content').removeClass('oe_pad_loading').html('');
|
||||
}
|
||||
self._pad_loading_deferred = $.Deferred();
|
||||
// keep reference to current _pad_loading_deferred
|
||||
var loading_def = self._pad_loading_deferred;
|
||||
|
||||
var value = self.get('value');
|
||||
if (self.get('effective_readonly')) {
|
||||
if (_.str.startsWith(value, 'http')) {
|
||||
self.pad_loading_request = self.view.dataset.call('pad_get_content', {url: value}).done(function(data) {
|
||||
self.view.dataset.call('pad_get_content', {url: value}).then(loading_def.resolve, loading_def.reject);
|
||||
loading_def.done(function(data) {
|
||||
self.$('.oe_pad_content').removeClass('oe_pad_loading').html('<div class="oe_pad_readonly"><div>');
|
||||
self.$('.oe_pad_readonly').html(data);
|
||||
}).fail(function() {
|
||||
@@ -56,21 +69,37 @@ var FieldPad = form_common.AbstractField.extend(form_common.ReinitializeWidgetMi
|
||||
}
|
||||
}
|
||||
else {
|
||||
var def = $.when();
|
||||
var def = $.Deferred();
|
||||
if (! value || !_.str.startsWith(value, 'http')) {
|
||||
def = self.view.dataset.call('pad_generate_url', {
|
||||
context: {
|
||||
model: self.view.model,
|
||||
field_name: self.name,
|
||||
object_id: self.view.datarecord.id
|
||||
},
|
||||
}).then(function(data) {
|
||||
if (! data.url) {
|
||||
self.set("configured", false);
|
||||
} else {
|
||||
self.internal_set_value(data.url);
|
||||
}
|
||||
var deferreds = [
|
||||
self.view.dataset.call('pad_generate_url', {
|
||||
context: {
|
||||
model: self.view.model,
|
||||
field_name: self.name,
|
||||
object_id: self.view.datarecord.id
|
||||
}
|
||||
}),
|
||||
// change record only after record_loaded and its call stack is finished
|
||||
self.view.record_loaded.then(function() {
|
||||
var call_stack_ended = $.Deferred();
|
||||
_.defer(call_stack_ended.resolve);
|
||||
return call_stack_ended;
|
||||
})
|
||||
];
|
||||
// delay onchange after x2many views are loaded
|
||||
deferreds = deferreds.concat(_.compact(_.pluck(self.view.fields, 'is_loaded')));
|
||||
$.when.apply($, deferreds).then(function(data) {
|
||||
// update value only if loading_def has not been previously rejected
|
||||
loading_def.resolve().done(function(){
|
||||
if (! data.url) {
|
||||
self.set("configured", false);
|
||||
} else {
|
||||
self.internal_set_value(data.url);
|
||||
}
|
||||
}).then(def.resolve, def.reject);
|
||||
});
|
||||
} else {
|
||||
def.resolve();
|
||||
}
|
||||
def.then(function() {
|
||||
value = self.get('value');
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<record id="payment_token_user_rule" model="ir.rule">
|
||||
<field name="name">Access own payment tokens only</field>
|
||||
<field name="model_id" ref="payment.model_payment_token"/>
|
||||
<field name="domain_force">[('partner_id','=',user.partner_id.id)]</field>
|
||||
<field name="domain_force">['|', ('partner_id','=',user.partner_id.id), ('partner_id', '=', user.partner_id.commercial_partner_id.id)]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_user')), (4, ref('base.group_portal')), (4, ref('base.group_public'))]"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -55,19 +55,18 @@ odoo.define('payment_stripe.stripe', function(require) {
|
||||
amount: $("input[name='amount']").val(),
|
||||
currency_id: $("input[name='currency_id']").val(),
|
||||
acquirer_id: acquirer_id
|
||||
}).then(function (data) {
|
||||
})
|
||||
handler.open({
|
||||
name: $("input[name='merchant']").val(),
|
||||
description: $("input[name='invoice_num']").val(),
|
||||
currency: $("input[name='currency']").val(),
|
||||
amount: $("input[name='amount']").val()*100
|
||||
});
|
||||
});
|
||||
} else {
|
||||
ajax.jsonRpc('/shop/payment/transaction/' + acquirer_id, 'call', {
|
||||
so_id: so_id,
|
||||
so_token: so_token
|
||||
}).then(function (data) {
|
||||
}, {'async': false}).then(function (data) {
|
||||
$form.html(data);
|
||||
handler.open({
|
||||
name: $("input[name='merchant']").val(),
|
||||
|
||||
@@ -334,15 +334,16 @@ class PosOrder(models.Model):
|
||||
|
||||
def _reconcile_payments(self):
|
||||
for order in self:
|
||||
aml = order.statement_ids.mapped('journal_entry_ids') | order.account_move.line_ids
|
||||
aml = aml.filtered(lambda r: not r.reconciled and r.account_id.internal_type == 'receivable' and r.partner_id == order.partner_id)
|
||||
aml = order.statement_ids.mapped('journal_entry_ids') | order.account_move.line_ids | order.invoice_id.move_id.line_ids
|
||||
aml = aml.filtered(lambda r: not r.reconciled and r.account_id.internal_type == 'receivable' and r.partner_id == order.partner_id.commercial_partner_id)
|
||||
try:
|
||||
aml.reconcile()
|
||||
except:
|
||||
except Exception:
|
||||
# There might be unexpected situations where the automatic reconciliation won't
|
||||
# work. We don't want the user to be blocked because of this, since the automatic
|
||||
# reconciliation is introduced for convenience, not for mandatory accounting
|
||||
# reasons.
|
||||
_logger.error('Reconciliation did not work for order %s', order.name)
|
||||
continue
|
||||
|
||||
def _default_session(self):
|
||||
|
||||
@@ -36,8 +36,8 @@ class PosSession(models.Model):
|
||||
paid=order.amount_paid,
|
||||
))
|
||||
order.action_pos_order_done()
|
||||
orders = session.order_ids.filtered(lambda order: order.state == 'done')
|
||||
orders._reconcile_payments()
|
||||
orders = session.order_ids.filtered(lambda order: order.state in ['invoiced', 'done'])
|
||||
orders.sudo()._reconcile_payments()
|
||||
|
||||
config_id = fields.Many2one(
|
||||
'pos.config', string='Point of Sale',
|
||||
@@ -245,10 +245,6 @@ class PosSession(models.Model):
|
||||
@api.multi
|
||||
def action_pos_session_closing_control(self):
|
||||
for session in self:
|
||||
#DO NOT FORWARD-PORT
|
||||
if session.state == 'closing_control':
|
||||
session.action_pos_session_close()
|
||||
continue
|
||||
for statement in session.statement_ids:
|
||||
if (statement != session.cash_register_id) and (statement.balance_end != statement.balance_end_real):
|
||||
statement.write({'balance_end_real': statement.balance_end})
|
||||
|
||||
@@ -1413,7 +1413,7 @@ exports.Orderline = Backbone.Model.extend({
|
||||
}
|
||||
return false;
|
||||
},
|
||||
compute_all: function(taxes, price_unit, quantity, currency_rounding) {
|
||||
compute_all: function(taxes, price_unit, quantity, currency_rounding, no_map_tax) {
|
||||
var self = this;
|
||||
var list_taxes = [];
|
||||
var currency_rounding_bak = currency_rounding;
|
||||
@@ -1424,7 +1424,9 @@ exports.Orderline = Backbone.Model.extend({
|
||||
var total_included = total_excluded;
|
||||
var base = total_excluded;
|
||||
_(taxes).each(function(tax) {
|
||||
tax = self._map_tax_fiscal_position(tax);
|
||||
if (!no_map_tax){
|
||||
tax = self._map_tax_fiscal_position(tax);
|
||||
}
|
||||
if (tax.amount_type === 'group'){
|
||||
var ret = self.compute_all(tax.children_tax_ids, price_unit, quantity, currency_rounding);
|
||||
total_excluded = ret.total_excluded;
|
||||
@@ -1955,6 +1957,27 @@ exports.Order = Backbone.Model.extend({
|
||||
this.orderlines.remove(line);
|
||||
this.select_orderline(this.get_last_orderline());
|
||||
},
|
||||
|
||||
fix_tax_included_price: function(line){
|
||||
if(this.fiscal_position){
|
||||
var unit_price = line.price;
|
||||
var taxes = line.get_taxes();
|
||||
var mapped_included_taxes = [];
|
||||
_(taxes).each(function(tax) {
|
||||
var line_tax = line._map_tax_fiscal_position(tax);
|
||||
if(tax.price_include && tax.id != line_tax.id){
|
||||
|
||||
mapped_included_taxes.push(tax);
|
||||
}
|
||||
})
|
||||
|
||||
unit_price = line.compute_all(mapped_included_taxes, unit_price, 1, this.pos.currency.rounding, true).total_excluded;
|
||||
|
||||
line.set_unit_price(unit_price);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
add_product: function(product, options){
|
||||
if(this._printed){
|
||||
this.destroy();
|
||||
@@ -1970,9 +1993,14 @@ exports.Order = Backbone.Model.extend({
|
||||
if(options.quantity !== undefined){
|
||||
line.set_quantity(options.quantity);
|
||||
}
|
||||
|
||||
if(options.price !== undefined){
|
||||
line.set_unit_price(options.price);
|
||||
}
|
||||
|
||||
//To substract from the unit price the included taxes mapped by the fiscal position
|
||||
this.fix_tax_included_price(line);
|
||||
|
||||
if(options.discount !== undefined){
|
||||
line.set_discount(options.discount);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,8 @@ class ProductPriceHistory(models.Model):
|
||||
def _get_default_company_id(self):
|
||||
return self._context.get('force_company', self.env.user.company_id.id)
|
||||
|
||||
company_id = fields.Many2one('res.company', default=_get_default_company_id, required=True)
|
||||
company_id = fields.Many2one('res.company', string='Company',
|
||||
default=_get_default_company_id, required=True)
|
||||
product_id = fields.Many2one('product.product', 'Product', ondelete='cascade', required=True)
|
||||
datetime = fields.Datetime('Date', default=fields.Datetime.now)
|
||||
cost = fields.Float('Cost', digits=dp.get_precision('Product Price'))
|
||||
|
||||
@@ -448,7 +448,6 @@ class SaleOrder(models.Model):
|
||||
def action_unlock(self):
|
||||
self.write({'state': 'sale'})
|
||||
|
||||
@api.multi
|
||||
def _prepare_procurement_group(self):
|
||||
return {'name': self.name}
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@ class SaleOrder(models.Model):
|
||||
invoice_vals['incoterms_id'] = self.incoterm.id or False
|
||||
return invoice_vals
|
||||
|
||||
@api.model
|
||||
def _prepare_procurement_group(self):
|
||||
res = super(SaleOrder, self)._prepare_procurement_group()
|
||||
res.update({'move_type': self.picking_policy, 'partner_id': self.partner_shipping_id.id, 'sale_order_id': self.id})
|
||||
|
||||
@@ -307,7 +307,8 @@ var KanbanView = View.extend({
|
||||
return this.fields_view.fields.active;
|
||||
},
|
||||
_is_quick_create_enabled: function() {
|
||||
if(!_.contains(['char', 'boolean', 'many2one'], this.fields[this.group_by_field].type)){
|
||||
var group_by_field = this.group_by_field.split(':')[0]
|
||||
if(!_.contains(['char', 'boolean', 'many2one'], this.fields[group_by_field].type)){
|
||||
return false;
|
||||
}
|
||||
if (!this.quick_creatable || !this.is_action_enabled('create'))
|
||||
|
||||
@@ -119,7 +119,7 @@ class website_account(http.Controller):
|
||||
|
||||
# vat validation
|
||||
if data.get("vat") and hasattr(request.env["res.partner"], "check_vat"):
|
||||
if request.website.company_id.vat_check_vies:
|
||||
if request.website.company_id.sudo().vat_check_vies:
|
||||
# force full VIES online check
|
||||
check_func = request.env["res.partner"].vies_vat_check
|
||||
else:
|
||||
|
||||
@@ -30,7 +30,7 @@ class WebsiteConfigSettings(models.TransientModel):
|
||||
module_sale_ebay = fields.Boolean("eBay connector")
|
||||
module_sale_coupon = fields.Boolean("Discount Programs")
|
||||
|
||||
group_website_multiimage = fields.Boolean(string='Multi-Images', implied_group='website_sale.group_website_multi_image')
|
||||
group_website_multiimage = fields.Boolean(string='Multi-Images', implied_group='website_sale.group_website_multi_image', group='base.group_portal,base.group_user,base.group_public')
|
||||
group_discount_per_so_line = fields.Boolean(string="Discounted Prices", implied_group='sale.group_discount_per_so_line')
|
||||
group_delivery_invoice_address = fields.Boolean(string="Shipping Address", implied_group='sale.group_delivery_invoice_address')
|
||||
|
||||
@@ -60,8 +60,14 @@ class WebsiteConfigSettings(models.TransientModel):
|
||||
order_mail_template = fields.Many2one('mail.template', string='Order Confirmation Email',
|
||||
default=_default_order_mail_template, domain="[('model', '=', 'sale.order')]",
|
||||
help="Email sent to customer at the end of the checkout process")
|
||||
group_show_price_subtotal = fields.Boolean("Show subtotal", implied_group='sale.group_show_price_subtotal')
|
||||
group_show_price_total = fields.Boolean("Show total", implied_group='sale.group_show_price_total')
|
||||
group_show_price_subtotal = fields.Boolean(
|
||||
"Show subtotal",
|
||||
implied_group='sale.group_show_price_subtotal',
|
||||
group='base.group_portal,base.group_user,base.group_public')
|
||||
group_show_price_total = fields.Boolean(
|
||||
"Show total",
|
||||
implied_group='sale.group_show_price_total',
|
||||
group='base.group_portal,base.group_user,base.group_public')
|
||||
|
||||
default_invoice_policy = fields.Selection([
|
||||
('order', 'Ordered quantities'),
|
||||
|
||||
@@ -6,8 +6,8 @@ I declare that I am authorized and able to make this agreement and sign this dec
|
||||
|
||||
Signed,
|
||||
|
||||
Saulius Zilys saulius@vialaurea.lt https://github.com/realsaiko
|
||||
Saulius Zilys saulius@vialaurea.lt (up to 2017-04-24)
|
||||
|
||||
List of contributors:
|
||||
|
||||
Saulius Zilys saulius@vialaurea.lt https://github.com/realsaiko
|
||||
Saulius Zilys saulius@vialaurea.lt (up to 2017-04-24)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Spain, 2017-04-24
|
||||
|
||||
I hereby agree to the terms of the Odoo Individual Contributor License
|
||||
Agreement v1.0.
|
||||
|
||||
I declare that I am authorized and able to make this agreement and sign this
|
||||
declaration.
|
||||
|
||||
Signed,
|
||||
|
||||
Saulius Žilys realsaiko@gmail.com https://github.com/realsaiko
|
||||
@@ -0,0 +1,11 @@
|
||||
China, 2017-04-24
|
||||
|
||||
I hereby agree to the terms of the Odoo Individual Contributor License
|
||||
Agreement v1.0.
|
||||
|
||||
I declare that I am authorized and able to make this agreement and sign this
|
||||
declaration.
|
||||
|
||||
Signed,
|
||||
|
||||
Rogan Wang quangenw@gmail.com https://github.com/RoganW
|
||||
@@ -88,10 +88,11 @@ class ir_cron(models.Model):
|
||||
|
||||
log_depth = (None if _logger.isEnabledFor(logging.DEBUG) else 1)
|
||||
odoo.netsvc.log(_logger, logging.DEBUG, 'cron.object.execute', (self._cr.dbname, self._uid, '*', cron_name, server_action_id), depth=log_depth)
|
||||
start_time = False
|
||||
if _logger.isEnabledFor(logging.DEBUG):
|
||||
start_time = time.time()
|
||||
self.env['ir.actions.server'].browse(server_action_id).run()
|
||||
if _logger.isEnabledFor(logging.DEBUG):
|
||||
if start_time and _logger.isEnabledFor(logging.DEBUG):
|
||||
end_time = time.time()
|
||||
_logger.debug('%.3fs (cron %s, server action %d with uid %d)', end_time - start_time, cron_name, server_action_id, self.env.uid)
|
||||
self.pool.signal_caches_change()
|
||||
|
||||
@@ -261,7 +261,7 @@ class Lang(models.Model):
|
||||
|
||||
if percent[-1] in 'eEfFgG':
|
||||
parts = formatted.split('.')
|
||||
parts[0], _ = intersperse(parts[0], eval_lang_grouping, thousands_sep)
|
||||
parts[0] = intersperse(parts[0], eval_lang_grouping, thousands_sep)[0]
|
||||
|
||||
formatted = decimal_point.join(parts)
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ from lxml import etree
|
||||
from lxml.builder import E
|
||||
from psycopg2 import IntegrityError
|
||||
|
||||
from odoo.osv.orm import modifiers_tests
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.tests import common
|
||||
from odoo.tools import mute_logger
|
||||
@@ -876,6 +877,10 @@ class TestViews(ViewCase):
|
||||
string="Replacement title", version="7.0"
|
||||
))
|
||||
|
||||
def test_modifiers(self):
|
||||
# implemeted elsewhere...
|
||||
modifiers_tests()
|
||||
|
||||
|
||||
class ViewModeField(ViewCase):
|
||||
"""
|
||||
|
||||
+10
-1
@@ -266,6 +266,15 @@ class BaseModel(object):
|
||||
self.env['ir.model']._reflect_model(self)
|
||||
self.env['ir.model.fields']._reflect_model(self)
|
||||
self.env['ir.model.constraint']._reflect_model(self)
|
||||
if not self.pool._init:
|
||||
# remove ir.model.fields that are not in self._fields
|
||||
fields = Fields.browse([col['id']
|
||||
for name, col in cols.iteritems()
|
||||
if name not in self._fields])
|
||||
# add key '_force_unlink' in context to (1) force the removal of the
|
||||
# fields and (2) not reload the registry
|
||||
fields.with_context(_force_unlink=True).unlink()
|
||||
|
||||
self.invalidate_cache()
|
||||
|
||||
@api.model
|
||||
@@ -287,7 +296,7 @@ class BaseModel(object):
|
||||
This method should only be used for manual fields.
|
||||
"""
|
||||
cls = type(self)
|
||||
field = cls._fields.pop(name)
|
||||
field = cls._fields.pop(name, None)
|
||||
if hasattr(cls, name):
|
||||
delattr(cls, name)
|
||||
return field
|
||||
|
||||
@@ -262,7 +262,7 @@ class Registry(Mapping):
|
||||
model = cls._build_model(self, cr)
|
||||
model_names.append(model._name)
|
||||
|
||||
return self.descendants(model_names, '_inherit')
|
||||
return self.descendants(model_names, '_inherit', '_inherits')
|
||||
|
||||
def setup_models(self, cr, partial=False):
|
||||
""" Complete the setup of models.
|
||||
|
||||
+4
-4
@@ -118,13 +118,13 @@ def test_modifiers(what, expected):
|
||||
node = etree.fromstring(what)
|
||||
transfer_node_to_modifiers(node, modifiers)
|
||||
simplify_modifiers(modifiers)
|
||||
json = json.dumps(modifiers)
|
||||
assert json == expected, "%s != %s" % (json, expected)
|
||||
dump = json.dumps(modifiers)
|
||||
assert dump == expected, "%s != %s" % (dump, expected)
|
||||
elif isinstance(what, dict):
|
||||
transfer_field_to_modifiers(what, modifiers)
|
||||
simplify_modifiers(modifiers)
|
||||
json = json.dumps(modifiers)
|
||||
assert json == expected, "%s != %s" % (json, expected)
|
||||
dump = json.dumps(modifiers)
|
||||
assert dump == expected, "%s != %s" % (dump, expected)
|
||||
|
||||
|
||||
# To use this test:
|
||||
|
||||
Reference in New Issue
Block a user