[MERGE] forward port branch saas-15 up to b141b24706

This commit is contained in:
Christophe Simonis
2017-06-27 12:41:47 +02:00
21 changed files with 99 additions and 21 deletions
@@ -2,6 +2,7 @@
import time
from odoo import api, models, _
from odoo.exceptions import UserError
from odoo.tools import float_is_zero
from datetime import datetime
from dateutil.relativedelta import relativedelta
@@ -196,6 +197,9 @@ class ReportAgedPartnerBalance(models.AbstractModel):
@api.model
def render_html(self, docids, data=None):
if not data.get('form') or not self.env.context.get('active_model') or not self.env.context.get('active_id'):
raise UserError(_("Some data are missing, this report cannot be printed."))
total = []
model = self.env.context.get('active_model')
docs = self.env[model].browse(self.env.context.get('active_id'))
+4
View File
@@ -2,6 +2,7 @@
import time
from odoo import api, models
from odoo.exceptions import UserError
class ReportTrialBalance(models.AbstractModel):
@@ -59,6 +60,9 @@ class ReportTrialBalance(models.AbstractModel):
@api.model
def render_html(self, docids, data=None):
if not data.get('form') or not self.env.context.get('active_model'):
raise UserError(_("Some data are missing, this report cannot be printed."))
self.model = self.env.context.get('active_model')
docs = self.env[self.model].browse(self.env.context.get('active_ids', []))
display_account = data['form'].get('display_account')
@@ -2,6 +2,7 @@
import time
from odoo import api, models
from odoo.exceptions import UserError
class ReportGeneralLedger(models.AbstractModel):
@@ -109,6 +110,9 @@ class ReportGeneralLedger(models.AbstractModel):
@api.model
def render_html(self, docids, data=None):
if not data.get('form') or not self.env.context.get('active_model'):
raise UserError(_("Some data are missing, this report cannot be printed."))
self.model = self.env.context.get('active_model')
docs = self.env[self.model].browse(self.env.context.get('active_ids', []))
+4
View File
@@ -2,6 +2,7 @@
import time
from odoo import api, models
from odoo.exceptions import UserError
class ReportJournal(models.AbstractModel):
@@ -95,6 +96,9 @@ class ReportJournal(models.AbstractModel):
@api.model
def render_html(self, docids, data=None):
if not data.get('form'):
raise UserError(_("Some data are missing, this report cannot be printed."))
target_move = data['form'].get('target_move', 'all')
sort_selection = data['form'].get('sort_selection', 'date')
@@ -3,6 +3,7 @@
from datetime import datetime
import time
from odoo import api, models
from odoo.exceptions import UserError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
@@ -69,6 +70,9 @@ class ReportPartnerLedger(models.AbstractModel):
@api.model
def render_html(self, docids, data=None):
if not data.get('form'):
raise UserError(_("Some data are missing, this report cannot be printed."))
data['computed'] = {}
obj_partner = self.env['res.partner']
@@ -2,6 +2,7 @@
import time
from odoo import api, models
from odoo.exceptions import UserError
class ReportFinancial(models.AbstractModel):
@@ -144,6 +145,9 @@ class ReportFinancial(models.AbstractModel):
@api.model
def render_html(self, docids, data=None):
if not data.get('form') or not self.env.context.get('active_model') or not self.env.context.get('active_id'):
raise UserError(_("Some data are missing, this report cannot be printed."))
self.model = self.env.context.get('active_model')
docs = self.env[self.model].browse(self.env.context.get('active_id'))
report_lines = self.get_account_lines(data.get('form'))
@@ -4,6 +4,7 @@
from datetime import timedelta
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
from odoo.exceptions import UserError
class HrHolidaySummaryReport(models.AbstractModel):
@@ -102,6 +103,9 @@ class HrHolidaySummaryReport(models.AbstractModel):
@api.model
def render_html(self, docids, data=None):
if not data.get('form'):
raise UserError(_("Some data are missing, this report cannot be printed."))
Report = self.env['report']
holidays_report = Report._get_report_from_name('hr_holidays.report_holidayssummary')
holidays = self.env['hr.holidays'].browse(self.ids)
@@ -6,6 +6,7 @@ from datetime import datetime
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
from odoo.exceptions import UserError
class ContributionRegisterReport(models.AbstractModel):
@@ -29,6 +30,9 @@ class ContributionRegisterReport(models.AbstractModel):
@api.model
def render_html(self, docids, data=None):
if not data.get('form'):
raise UserError(_("Some data are missing, this report cannot be printed."))
register_ids = self.env.context.get('active_ids', [])
contrib_registers = self.env['hr.contribution.register'].browse(register_ids)
date_from = data['form'].get('date_from', fields.Date.today())
@@ -4,6 +4,7 @@
from datetime import date
from odoo import api, models
from odoo.exceptions import UserError
class ReportHrSalaryEmployeeBymonth(models.AbstractModel):
@@ -93,6 +94,9 @@ class ReportHrSalaryEmployeeBymonth(models.AbstractModel):
@api.model
def render_html(self, docids, data=None):
if not data.get('form') or not self.env.context.get('active_model') or not self.env.context.get('active_id'):
raise UserError(_("Some data are missing, this report cannot be printed."))
model = self.env.context.get('active_model')
docs = self.env[model].browse(self.env.context.get('active_id'))
get_periods, months, total_mnths = self.get_periods(data['form'])
@@ -4,6 +4,7 @@
from datetime import date
from odoo import api, models
from odoo.exceptions import UserError
class EmployeesYearlySalaryReport(models.AbstractModel):
@@ -127,6 +128,9 @@ class EmployeesYearlySalaryReport(models.AbstractModel):
@api.model
def render_html(self, docids, data=None):
if not self.env.context.get('active_model') or not self.env.context.get('active_id'):
raise UserError(_("Some data are missing, this report cannot be printed."))
model = self.env.context.get('active_model')
docs = self.env[model].browse(self.env.context.get('active_id'))
docargs = {
+2 -5
View File
@@ -208,11 +208,8 @@ class MrpProduction(models.Model):
@api.depends('move_raw_ids.quantity_done', 'move_finished_ids.quantity_done')
def _compute_post_visible(self):
for order in self:
if order.product_tmpl_id._is_cost_method_standard():
order.post_visible = any((x.quantity_done > 0 and x.state not in ['done', 'cancel']) for x in order.move_raw_ids) or \
any((x.quantity_done > 0 and x.state not in ['done' 'cancel']) for x in order.move_finished_ids)
else:
order.post_visible = any((x.quantity_done > 0 and x.state not in ['done' 'cancel']) for x in order.move_finished_ids)
order.post_visible = any(order.move_raw_ids.filtered(lambda x: (x.quantity_done) > 0 and (x.state not in ['done', 'cancel']))) or \
any(order.move_finished_ids.filtered(lambda x: (x.quantity_done) > 0 and (x.state not in ['done', 'cancel'])))
@api.multi
@api.depends('workorder_ids.state', 'move_finished_ids')
+1 -1
View File
@@ -48,7 +48,7 @@
<button name="button_plan" attrs="{'invisible': ['|', ('state', '!=', 'confirmed'), ('routing_id', '=', False)]}" type="object" string="Create Workorders" class="oe_highlight"/>
<button name="open_produce_product" attrs="{'invisible': ['|', '|', '|', ('check_to_done', '=', True), ('availability', 'not in', ['partially_available', 'assigned']), ('state', 'not in', ('confirmed','progress')), ('routing_id', '!=', False)]}" string="Produce" type="object" class="oe_highlight"/>
<button name="open_produce_product" attrs="{'invisible': ['|', '|', '|', ('check_to_done', '=', True), ('availability', '!=', 'waiting'), ('state', 'not in', ('confirmed','progress')), ('routing_id', '!=', False)]}" string="Produce" type="object"/>
<button name="post_inventory" string="Post Inventory" type="object" attrs="{'invisible': [('post_visible', '=', False)]}"/>
<button name="post_inventory" string="Post Inventory" type="object" attrs="{'invisible': [('post_visible', '=', False)]}" groups="base.group_no_one"/>
<button name="action_cancel" type="object" string="Cancel" attrs="{'invisible': ['|', ('state', 'in', ('done','cancel')), ('check_to_done', '=', True)]}"/>
<button name="button_scrap" type="object" string="Scrap" attrs="{'invisible': ['|', ('availability', '=', 'none'), ('state', 'in', ('cancel'))]}"/>
<button name="button_unreserve" type="object" string="Unreserve" attrs="{'invisible': [('unreserve_visible', '=', False)]}"/>
-3
View File
@@ -419,9 +419,6 @@ class ProductTemplate(models.Model):
relation="stock.location.route", string="Category Routes",
related='categ_id.total_route_ids')
def _is_cost_method_standard(self):
return True
def _compute_quantities(self):
res = self._compute_quantities_dict()
for template in self:
+7 -3
View File
@@ -325,11 +325,11 @@ class Picking(models.Model):
.filtered(lambda move: move.state not in ['cancel', 'done'])\
.sorted(key=lambda move: (move.state == 'assigned' and 2) or (move.state == 'waiting' and 1) or 0)
if self.move_type == 'one':
self.state = moves_todo[0].state
self.state = moves_todo[0].state or 'draft'
elif moves_todo[0].state != 'assigned' and any(x.partially_available or x.state == 'assigned' for x in moves_todo):
self.state = 'partially_available'
else:
self.state = moves_todo[-1].state
self.state = moves_todo[-1].state or 'draft'
@api.one
@api.depends('move_lines.priority')
@@ -607,9 +607,13 @@ class Picking(models.Model):
forced_qties[move.product_id] = forced_qty
for vals in picking._prepare_pack_ops(picking_quants, forced_qties):
vals['fresh_record'] = False
PackOperation.create(vals)
PackOperation |= PackOperation.create(vals)
# recompute the remaining quantities all at once
self.do_recompute_remaining_quantities()
for pack in PackOperation:
pack.ordered_qty = sum(
pack.mapped('linked_move_operation_ids').mapped('move_id').filtered(lambda r: r.state != 'cancel').mapped('ordered_qty')
)
self.write({'recompute_pack_op': False})
@api.multi
+1
View File
@@ -157,6 +157,7 @@
<header>
<field name="state" widget="statusbar"/>
</header>
<field name="scrapped" invisible="1"/>
<group>
<group string="#Products">
<field name="product_id"/>
-3
View File
@@ -51,9 +51,6 @@ class ProductTemplate(models.Model):
def _compute_cost_method(self):
self.cost_method = self.property_cost_method or self.categ_id.property_cost_method
def _is_cost_method_standard(self):
return self.property_cost_method == 'standard'
@api.one
def _set_cost_method(self):
return self.write({'property_cost_method': self.cost_method})
+1 -1
View File
@@ -41,7 +41,7 @@ class StockHistory(models.Model):
self._cr.execute("""SELECT DISTINCT ON (product_id, company_id) product_id, company_id, cost
FROM product_price_history
WHERE product_id in %s AND datetime <= %s
ORDER BY product_id, company_id, datetime DESC""", (tuple(not_real_cost_method_products.ids), date))
ORDER BY product_id, company_id, datetime DESC, id DESC""", (tuple(not_real_cost_method_products.ids), date))
for history in self._cr.dictfetchall():
histories_dict[(history['product_id'], history['company_id'])] = history['cost']
@@ -788,6 +788,11 @@ msgstr ""
msgid "Close"
msgstr ""
#. module: website_forum
#: model:ir.ui.view,arch_db:website_forum.close_post
msgid "Close Post"
msgstr ""
#. module: website_forum
#: model:ir.model.fields,field_description:website_forum.field_forum_forum_karma_close_all
msgid "Close all posts"
@@ -798,6 +803,11 @@ msgstr ""
msgid "Close own posts"
msgstr ""
#. module: website_forum
#: model:ir.ui.view,arch_db:website_forum.close_post
msgid "Close post"
msgstr ""
#. module: website_forum
#: model:ir.model.fields,field_description:website_forum.field_forum_post_closed_uid
msgid "Closed by"
@@ -1205,6 +1215,7 @@ msgid "First upvote"
msgstr ""
#. module: website_forum
#: model:ir.ui.view,arch_db:website_forum.post_answers
#: model:ir.ui.view,arch_db:website_forum.post_description_full
msgid "Flag"
msgstr ""
@@ -1218,6 +1229,7 @@ msgstr ""
#. module: website_forum
#: selection:forum.post,state:0
#: model:ir.ui.view,arch_db:website_forum.moderation_queue
#: model:ir.ui.view,arch_db:website_forum.post_answers
#: model:ir.ui.view,arch_db:website_forum.post_description_full
msgid "Flagged"
msgstr ""
@@ -1591,6 +1603,11 @@ msgstr ""
msgid "Links"
msgstr ""
#. module: website_forum
#: model:ir.ui.view,arch_db:website_forum.close_post
msgid "Mark as offensive"
msgstr ""
#. module: website_forum
#: model:ir.model.fields,field_description:website_forum.field_forum_forum_karma_moderate
msgid "Moderate posts"
@@ -1757,6 +1774,11 @@ msgstr ""
msgid "Offensive"
msgstr ""
#. module: website_forum
#: model:ir.ui.view,arch_db:website_forum.close_post
msgid "Offensive Post"
msgstr ""
#. module: website_forum
#: model:ir.ui.view,arch_db:website_forum.post_answers
msgid "On"
+11 -5
View File
@@ -631,7 +631,10 @@
<!-- Moderation: close a post -->
<template id="close_post">
<t t-call="website_forum.header">
<h1 class="mt0"><t t-esc="offensive and 'Offensive' or 'Close'"/> Post</h1>
<h1 class="mt0">
<t t-if="offensive">Offensive Post</t>
<t t-if="not offensive">Close Post</t>
</h1>
<p class="text-muted" t-if="not offensive">
If you close this post, it will be hidden for most users. Only
users having a high karma can see closed posts to moderate
@@ -668,7 +671,10 @@
</div>
<div class="form-group">
<div class="col-md-offset-3 col-md-8">
<button type="submit" class="btn btn-primary"><t t-esc="offensive and 'Mark as offensive' or 'Close post'"/></button>
<button type="submit" class="btn btn-primary">
<t t-if="offensive">Mark as offensive</t>
<t t-if="not offensive">Close post</t>
</button>
<span class="text-muted">or</span>
<a class="btn btn-link" t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(question) }">back to post</a>
</div>
@@ -1005,9 +1011,9 @@
<a t-attf-style="cursor: pointer;#{not answer.can_flag and 'color:#999;' or ''}"
t-attf-class="flag fa fa-flag #{not answer.can_flag and 'karma_required' or ''}"
t-attf-data-karma="#{not answer.can_flag and answer.forum_id.karma_flag or 0}"
t-attf-data-href="/forum/#{slug(forum)}/post/#{slug(answer)}/flag"
>
<t class="flag_flagged_label" t-esc="answer.state == 'flagged' and 'Flagged' or 'Flag'"/>
t-attf-data-href="/forum/#{slug(forum)}/post/#{slug(answer)}/flag">
<t t-if="answer.state == 'flagged'">Flagged</t>
<t t-if="answer.state != 'flagged'">Flag</t>
</a>
</li>
<li t-if="question.post_type == 'question'">
+9
View File
@@ -0,0 +1,9 @@
Poland, 2017-06-25
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,
Marcin Pieczyński marcin-pieczynski@wp.pl https://github.com/piemar1
+5
View File
@@ -1120,6 +1120,11 @@ default and behave as booleans (they can only be enabled by default).
Gantt
-----
.. warning::
The gantt view requires the web_gantt module which is present in
:ref:`the enterprise edition <setup/install/editions>` version.
Horizontal bar charts typically used to show project planning and advancement,
their root element is ``<gantt>``.