[MERGE] forward port branch saas-14 up to 85fd5cc147

This commit is contained in:
Christophe Simonis
2018-03-08 12:45:29 +01:00
6 changed files with 9 additions and 6 deletions
+2 -1
View File
@@ -354,7 +354,8 @@ class HrExpense(models.Model):
product = default_product
else:
expense_description = expense_description.replace(product_code.group(), '')
product = self.env['product.product'].search([('default_code', 'ilike', product_code.group(1))]) or default_product
products = self.env['product.product'].search([('default_code', 'ilike', product_code.group(1))]) or default_product
product = products.filtered(lambda p: p.default_code == product_code.group(1)) or products[0]
pattern = '[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?'
# Match the last occurence of a float in the string
@@ -35,6 +35,7 @@ class HrPayslipEmployees(models.TransientModel):
'date_from': from_date,
'date_to': to_date,
'credit_note': run_data.get('credit_note'),
'company_id': employee.company_id.id,
}
payslips += self.env['hr.payslip'].create(res)
payslips.compute_sheet()
+2 -1
View File
@@ -45,7 +45,8 @@ class StockMove(models.Model):
order = self.purchase_line_id.order_id
#if the currency of the PO is different than the company one, the price_unit on the move must be reevaluated
#(was created at the rate of the PO confirmation, but must be valuated at the rate of stock move execution)
if order.currency_id != self.company_id.currency_id:
#also change when the unit price on the PO line changes in the meantime
if order.currency_id != self.company_id.currency_id or self.purchase_line_id.price_unit != self.price_unit:
#we don't pass the move.date in the compute() for the currency rate on purpose because
# 1) get_price_unit() is supposed to be called only through move.action_done(),
# 2) the move hasn't yet the correct date (currently it is the expected date, after
+1 -1
View File
@@ -3,7 +3,7 @@
-
!python {model: res.company}: |
company = self.env.ref('base.main_company')
company.currency_id = self.env.ref('base.EUR')
self.env.cr.execute("UPDATE res_company SET currency_id = %s WHERE id = %s", [self.env.ref("base.EUR").id, company.id])
-
Set a product as using fifo price
-
@@ -8,7 +8,7 @@
<field name="inherit_id" ref="stock.view_inventory_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='date']" position="after">
<field name="accounting_date"/>
<field name="accounting_date" attrs="{'readonly':[('state','!=', 'draft')]}"/>
</xpath>
</field>
</record>
@@ -2,7 +2,7 @@
Set the company currency as EURO for the sake of repeatibility
-
!python {model: res.company, id: base.main_company}: |
self.write({'currency_id':ref('base.EUR')})
self.env.cr.execute("UPDATE res_company SET currency_id = %s WHERE id = %s", [self.env.ref("base.EUR").id, self.id])
-
Set product category removal strategy as LIFO
@@ -116,4 +116,4 @@
Check standard price became 80 euro
-
!python {model: product.product, id: product_lifo_icecream}: |
assert self.standard_price == 80.0, 'Price should have been 80 euro'
assert self.standard_price == 80.0, 'Price should have been 80 euro'