[MERGE] forward port branch 11.0 up to c576800813

This commit is contained in:
Christophe Simonis
2018-10-09 13:55:53 +02:00
12 changed files with 56 additions and 17 deletions
@@ -43,6 +43,7 @@ var StatementRenderer = Widget.extend(FieldManagerMixin, {
var defs = [this._super.apply(this, arguments)];
this.time = Date.now();
this.$progress = this.$('.progress');
this.clickStatementName = this._initialState.bank_statement_id ? true : false;
if (this._initialState.bank_statement_id) {
var def = this.model.makeRecord("account.bank.statement", [{
@@ -72,6 +72,7 @@
<field name="currency_id" invisible="1"/>
</group>
<group>
<field name="analytic_tag_ids" groups="analytic.group_analytic_accounting" widget="many2many_tags" options="{'color_field': 'color'}"/>
<field domain="[('company_id', '=', parent.company_id)]" name="account_id" groups="account.group_account_user"/>
<field name="invoice_line_tax_ids" context="{'type':parent.type}" domain="[('type_tax_use','!=','none'),('company_id', '=', parent.company_id)]" widget="many2many_tags" options="{'no_create': True}"/>
<field domain="[('company_id', '=', parent.company_id)]" name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
+17 -1
View File
@@ -66,7 +66,7 @@
</div>
<group>
<group>
<field name="product_id" context="{'default_can_be_expensed': 1}"/>
<field name="product_id" context="{'default_can_be_expensed': 1, 'tree_view_ref': 'hr_expense.product_product_expense_tree_view'}"/>
<field name="unit_amount" required="1" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<label for="quantity"/>
<div>
@@ -317,6 +317,22 @@
</field>
</record>
<record id="product_product_expense_tree_view" model="ir.ui.view">
<field name="name">product.product.expense.tree</field>
<field name="model">product.product</field>
<field eval="50" name="priority"/>
<field name="arch" type="xml">
<tree string="Product Variants">
<field name="default_code"/>
<field name="name"/>
<field name="attribute_value_ids" widget="many2many_tags" groups="product.group_product_variant"/>
<field name="standard_price"/>
<field name="uom_id" options="{'no_open': True, 'no_create': True}" groups="product.group_uom"/>
<field name="barcode"/>
</tree>
</field>
</record>
<record id="hr_expense_product" model="ir.actions.act_window">
<field name="name">Expense Products</field>
<field name="res_model">product.product</field>
+2 -2
View File
@@ -60,8 +60,8 @@ class MailTracking(models.Model):
values.update({
'old_value_integer': initial_value and initial_value.id or 0,
'new_value_integer': new_value and new_value.id or 0,
'old_value_char': initial_value and initial_value.name_get()[0][1] or '',
'new_value_char': new_value and new_value.name_get()[0][1] or ''
'old_value_char': initial_value and initial_value.sudo().name_get()[0][1] or '',
'new_value_char': new_value and new_value.sudo().name_get()[0][1] or ''
})
else:
tracked = False
+1 -1
View File
@@ -73,7 +73,7 @@
<template id="message_user_assigned">
<p style="margin: 0px;">
<span>Dear <t t-esc="object.user_id.name"/>,</span><br />
<span>Dear <t t-esc="object.user_id.sudo().name"/>,</span><br />
<span style="margin-top: 8px;">You have been assigned to the <t t-esc="object._description.lower()"/> <t t-esc="object.name_get()[0][1]"/>.</span>
</p>
<p style="margin-top: 24px; margin-bottom: 16px;">
+2 -1
View File
@@ -1509,6 +1509,7 @@ exports.Orderline = Backbone.Model.extend({
// when we add an new orderline we want to merge it with the last line to see reduce the number of items
// in the orderline. This returns true if it makes sense to merge the two
can_be_merged_with: function(orderline){
var price = parseFloat(round_di(this.price || 0, this.pos.dp['Product Price']).toFixed(this.pos.dp['Product Price']));
if( this.get_product().id !== orderline.get_product().id){ //only orderline of the same product can be merged
return false;
}else if(!this.get_unit() || !this.get_unit().is_pos_groupable){
@@ -1517,7 +1518,7 @@ exports.Orderline = Backbone.Model.extend({
return false;
}else if(this.get_discount() > 0){ // we don't merge discounted orderlines
return false;
}else if(this.price !== orderline.get_product().get_price(orderline.order.pricelist, this.get_quantity())){
}else if(price !== orderline.get_product().get_price(orderline.order.pricelist, this.get_quantity())){
return false;
}else if(this.product.tracking == 'lot') {
return false;
+3 -1
View File
@@ -213,7 +213,7 @@ class Inventory(models.Model):
def _get_inventory_lines_values(self):
# TDE CLEANME: is sql really necessary ? I don't think so
locations = self.env['stock.location'].search([('id', 'child_of', [self.location_id.id])])
domain = ' location_id in %s'
domain = ' location_id in %s AND active = TRUE'
args = (tuple(locations.ids),)
vals = []
@@ -254,6 +254,8 @@ class Inventory(models.Model):
self.env.cr.execute("""SELECT product_id, sum(quantity) as product_qty, location_id, lot_id as prod_lot_id, package_id, owner_id as partner_id
FROM stock_quant
LEFT JOIN product_product
ON product_product.id = stock_quant.product_id
WHERE %s
GROUP BY product_id, location_id, lot_id, package_id, partner_id """ % domain, args)
+4 -2
View File
@@ -11,9 +11,11 @@ class SaleOrderLine(models.Model):
@api.multi
def _get_qty_procurement(self):
if not self.move_ids.filtered(lambda r: r.state != 'cancel') and self.purchase_line_ids.filtered(lambda r: r.state != 'cancel'):
# People without purchase rights should be able to do this operation
purchase_lines_sudo = self.sudo().purchase_line_ids
if not self.move_ids.filtered(lambda r: r.state != 'cancel') and purchase_lines_sudo.filtered(lambda r: r.state != 'cancel'):
qty = 0.0
for po_line in self.purchase_line_ids.filtered(lambda r: r.state != 'cancel'):
for po_line in purchase_lines_sudo.filtered(lambda r: r.state != 'cancel'):
qty += po_line.product_uom._compute_quantity(po_line.product_qty, self.product_uom, rounding_method='HALF-UP')
return qty
else:
+16
View File
@@ -0,0 +1,16 @@
India 2018-08-27
Cybrosys Techno SOlutions agrees to the terms of the Odoo Corporate
Contributor License Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Niyas Raphy niyas@cybrosys.com https://github.com/CybroOdoo
List of contributors:
Sainu Abideen sainu@cybrosys.com https://github.com/CybroOdoo
Cybrosys odoo@cybrosys.com https://github.com/CybroOdoo
+1 -1
View File
@@ -1734,7 +1734,7 @@
<field file="base/static/img/country_flags/vn.png" name="image" type="base64" />
<field name="currency_id" ref="VND" />
<field eval="84" name="phone_code" />
<field eval="'%(street)s\n%(street2)s\n%(city)s\n%(name)s %(zip)s %(country_name)s'" name="address_format" />
<field eval="'%(street)s\n%(street2)s\n%(city)s\n%(state_name)s %(country_name)s'" name="address_format" />
</record>
<record id="vu" model="res.country">
<field name="name">Vanuatu</field>
+1 -1
View File
@@ -288,7 +288,7 @@ class IrHttp(models.AbstractModel):
# access token grant access
if model == 'ir.attachment' and access_token:
obj = obj.sudo()
if not consteq(obj.access_token or '', access_token):
if not consteq(obj.access_token or u'', access_token):
return (403, [], None)
# check read access
+7 -7
View File
@@ -97,29 +97,29 @@ class test_ir_http_mimetype(common.TransactionCase):
def test_access(**kwargs):
status, _, _ = self.env['ir.http'].binary_content(
**defaults, **kwargs
**dict(defaults, **kwargs)
)
return status
status = test_access()
self.assertEqual(status, 403, "no access")
status = test_access(access_token='Secret')
status = test_access(access_token=u'Secret')
self.assertEqual(status, 403,
"no access if access token for attachment without access token")
attachment.access_token = 'Secret'
status = test_access(access_token='Secret')
attachment.access_token = u'Secret'
status = test_access(access_token=u'Secret')
self.assertEqual(status, 200, "access for correct access token")
status = test_access(access_token='Wrong')
status = test_access(access_token=u'Wrong')
self.assertEqual(status, 403, "no access for wrong access token")
attachment.public = True
status = test_access()
self.assertEqual(status, 200, "access for attachment with access")
status = test_access(access_token='Wrong')
status = test_access(access_token=u'Wrong')
self.assertEqual(status, 403,
"no access for wrong access token for attachment with access")
@@ -127,6 +127,6 @@ class test_ir_http_mimetype(common.TransactionCase):
status = test_access()
self.assertEqual(status, 404, "no access for deleted attachment")
status = test_access(access_token='Secret')
status = test_access(access_token=u'Secret')
self.assertEqual(status, 404,
"no access with access token for deleted attachment")