mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2026-08-17 16:54:42 -05:00
[PATCH] Upstream patch - 11032024
This commit is contained in:
@@ -5276,9 +5276,7 @@ class AccountMoveLine(models.Model):
|
||||
elif context.get('initial_bal'):
|
||||
domain += [(date_field, '<', context['date_from'])]
|
||||
else:
|
||||
# domain += [(date_field, '>=', context['date_from'])]
|
||||
domain += ['|', (date_field, '>=', context['date_from']),
|
||||
('account_id.user_type_id.include_initial_balance', '=', True)]
|
||||
domain += [(date_field, '>=', context['date_from'])]
|
||||
|
||||
if context.get('journal_ids'):
|
||||
domain += [('journal_id', 'in', context['journal_ids'])]
|
||||
|
||||
@@ -10,8 +10,8 @@ class AccountCommonReport(models.TransientModel):
|
||||
|
||||
company_id = fields.Many2one('res.company', string='Company', required=True, default=lambda self: self.env.company)
|
||||
journal_ids = fields.Many2many('account.journal', string='Journals', required=True, default=lambda self: self.env['account.journal'].search([('company_id', '=', self.company_id.id)]))
|
||||
date_from = fields.Date(string='Start Date', required=True)
|
||||
date_to = fields.Date(string='End Date', required=True)
|
||||
date_from = fields.Date(string='Start Date')
|
||||
date_to = fields.Date(string='End Date')
|
||||
target_move = fields.Selection([('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries'),
|
||||
], string='Target Moves', required=True, default='posted')
|
||||
|
||||
@@ -810,7 +810,7 @@ class Slide(models.Model):
|
||||
""" If we receive a duration (YT video), we use it to determine the slide duration.
|
||||
The received duration is under a special format (e.g: PT1M21S15, meaning 1h 21m 15s). """
|
||||
|
||||
key = self.env['website'].get_current_website().website_slide_google_app_key
|
||||
key = self.env['website'].get_current_website().sudo().website_slide_google_app_key
|
||||
fetch_res = self._fetch_data('https://www.googleapis.com/youtube/v3/videos', {'id': document_id, 'key': key, 'part': 'snippet,contentDetails', 'fields': 'items(id,snippet,contentDetails)'}, 'json')
|
||||
if fetch_res.get('error'):
|
||||
return {'error': self._extract_google_error_message(fetch_res.get('error'))}
|
||||
@@ -887,7 +887,7 @@ class Slide(models.Model):
|
||||
if access_token:
|
||||
params['access_token'] = access_token
|
||||
if not params.get('access_token'):
|
||||
params['key'] = self.env['website'].get_current_website().website_slide_google_app_key
|
||||
params['key'] = self.env['website'].get_current_website().sudo().website_slide_google_app_key
|
||||
|
||||
fetch_res = self._fetch_data('https://www.googleapis.com/drive/v2/files/%s' % document_id, params, "json")
|
||||
if fetch_res.get('error'):
|
||||
|
||||
@@ -8,7 +8,7 @@ from flectra.addons.http_routing.models.ir_http import url_for
|
||||
class Website(models.Model):
|
||||
_inherit = "website"
|
||||
|
||||
website_slide_google_app_key = fields.Char('Google Doc Key')
|
||||
website_slide_google_app_key = fields.Char('Google Doc Key', groups='base.group_system')
|
||||
|
||||
def get_suggested_controllers(self):
|
||||
suggested_controllers = super(Website, self).get_suggested_controllers()
|
||||
|
||||
@@ -14,8 +14,8 @@ class Twitter(http.Controller):
|
||||
|
||||
@http.route(['/website_twitter/get_favorites'], type='json', auth="public", website=True)
|
||||
def get_tweets(self, limit=20):
|
||||
key = request.website.twitter_api_key
|
||||
secret = request.website.twitter_api_secret
|
||||
key = request.website.sudo().twitter_api_key
|
||||
secret = request.website.sudo().twitter_api_secret
|
||||
screen_name = request.website.twitter_screen_name
|
||||
debug = request.env['res.users'].has_group('website.group_website_publisher')
|
||||
if not key or not secret:
|
||||
|
||||
@@ -19,8 +19,8 @@ _logger = logging.getLogger(__name__)
|
||||
class WebsiteTwitter(models.Model):
|
||||
_inherit = 'website'
|
||||
|
||||
twitter_api_key = fields.Char(string='Twitter API key', help='Twitter API Key')
|
||||
twitter_api_secret = fields.Char(string='Twitter API secret', help='Twitter API Secret')
|
||||
twitter_api_key = fields.Char(string='Twitter API key', help='Twitter API Key', groups='base.group_system')
|
||||
twitter_api_secret = fields.Char(string='Twitter API secret', help='Twitter API Secret', groups='base.group_system')
|
||||
twitter_screen_name = fields.Char(string='Get favorites from this screen name')
|
||||
|
||||
@api.model
|
||||
@@ -49,7 +49,7 @@ class WebsiteTwitter(models.Model):
|
||||
WebsiteTweets = self.env['website.twitter.tweet']
|
||||
tweet_ids = []
|
||||
for website in self:
|
||||
if not all((website.twitter_api_key, website.twitter_api_secret, website.twitter_screen_name)):
|
||||
if not all((website.sudo().twitter_api_key, website.sudo().twitter_api_secret, website.twitter_screen_name)):
|
||||
_logger.debug("Skip fetching favorite tweets for unconfigured website %s", website)
|
||||
continue
|
||||
params = {'screen_name': website.twitter_screen_name}
|
||||
@@ -80,7 +80,7 @@ class WebsiteTwitter(models.Model):
|
||||
r = requests.post(
|
||||
REQUEST_TOKEN_URL,
|
||||
data={'grant_type': 'client_credentials',},
|
||||
auth=(website.twitter_api_key, website.twitter_api_secret),
|
||||
auth=(website.sudo().twitter_api_key, website.sudo().twitter_api_secret),
|
||||
timeout=URLOPEN_TIMEOUT,
|
||||
)
|
||||
r.raise_for_status()
|
||||
|
||||
Reference in New Issue
Block a user