Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] #1

Open
wants to merge 1 commit into
base: 15.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/account/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ def _check_payment_method_line_ids_multiplicity(self):
method_ids = [res[0] for res in self._cr.fetchall()]
if method_ids:
methods = self.env['account.payment.method'].browse(method_ids)
raise ValidationError(_("Some payment methods supposed to be unique already exists somewhere else.\n"
"(%s)", ', '.join([method.display_name for method in methods])))
# raise ValidationError(_("Some payment methods supposed to be unique already exists somewhere else.\n"
# "(%s)", ', '.join([method.display_name for method in methods])))

@api.constrains('active')
def _check_auto_post_draft_entries(self):
Expand Down
4 changes: 2 additions & 2 deletions addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -1965,8 +1965,8 @@ def _compute_always_tax_exigible(self):
# set the tags as well, during the encoding. So, if no receivable/payable
# line has been created yet, the invoice would be detected as always exigible,
# and set the tags on some lines ; which would be wrong.
record.always_tax_exigible = not record.is_invoice(True) \
and not record._collect_tax_cash_basis_values()
record.always_tax_exigible = not record.is_invoice(True) #\
# and not record._collect_tax_cash_basis_values()

@api.depends('restrict_mode_hash_table', 'state')
def _compute_show_reset_to_draft_button(self):
Expand Down
3 changes: 2 additions & 1 deletion addons/account/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,8 @@ def _check_payment_method_line_id(self):
'''
for pay in self:
if not pay.payment_method_line_id:
raise ValidationError(_("Please define a payment method line on your payment."))
# raise ValidationError(_("Please define a payment method line on your payment."))
pass

# -------------------------------------------------------------------------
# LOW-LEVEL METHODS
Expand Down
2 changes: 1 addition & 1 deletion addons/hr_expense/models/hr_expense.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ def _default_bank_journal_id(self):
employee_id = fields.Many2one('hr.employee', string="Employee", required=True, readonly=True, tracking=True, states={'draft': [('readonly', False)]}, default=_default_employee_id, check_company=True, domain= lambda self: self.env['hr.expense']._get_employee_id_domain())
address_id = fields.Many2one('res.partner', compute='_compute_from_employee_id', store=True, readonly=False, copy=True, string="Employee Home Address", check_company=True)
payment_mode = fields.Selection(related='expense_line_ids.payment_mode', readonly=True, string="Paid By", tracking=True)
user_id = fields.Many2one('res.users', 'Manager', compute='_compute_from_employee_id', store=True, readonly=True, copy=False, states={'draft': [('readonly', False)]}, tracking=True, domain=lambda self: [('groups_id', 'in', self.env.ref('hr_expense.group_hr_expense_team_approver').id)])
user_id = fields.Many2one('res.users', 'Manager', compute='_compute_from_employee_id', store=True, readonly=True, copy=False, states={'draft': [('readonly', False)]}, tracking=True)
total_amount = fields.Monetary('Total Amount', currency_field='currency_id', compute='_compute_amount', store=True, tracking=True)
amount_residual = fields.Monetary(
string="Amount Due", store=True,
Expand Down
16 changes: 9 additions & 7 deletions addons/hr_holidays/models/hr_leave.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,11 @@ def _compute_from_employee_ids(self):
for holiday in self:
if len(holiday.employee_ids) == 1:
holiday.employee_id = holiday.employee_ids[0]._origin
holiday.multi_employee = False
else:
holiday.employee_id = False
holiday.multi_employee = (len(holiday.employee_ids) > 1)
holiday.multi_employee = True
# holiday.multi_employee = (len(holiday.employee_ids) > 1)

@api.depends('holiday_type')
def _compute_from_holiday_type(self):
Expand Down Expand Up @@ -622,9 +624,9 @@ def _check_date(self):
('state', 'not in', ['cancel', 'refuse']),
]
nholidays = self.search_count(domain)
if nholidays:
raise ValidationError(
_('You can not set 2 time off that overlaps on the same day for the same employee.') + '\n- %s' % (holiday.display_name))
# if nholidays:
# raise ValidationError(
# _('You can not set 2 time off that overlaps on the same day for the same employee.') + '\n- %s' % (holiday.display_name))

@api.constrains('state', 'number_of_days', 'holiday_status_id')
def _check_holidays(self):
Expand All @@ -641,9 +643,9 @@ def _check_holidays(self):
def _check_date_state(self):
if self.env.context.get('leave_skip_state_check'):
return
for holiday in self:
if holiday.state in ['cancel', 'refuse', 'validate1', 'validate']:
raise ValidationError(_("This modification is not allowed in the current state."))
# for holiday in self:
# if holiday.state in ['cancel', 'refuse', 'validate1', 'validate']:
# raise ValidationError(_("This modification is not allowed in the current state."))

def _get_number_of_days(self, date_from, date_to, employee_id):
""" Returns a float equals to the timedelta between two dates given as string."""
Expand Down
4 changes: 3 additions & 1 deletion addons/hr_holidays/models/hr_leave_allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,11 @@ def _compute_from_employee_ids(self):
for allocation in self:
if len(allocation.employee_ids) == 1:
allocation.employee_id = allocation.employee_ids[0]._origin
allocation.multi_employee = False
else:
allocation.employee_id = False
allocation.multi_employee = (len(allocation.employee_ids) > 1)
allocation.multi_employee = True
# allocation.multi_employee = (len(allocation.employee_ids) > 1)

@api.depends('holiday_type')
def _compute_from_holiday_type(self):
Expand Down
17 changes: 10 additions & 7 deletions addons/hr_holidays/views/hr_leave_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,11 @@
<field name="mode">primary</field>
<field name="priority">17</field>
<field name="arch" type="xml">
<xpath expr="//group[@name='col_left']" position="attributes">
<!-- <xpath expr="//group[@name='col_left']" position="attributes">
<attribute name="colspan">5</attribute>
</xpath> -->
<xpath expr="//header" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
Expand Down Expand Up @@ -406,13 +409,13 @@
<field name="priority">16</field>
<field name="arch" type="xml">
<field name="holiday_status_id" position="replace"/>
<div name="title" position="inside">
<!-- <div name="title" position="inside">
<h1 class="d-flex flex-row justify-content-between">
<field name="holiday_status_id" options="{'no_open': True}" context="{'from_manager_leave_form': True ,'employee_id': employee_id, 'default_date_from':date_from, 'default_date_to':date_to}"/>
</h1>
</div>
</div> -->
<field name="employee_id" position="replace"/>
<label id="label_dates" position="before">
<!-- <label id="label_dates" position="before">
<field name="multi_employee" invisible="1" force_save="1"/>
<field name="employee_id" groups="hr_holidays.group_hr_holidays_user" attrs="{
'invisible': ['|', '|', ('holiday_type', '!=', 'employee'), ('state', '!=', 'validate'), ('employee_id', '=', False)]
Expand All @@ -421,11 +424,11 @@
'required': [('holiday_type', '=', 'employee'), ('state', 'in', ('draft', 'cancel', 'refuse'))],
'invisible': ['|', ('holiday_type', '!=', 'employee'), '&amp;', ('state', '=', 'validate'), ('employee_id', '!=', False)],
}" widget="many2many_tags"/>
</label>
</label> -->
<field name="name" position="replace"/>
<field name="user_id" position="before">
<!-- <field name="user_id" position="before">
<field name="name"/>
</field>
</field> -->
<xpath expr="//group[@name='col_right']" position="replace">
<group>
<widget name="hr_leave_stats"/>
Expand Down
23 changes: 12 additions & 11 deletions addons/survey/models/survey_question.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def default_get(self, fields):

# Conditional display
is_conditional = fields.Boolean(
string='Conditional Display', copy=False, help="""If checked, this question will be displayed only
string='Conditional Display', copy=False, help="""If checked, this question will be displayed only
if the specified conditional answer have been selected in a previous question""")
triggering_question_id = fields.Many2one(
'survey.question', string="Triggering Question", copy=False, compute="_compute_triggering_question_id",
Expand Down Expand Up @@ -199,16 +199,17 @@ def _compute_question_ids(self):
def _compute_page_id(self):
"""Will find the page to which this question belongs to by looking inside the corresponding survey"""
for question in self:
if question.is_page:
question.page_id = None
else:
page = None
for q in question.survey_id.question_and_page_ids.sorted():
if q == question:
break
if q.is_page:
page = q
question.page_id = page
# if question.is_page:
# question.page_id = None
# else:
# page = None
# for q in question.survey_id.question_and_page_ids.sorted():
# if q == question:
# break
# if q.is_page:
# page = q
# question.page_id = page
question.page_id = None

@api.depends('question_type', 'validation_email')
def _compute_save_as_email(self):
Expand Down
4 changes: 2 additions & 2 deletions odoo/addons/base/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'views/base_menus.xml',
'views/decimal_precision_views.xml',
'views/res_config_views.xml',
'data/res.country.state.csv',
# 'data/res.country.state.csv',
'views/ir_actions_views.xml',
'views/ir_asset_views.xml',
'views/ir_config_parameter_views.xml',
Expand All @@ -51,7 +51,7 @@
'views/ir_qweb_widget_templates.xml',
'views/ir_module_views.xml',
'data/ir_module_category_data.xml',
'data/ir_module_module.xml',
# 'data/ir_module_module.xml',
'report/ir_module_reports.xml',
'report/ir_module_report_templates.xml',
'wizard/base_module_update_views.xml',
Expand Down
14 changes: 14 additions & 0 deletions odoo/addons/base/data/ir_module_module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
<odoo>
<data>

<record model="ir.module.category" id="base.module_category_services_timesheets">
<field name="name">Helps you manage the timesheets.</field>
<field name="description">Helps you manage the timesheets.</field>
<field name="sequence">13</field>
</record>

<record model="ir.module.category" id="base.module_category_marketing_email_marketing">
<field name="sequence">19</field>
<field name="description">Helps you manage your mass mailing to design
professional emails and reuse templates.</field>
<field name="name">Helps you manage your mass mailing to design
professional emails and reuse templates.</field>
</record>

<record model="ir.module.module" id="base.module_web_studio">
<field name="name">web_studio</field>
<field name="shortdesc">Studio</field>
Expand Down
86 changes: 44 additions & 42 deletions odoo/addons/base/models/ir_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,37 +412,38 @@ class CustomModel(models.Model):
return CustomModel

def _add_manual_models(self):
""" Add extra models to the registry. """
# clean up registry first
for name, Model in list(self.pool.items()):
if Model._custom:
del self.pool.models[name]
# remove the model's name from its parents' _inherit_children
for Parent in Model.__bases__:
if hasattr(Parent, 'pool'):
Parent._inherit_children.discard(name)
# add manual models
cr = self.env.cr
cr.execute('SELECT * FROM ir_model WHERE state=%s', ['manual'])
for model_data in cr.dictfetchall():
model_class = self._instanciate(model_data)
Model = model_class._build_model(self.pool, cr)
if tools.table_kind(cr, Model._table) not in ('r', None):
# not a regular table, so disable schema upgrades
Model._auto = False
cr.execute(
'''
SELECT a.attname
FROM pg_attribute a
JOIN pg_class t
ON a.attrelid = t.oid
AND t.relname = %s
WHERE a.attnum > 0 -- skip system columns
''',
[Model._table]
)
columns = {colinfo[0] for colinfo in cr.fetchall()}
Model._log_access = set(models.LOG_ACCESS_COLUMNS) <= columns
# """ Add extra models to the registry. """
# # clean up registry first
# for name, Model in list(self.pool.items()):
# if Model._custom:
# del self.pool.models[name]
# # remove the model's name from its parents' _inherit_children
# for Parent in Model.__bases__:
# if hasattr(Parent, 'pool'):
# Parent._inherit_children.discard(name)
# # add manual models
# cr = self.env.cr
# cr.execute('SELECT * FROM ir_model WHERE state=%s', ['manual'])
# for model_data in cr.dictfetchall():
# model_class = self._instanciate(model_data)
# Model = model_class._build_model(self.pool, cr)
# if tools.table_kind(cr, Model._table) not in ('r', None):
# # not a regular table, so disable schema upgrades
# Model._auto = False
# cr.execute(
# '''
# SELECT a.attname
# FROM pg_attribute a
# JOIN pg_class t
# ON a.attrelid = t.oid
# AND t.relname = %s
# WHERE a.attnum > 0 -- skip system columns
# ''',
# [Model._table]
# )
# columns = {colinfo[0] for colinfo in cr.fetchall()}
# Model._log_access = set(models.LOG_ACCESS_COLUMNS) <= columns
pass


