diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot
index 036c6a62735..b88b5f39baa 100644
--- a/addons/account/i18n/account.pot
+++ b/addons/account/i18n/account.pot
@@ -670,6 +670,16 @@ msgstr ""
msgid "A tax fiscal position could be defined only one time on same taxes."
msgstr ""
+#. module: account
+#: code:addons/account/models/res_users.py:17
+#, python-format
+msgid "A user cannot have both Tax B2B and Tax B2C.\n"
+"Problematic user(s): %s\n"
+"You should go in General Settings, and choose to display Product Prices\n"
+"either in 'Tax-Included' or in 'Tax-Excluded' mode\n"
+"(or switch twice the mode if you are already in the desired one)."
+msgstr ""
+
#. module: account
#: model:res.groups,name:account.group_warning_account
msgid "A warning can be set on a partner (Account)"
diff --git a/addons/account/models/res_users.py b/addons/account/models/res_users.py
index 3e6fd163482..ab85e359d22 100644
--- a/addons/account/models/res_users.py
+++ b/addons/account/models/res_users.py
@@ -12,7 +12,15 @@ class Users(models.Model):
@api.constrains('groups_id')
def _check_one_user_type(self):
super(Users, self)._check_one_user_type()
- for user in self:
- if (user.user_has_groups('account.group_show_line_subtotals_tax_included') and
- user.user_has_groups('account.group_show_line_subtotals_tax_excluded')):
- raise ValidationError(_('A user cannot have both Tax B2B and Tax B2C'))
+
+ users_with_both_groups = self.filtered(lambda user:
+ user.user_has_groups('account.group_show_line_subtotals_tax_included') and
+ user.user_has_groups('account.group_show_line_subtotals_tax_excluded')
+ )
+ if users_with_both_groups:
+ names = ", ".join(users_with_both_groups.mapped('name'))
+ raise ValidationError(_("A user cannot have both Tax B2B and Tax B2C.\n"
+ "Problematic user(s): %s\n"
+ "You should go in General Settings, and choose to display Product Prices\n"
+ "either in 'Tax-Included' or in 'Tax-Excluded' mode\n"
+ "(or switch twice the mode if you are already in the desired one).") % names)
diff --git a/addons/l10n_be_hr_payroll/models/l10n_be_hr_payroll.py b/addons/l10n_be_hr_payroll/models/l10n_be_hr_payroll.py
index e4063cc7139..a1f4bfc6dca 100644
--- a/addons/l10n_be_hr_payroll/models/l10n_be_hr_payroll.py
+++ b/addons/l10n_be_hr_payroll/models/l10n_be_hr_payroll.py
@@ -89,15 +89,7 @@ class HrContract(models.Model):
def _inverse_wage_with_holidays(self):
for contract in self:
if contract.holidays:
- remaining_for_gross = contract.wage_with_holidays * (13.0 + 13.0 * 0.3507 + 0.92)
- yearly_cost = remaining_for_gross \
- + 12.0 * contract.representation_fees \
- + 12.0 * contract.fuel_card \
- + 12.0 * contract.internet \
- + 12.0 * (contract.mobile + contract.mobile_plus) \
- + 12.0 * contract.transport_employer_cost \
- + contract.warrants_cost \
- + 220.0 * contract.meal_voucher_paid_by_employer
+ yearly_cost = contract._get_advantages_costs() + (13.92 + 13.0 * 0.3507) * contract.wage_with_holidays
contract.final_yearly_costs = yearly_cost / (1.0 - contract.holidays / 231.0)
contract.wage = contract._get_gross_from_employer_costs(contract.final_yearly_costs)
else:
@@ -106,7 +98,6 @@ class HrContract(models.Model):
@api.depends('transport_mode_car', 'transport_mode_public', 'transport_mode_others',
'company_car_total_depreciated_cost', 'public_transport_reimbursed_amount', 'others_reimbursed_amount')
def _compute_transport_employer_cost(self):
- # Don't call to super has we ovewrite the method
for contract in self:
transport_employer_cost = 0.0
if contract.transport_mode_car:
@@ -137,17 +128,13 @@ class HrContract(models.Model):
contract.transport_employer_cost
)
- @api.depends('yearly_cost_before_charges', 'social_security_contributions', 'wage',
- 'social_security_contributions', 'warrants_cost', 'meal_voucher_paid_by_employer')
+ @api.depends(
+ 'wage', 'fuel_card', 'representation_fees', 'transport_employer_cost',
+ 'internet', 'mobile', 'mobile_plus', 'warrants_cost',
+ 'meal_voucher_paid_by_employer')
def _compute_final_yearly_costs(self):
for contract in self:
- contract.final_yearly_costs = (
- contract.yearly_cost_before_charges +
- contract.social_security_contributions +
- contract.wage * 0.92 +
- contract.warrants_cost +
- (220.0 * contract.meal_voucher_paid_by_employer)
- )
+ contract.final_yearly_costs = contract._get_advantages_costs() + (13.92 + 13.0 * 0.3507) * contract.wage
@api.onchange('final_yearly_costs')
def _onchange_final_yearly_costs(self):
@@ -197,6 +184,18 @@ class HrContract(models.Model):
if self.mobile_plus and not self.mobile:
raise ValidationError(_('You should have a mobile subscription to select an international communication amount.'))
+ def _get_advantages_costs(self):
+ self.ensure_one()
+ return (
+ 12.0 * self.representation_fees +
+ 12.0 * self.fuel_card +
+ 12.0 * self.internet +
+ 12.0 * (self.mobile + self.mobile_plus) +
+ 12.0 * self.transport_employer_cost +
+ self.warrants_cost +
+ 220.0 * self.meal_voucher_paid_by_employer
+ )
+
def _get_mobile_amount(self, has_mobile, international_communication):
if has_mobile and international_communication:
return self.env['ir.default'].sudo().get('hr.contract', 'mobile') + self.env['ir.default'].sudo().get('hr.contract', 'mobile_plus')
@@ -205,17 +204,9 @@ class HrContract(models.Model):
return 0.0
def _get_gross_from_employer_costs(self, yearly_cost):
- contract = self
- remaining_for_gross = yearly_cost \
- - 12.0 * contract.representation_fees \
- - 12.0 * contract.fuel_card \
- - 12.0 * contract.internet \
- - 12.0 * (contract.mobile + contract.mobile_plus) \
- - 12.0 * contract.transport_employer_cost \
- - contract.warrants_cost \
- - 220.0 * contract.meal_voucher_paid_by_employer
- gross = remaining_for_gross / (13.0 + 13.0 * 0.3507 + 0.92)
- return gross
+ self.ensure_one()
+ remaining_for_gross = yearly_cost - self._get_advantages_costs()
+ return remaining_for_gross / (13.92 + 13.0 * 0.3507)
class HrEmployee(models.Model):
diff --git a/addons/l10n_be_hr_payroll/views/l10n_be_hr_payroll_view.xml b/addons/l10n_be_hr_payroll/views/l10n_be_hr_payroll_view.xml
index ff04cc77592..6931a44e8bc 100644
--- a/addons/l10n_be_hr_payroll/views/l10n_be_hr_payroll_view.xml
+++ b/addons/l10n_be_hr_payroll/views/l10n_be_hr_payroll_view.xml
@@ -62,7 +62,7 @@
-
+
diff --git a/addons/l10n_be_hr_payroll/views/res_config_settings_views.xml b/addons/l10n_be_hr_payroll/views/res_config_settings_views.xml
index 947cfbb98f7..fc3c38f8c34 100644
--- a/addons/l10n_be_hr_payroll/views/res_config_settings_views.xml
+++ b/addons/l10n_be_hr_payroll/views/res_config_settings_views.xml
@@ -16,7 +16,7 @@
Configure Default Values for Belgian Advantages
-
+ >
diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py
index 6ff131130f5..8e351236d65 100644
--- a/addons/mrp/models/mrp_production.py
+++ b/addons/mrp/models/mrp_production.py
@@ -743,7 +743,7 @@ class MrpProduction(models.Model):
})
if workorders:
workorders[-1].next_work_order_id = workorder.id
- workorders[-1]._init_nextworkorder_states()
+ workorders[-1]._start_nextworkorder()
workorders += workorder
# assign moves; last operation receive all unassigned moves (which case ?)
diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py
index 0452dd0b370..75a9ec61c51 100644
--- a/addons/mrp/models/mrp_workorder.py
+++ b/addons/mrp/models/mrp_workorder.py
@@ -219,9 +219,6 @@ class MrpWorkorder(models.Model):
if self.qty_producing <= 0:
raise UserError(_('Please set the quantity you are currently producing. It should be different from zero.'))
- # One a piece is produced, you can launch the next work order
- self._start_nextworkorder()
-
# If last work order, then post lots used
# TODO: should be same as checking if for every workorder something has been done?
if not self.next_work_order_id:
@@ -237,6 +234,9 @@ class MrpWorkorder(models.Model):
self.final_lot_id.use_next_on_work_order_id = self.next_work_order_id
self.final_lot_id = False
+ # One a piece is produced, you can launch the next work order
+ self._start_nextworkorder()
+
# Set a qty producing
rounding = self.production_id.product_uom_id.rounding
if float_compare(self.qty_produced, self.production_id.product_qty, precision_rounding=rounding) >= 0:
@@ -258,12 +258,13 @@ class MrpWorkorder(models.Model):
@api.multi
def _start_nextworkorder(self):
- for record in self:
- if record.next_work_order_id.state == 'pending':
- record.next_work_order_id.state = 'ready'
-
- def _init_nextworkorder_states(self):
- return 'pending'
+ rounding = self.product_id.uom_id.rounding
+ if self.next_work_order_id.state == 'pending' and (
+ (self.operation_id.batch == 'no' and
+ float_compare(self.qty_production, self.qty_produced, precision_rounding=rounding) <= 0) or
+ (self.operation_id.batch == 'yes' and
+ float_compare(self.operation_id.batch_size, self.qty_produced, precision_rounding=rounding) <= 0)):
+ self.next_work_order_id.state = 'ready'
@api.multi
def button_start(self):
diff --git a/addons/stock_account/models/stock.py b/addons/stock_account/models/stock.py
index a708f57e256..398b7d6d672 100644
--- a/addons/stock_account/models/stock.py
+++ b/addons/stock_account/models/stock.py
@@ -560,7 +560,7 @@ class StockMove(models.Model):
debit_value = self.company_id.currency_id.round(valuation_amount)
# check that all data is correct
- if self.company_id.currency_id.is_zero(debit_value):
+ if self.company_id.currency_id.is_zero(debit_value) and not self.env['ir.config_parameter'].sudo().get_param('stock_account.allow_zero_cost'):
raise UserError(_("The cost of %s is currently equal to 0. Change the cost or the configuration of your product to avoid an incorrect valuation.") % (self.product_id.display_name,))
credit_value = debit_value
diff --git a/doc/cla/individual/hviniciusg.md b/doc/cla/individual/hviniciusg.md
new file mode 100644
index 00000000000..d98b0703a49
--- /dev/null
+++ b/doc/cla/individual/hviniciusg.md
@@ -0,0 +1,11 @@
+Bolivia, 2019-03-31
+
+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,
+
+Hugo Vinicius Garcia Razeara hviniciusg@gmail.com https://github.com/hviniciusg
diff --git a/odoo/tests/common.py b/odoo/tests/common.py
index 6f9472f6ee5..941f7b10384 100644
--- a/odoo/tests/common.py
+++ b/odoo/tests/common.py
@@ -1454,12 +1454,13 @@ class Form(object):
return []
v = []
- c = {t[1]: t[2] for t in current if t[0] in (1, 2)} if current else {}
+ c = {t[1] for t in current if t[0] in (1, 2)} if current else set()
# which view should this be???
subfields = descr['views']['edition']['fields']
+ # TODO: simplistic, unlikely to work if e.g. there's a 5 inbetween other commands
for command in value:
if command[0] in (0, 1):
- c.pop(command[1], None) # remove record from currents
+ c.discard(command[1])
v.append((command[0], command[1], {
k: self._cleanup_onchange(
subfields[k], v, None
@@ -1468,9 +1469,11 @@ class Form(object):
if k in subfields
}))
elif command[0] == 2:
+ c.discard(command[1])
v.append((2, command[1], False))
elif command[0] == 4:
- v.append((1, command[1], c.pop(command[1], {})))
+ c.discard(command[1])
+ v.append((1, command[1], {}))
elif command[0] == 5:
v = []
# explicitly mark all non-relinked (or modified) records as deleted