[MERGE] forward port branch 11.0 up to 7e5d5045bf

This commit is contained in:
Christophe Simonis
2018-12-11 17:06:48 +01:00
17 changed files with 40 additions and 17 deletions
+3
View File
@@ -451,6 +451,9 @@ class AccountInvoice(models.Model):
@api.model
def create(self, vals):
if not vals.get('journal_id') and vals.get('type'):
vals['journal_id'] = self.with_context(type=vals.get('type'))._default_journal().id
onchanges = {
'_onchange_partner_id': ['account_id', 'payment_term_id', 'fiscal_position_id', 'partner_bank_id'],
'_onchange_journal_id': ['currency_id'],
+4 -1
View File
@@ -1361,6 +1361,9 @@ class AccountPartialReconcile(models.Model):
'''
return tax.cash_basis_base_account_id or line.account_id
def _get_amount_tax_cash_basis(self, amount, line):
return line.company_id.currency_id.round(amount)
def create_tax_cash_basis_entry(self, percentage_before_rec):
self.ensure_one()
move_date = self.debit_move_id.date
@@ -1377,7 +1380,7 @@ class AccountPartialReconcile(models.Model):
percentage_after = line._get_matched_percentage()[move.id]
#amount is the current cash_basis amount minus the one before the reconciliation
amount = line.balance * percentage_after - line.balance * percentage_before
rounded_amt = line.company_id.currency_id.round(amount)
rounded_amt = self._get_amount_tax_cash_basis(amount, line)
if float_is_zero(rounded_amt, precision_rounding=line.company_id.currency_id.rounding):
continue
if line.tax_line_id and line.tax_line_id.tax_exigibility == 'on_payment':
@@ -24,6 +24,7 @@ class TestAccountSupplierInvoice(AccountingTestCase):
'account_id': invoice_account,
'type': 'in_invoice',
})
self.assertEquals(invoice.journal_id.type, 'purchase')
self.env['account.invoice.line'].create({'product_id': self.env.ref('product.product_product_4').id,
'quantity': 1.0,
@@ -79,6 +80,7 @@ class TestAccountSupplierInvoice(AccountingTestCase):
'account_id': invoice_account,
'type': 'in_invoice',
})
self.assertEquals(invoice.journal_id.type, 'purchase')
invoice_line = self.env['account.invoice.line'].create({'product_id': self.env.ref('product.product_product_4').id,
'quantity': 5.0,
+2 -2
View File
@@ -866,7 +866,7 @@
<field name="amount" class="oe_inline"/>
<label string="%" class="oe_inline" attrs="{'invisible':[('amount_type','!=','percentage')]}" />
</div>
<field name="journal_id" domain="[('company_id', '=', company_id)]" widget="selection"/>
<field name="journal_id" domain="[('type', '!=', 'general'), ('company_id', '=', company_id)]" widget="selection"/>
</group>
</group>
<div class="oe_edit_only">
@@ -888,7 +888,7 @@
<field name="second_amount" class="oe_inline"/>
<label string="%" class="oe_inline" attrs="{'invisible':[('amount_type','!=','percentage')]}" />
</div>
<field name="second_journal_id" string="Journal" domain="[('company_id', '=', company_id)]" widget="selection"/>
<field name="second_journal_id" string="Journal" domain="[('type', '!=', 'general'), ('company_id', '=', company_id)]" widget="selection"/>
</group>
</group>
</sheet>
+1 -1
View File
@@ -194,7 +194,7 @@ class CompanyLDAP(models.Model):
elif conf['create_user']:
_logger.debug("Creating new Odoo user \"%s\" from LDAP" % login)
values = self.map_ldap_attributes(conf, login, ldap_entry)
SudoUser = self.env['res.users'].sudo()
SudoUser = self.env['res.users'].sudo().with_context(no_reset_password=True)
if conf['user']:
values['active'] = True
user_id = SudoUser.browse(conf['user'][0]).copy(default=values).id
+7
View File
@@ -356,3 +356,10 @@ class ResPartner(models.Model):
return int(vat[9]) == c1 and int(vat[10]) == c2
return False
def check_vat_al(self, vat):
try:
import stdnum.al
return stdnum.al.vat.is_valid(vat)
except ImportError:
return True
+1 -1
View File
@@ -120,7 +120,7 @@ class DeliveryCarrier(models.Model):
if hasattr(self, '%s_rate_shipment' % self.delivery_type):
res = getattr(self, '%s_rate_shipment' % self.delivery_type)(order)
# apply margin on computed price
res['price'] = res['price'] * (1.0 + (float(self.margin) / 100.0))
res['price'] = float(res['price']) * (1.0 + (float(self.margin) / 100.0))
# free when order is large enough
if res['success'] and self.free_over and order._compute_amount_total_without_delivery() >= self.amount:
res['warning_message'] = _('Info:\nThe shipping is free because the order amount exceeds %.2f.\n(The actual shipping cost is: %.2f)') % (self.amount, res['price'])
@@ -558,6 +558,7 @@
<record id="a4512" model="account.account.template">
<field name="name">Compte courant administration T.V.A.</field>
<field name="code">4512</field>
<field name="reconcile" eval="True"/>
<field name="user_type_id" ref="account.data_account_type_current_liabilities"/>
<field name="chart_template_id" ref="l10nbe_chart_template"/>
</record>
@@ -34,6 +34,7 @@ class TemplatePreview(models.TransientModel):
res_id = fields.Selection(_get_records, 'Sample Document')
partner_ids = fields.Many2many('res.partner', string='Recipients')
attachment_ids = fields.Many2many(string='Attachments', store=False)
@api.onchange('res_id')
@api.multi
@@ -50,6 +50,7 @@ class ChangeProductionQty(models.TransientModel):
qty_produced = production.product_id.uom_id._compute_quantity(sum(done_moves.mapped('product_qty')), production.product_uom_id)
factor = production.product_uom_id._compute_quantity(production.product_qty - qty_produced, production.bom_id.product_uom_id) / production.bom_id.product_qty
boms, lines = production.bom_id.explode(production.product_id, factor, picking_type=production.bom_id.picking_type_id)
done_quantities = {move: move.quantity_done for move in production.move_raw_ids}
for line, line_data in lines:
production._update_raw_move(line, line_data)
operation_bom_qty = {}
@@ -59,6 +60,9 @@ class ChangeProductionQty(models.TransientModel):
self._update_product_to_produce(production, production.product_qty - qty_produced)
moves = production.move_raw_ids.filtered(lambda x: x.state not in ('done', 'cancel'))
moves._action_assign()
for move in production.move_raw_ids:
if move.quantity_done != done_quantities[move]:
move._set_quantity_done(done_quantities[move])
for wo in production.workorder_ids:
operation = wo.operation_id
if operation_bom_qty.get(operation.id):
+2 -1
View File
@@ -1526,7 +1526,8 @@ exports.Orderline = Backbone.Model.extend({
return false;
}else if(this.get_discount() > 0){ // we don't merge discounted orderlines
return false;
}else if(price !== orderline.get_product().get_price(orderline.order.pricelist, this.get_quantity())){
}else if(!utils.float_is_zero(price - orderline.get_product().get_price(orderline.order.pricelist, this.get_quantity()),
this.pos.currency.decimals)){
return false;
}else if(this.product.tracking == 'lot') {
return false;
+1 -1
View File
@@ -160,7 +160,7 @@ class CustomerPortal(CustomerPortal):
# content according to pager and archive selected
if groupby == 'project':
order = "project_id, %s" % order # force sort on project first to group by project in view
tasks = request.env['project.task'].search(domain, order=order, limit=self._items_per_page, offset=pager['offset'])
tasks = request.env['project.task'].search(domain, order=order, limit=self._items_per_page, offset=(page - 1) * self._items_per_page)
request.session['my_tasks_history'] = tasks.ids[:100]
if groupby == 'project':
grouped_tasks = [request.env['project.task'].concat(*g) for k, g in groupbyelem(tasks, itemgetter('project_id'))]
-1
View File
@@ -516,7 +516,6 @@
<field name="stage_id" options='{"group_by_tooltip": {"description": "Stage Description", "legend_priority": "Use of stars"}}'/>
<field name="user_id"/>
<field name="user_email"/>
<field name="description"/>
<field name="sequence"/>
<field name="date_deadline"/>
<field name="message_needaction_counter"/>
@@ -10,5 +10,13 @@
<field name="name">Display incoterms on Sales Order and related invoices</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
<!-- Stock Portal Access Rules -->
<record id="stock_picking_rule_portal" model="ir.rule">
<field name="name">Portal Follower Pickings</field>
<field name="model_id" ref="stock.model_stock_picking"/>
<field name="domain_force">['|', '|', ('message_partner_ids', 'in', [user.partner_id.id]), ('partner_id', '=', user.partner_id.id), ('sale_id.partner_id', '=', user.partner_id.id)]</field>
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
</record>
</data>
</odoo>
-8
View File
@@ -134,14 +134,6 @@
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<!-- Stock Portal Access Rules -->
<record id="stock_picking_rule_portal" model="ir.rule">
<field name="name">Portal Follower Pickings</field>
<field name="model_id" ref="stock.model_stock_picking"/>
<field name="domain_force">['|', '|', ('message_partner_ids', 'in', [user.partner_id.id]), ('partner_id.id', '=', user.partner_id.id), ('sale_id.partner_id.id', '=', user.partner_id.id)]</field>
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
</record>
<record model="ir.rule" id="stock_location_route_comp_rule">
<field name="name">stock_location_route multi-company</field>
<field name="model_id" ref="model_stock_location_route"/>
@@ -103,7 +103,7 @@ class WebsiteMembership(http.Controller):
# get google maps localization of partners
google_map_partner_ids = []
if request.env.ref('website_membership.opt_index_google_map').customize_show:
if request.env.ref('website_membership.opt_index_google_map').active:
google_map_partner_ids = MembershipLine.search(line_domain).get_published_companies(limit=2000)
search_domain = [('membership_state', '=', 'free'), ('website_published', '=', True)]
+2
View File
@@ -2413,6 +2413,8 @@ class Many2many(_RelationalMulti):
self.column2 = '%s_id' % comodel._table
# check validity of table name
check_pg_name(self.relation)
else:
self.relation = self.column1 = self.column2 = None
def _setup_regular_full(self, model):
super(Many2many, self)._setup_regular_full(model)