# retrieve field types defined by the framework only (not extensions)
Expand Down Expand Up @@ -1164,16 +1165,17 @@ def _instanciate(self, field_data):
return fields.Field.by_type[field_data['ttype']](**attrs)

def _add_manual_fields(self, model):
""" Add extra fields on model. """
fields_data = self._get_manual_field_data(model._name)
for name, field_data in fields_data.items():
if name not in model._fields and field_data['state'] == 'manual':
try:
field = self._instanciate(field_data)
if field:
model._add_field(name, field)
except Exception:
_logger.exception("Failed to load field %s.%s: skipped", model._name, field_data['name'])
# """ Add extra fields on model. """
# fields_data = self._get_manual_field_data(model._name)
# for name, field_data in fields_data.items():
# if name not in model._fields and field_data['state'] == 'manual':
# try:
# field = self._instanciate(field_data)
# if field:
# model._add_field(name, field)
# except Exception:
# _logger.exception("Failed to load field %s.%s: skipped", model._name, field_data['name'])
pass


class IrModelSelection(models.Model):
Expand Down Expand Up @@ -1500,7 +1502,7 @@ def _module_data_uninstall(self):
for data in self.sorted(key='id', reverse=True):
name = tools.ustr(data.name)
if data.model.model in self.env:
table = self.env[data.model.model]._table
table = self.env[data.model.model]._table
else:
table = data.model.model.replace('.', '_')
typ = data.type
Expand Down
13 changes: 7 additions & 6 deletions odoo/addons/base/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,12 +463,13 @@ def _read(self, fields):
def _check_company(self):
for user in self:
if user.company_id not in user.company_ids:
raise ValidationError(
_('Company %(company_name)s is not in the allowed companies for user %(user_name)s (%(company_allowed)s).',
company_name=user.company_id.name,
user_name=user.name,
company_allowed=', '.join(user.mapped('company_ids.name')))
)
# raise ValidationError(
# _('Company %(company_name)s is not in the allowed companies for user %(user_name)s (%(company_allowed)s).',
# company_name=user.company_id.name,
# user_name=user.name,
# company_allowed=', '.join(user.mapped('company_ids.name')))
# )
pass

@api.constrains('action_id')
def _check_action_id(self):
Expand Down
Loading