[MERGE] forward port branch 12.0 up to c9d3653f48

This commit is contained in:
Christophe Simonis
2019-04-11 18:00:27 +02:00
7 changed files with 51 additions and 18 deletions
+10
View File
@@ -665,6 +665,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)"
+12 -4
View File
@@ -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)
+1 -1
View File
@@ -671,7 +671,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 ?)
+10 -9
View File
@@ -343,9 +343,6 @@ class MrpWorkorder(models.Model):
move_line.lot_produced_id = self.final_lot_id.id
move_line.done_wo = True
# One a piece is produced, you can launch the next work order
self._start_nextworkorder()
self.move_line_ids.filtered(
lambda move_line: not move_line.done_move and not move_line.lot_produced_id and move_line.qty_done > 0
).write({
@@ -396,6 +393,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:
@@ -417,12 +417,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):
+1 -1
View File
@@ -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
+11
View File
@@ -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
+6 -3
View File
@@ -1461,12 +1461,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
@@ -1475,9 +1476,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