Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
rex wu
odoo
Commits
bbccbc70
Commit
bbccbc70
authored
1 year ago
by
RexWu
Browse files
Options
Download
Email Patches
Plain Diff
fixed(mrp): fixed message sender bug
parent
4f3a292b
15.0
deploy
feat-bom2topurchase
feat-cost_chart
feat-requisition
fix-quotation_xlsx_field
project
revert-b4974a92
1 merge request
!39
feat(deploy): remove all files that are not needed in the deployment stage and...
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docker-compose.yml
+1
-1
docker-compose.yml
extra-addons/kci-mrp/models/mrp_bom.py
+38
-38
extra-addons/kci-mrp/models/mrp_bom.py
with
39 additions
and
39 deletions
+39
-39
docker-compose.yml
+
1
-
1
View file @
bbccbc70
...
...
@@ -10,7 +10,7 @@ services:
volumes
:
-
./odoo-web-data:/var/lib/odoo
-
./config:/etc/odoo
-
./extra-addons:/mnt/extra-addons
-
./extra-addons:/mnt/extra-addons
db
:
image
:
postgres:13
...
...
This diff is collapsed.
Click to expand it.
extra-addons/kci-mrp/models/mrp_bom.py
+
38
-
38
View file @
bbccbc70
...
...
@@ -25,21 +25,21 @@ class Bom(models.Model):
@
api
.
onchange
(
'user_id'
)
def
_assign_engineer
(
self
):
notification_ids
=
[((
0
,
0
,
{
'res_partner_id'
:
self
.
env
.
user
.
partner_id
.
id
,
'notification_type'
:
'inbox'
}))]
#
notification_ids = [((0, 0, {
#
'res_partner_id': self.env.user.partner_id.id,
#
'notification_type': 'inbox'}))]
url
=
f
'/web#id=
{
self
.
id
}
&view_type=form&model=mrp.bom'
bom_name
=
self
.
product_tmpl_id
.
name
user_id
=
self
.
env
.
user
.
id
#
user_id = self.env.user.id
message
=
f
"已被指派為 BOM <a href='
{
self
.
env
[
'ir.config_parameter'
].
sudo
().
get_param
(
'web.base.url'
)
}{
url
}
'>
{
bom_name
}
</a> 工程師"
self
.
user_id
.
partner_id
.
message_post
(
author_id
=
user_id
,
body
=
message
+
"請查收"
,
message_type
=
'notification'
,
subtype_xmlid
=
"mail.mt_comment"
,
notification_ids
=
notification_ids
,
partner_ids
=
[
self
.
env
.
user
.
id
],
notify_by_email
=
False
,
)
#
self.user_id.partner_id.message_post(author_id=user_id,
#
body=message + "請查收",
#
message_type='notification',
#
subtype_xmlid="mail.mt_comment",
#
notification_ids=notification_ids,
#
partner_ids=[self.env.user.id],
#
notify_by_email=False,
#
)
email_values
=
{
'email_to'
:
self
.
user_id
.
partner_id
.
email
,
'email_cc'
:
self
.
env
.
user
.
partner_id
.
email
,
...
...
@@ -96,21 +96,21 @@ class Bom(models.Model):
)
def
action_send_quotation_notification
(
self
,
quotation_name
,
target_partner_id
,
url
):
notification_ids
=
[((
0
,
0
,
{
'res_partner_id'
:
self
.
env
.
user
.
partner_id
.
id
,
'notification_type'
:
'inbox'
}))]
user_id
=
self
.
env
.
user
.
id
#
notification_ids = [((0, 0, {
#
'res_partner_id': self.env.user.partner_id.id,
#
'notification_type': 'inbox'}))]
#
user_id = self.env.user.id
message
=
f
"已建立報價單 <a href='
{
self
.
env
[
'ir.config_parameter'
].
sudo
().
get_param
(
'web.base.url'
)
}{
url
}
'>
{
quotation_name
}
</a> "
target_user
=
self
.
env
[
'res.partner'
].
browse
(
target_partner_id
)
target_user
.
message_post
(
author_id
=
user_id
,
body
=
message
+
"請查收"
,
message_type
=
'notification'
,
subtype_xmlid
=
"mail.mt_comment"
,
notification_ids
=
notification_ids
,
partner_ids
=
[
self
.
env
.
user
.
id
],
notify_by_email
=
False
,
)
self
.
send_notification_to_self
(
message
)
#
target_user.message_post(author_id=user_id,
#
body=message + "請查收",
#
message_type='notification',
#
subtype_xmlid="mail.mt_comment",
#
notification_ids=notification_ids,
#
partner_ids=[self.env.user.id],
#
notify_by_email=False,
#
)
#
self.send_notification_to_self(message)
email_values
=
{
'email_to'
:
target_user
,
'email_cc'
:
self
.
env
.
user
.
partner_id
.
email
,
...
...
@@ -122,21 +122,21 @@ class Bom(models.Model):
mail_template
.
send_mail
(
self
.
id
,
force_send
=
True
,
email_values
=
email_values
)
def
action_send_bom_notification
(
self
,
bom_name
,
is_create
,
url
):
notification_ids
=
[((
0
,
0
,
{
'res_partner_id'
:
self
.
env
.
user
.
partner_id
.
id
,
'notification_type'
:
'inbox'
}))]
user_id
=
self
.
env
.
user
.
id
#
notification_ids = [((0, 0, {
#
'res_partner_id': self.env.user.partner_id.id,
#
'notification_type': 'inbox'}))]
#
user_id = self.env.user.id
message
=
f
"已
{
'建立'
if
is_create
else
'更新'
}
BOM <a href='
{
self
.
env
[
'ir.config_parameter'
].
sudo
().
get_param
(
'web.base.url'
)
}{
url
}
'>
{
bom_name
}
</a> "
group
=
self
.
env
[
'mail.channel'
].
search
([(
'group_public_id'
,
'='
,
self
.
env
.
ref
(
'sales.kci_sales_manager_group'
if
is_create
else
'kci-mrp.kci_mrp_manager_group'
).
id
)])
group
.
message_post
(
author_id
=
user_id
,
body
=
message
+
"請查收"
,
message_type
=
'notification'
,
subtype_xmlid
=
"mail.mt_comment"
,
notification_ids
=
notification_ids
,
partner_ids
=
[
self
.
env
.
user
.
id
],
notify_by_email
=
False
,
)
self
.
send_notification_to_self
(
message
)
#
group.message_post(author_id=user_id,
#
body=message + "請查收",
#
message_type='notification',
#
subtype_xmlid="mail.mt_comment",
#
notification_ids=notification_ids,
#
partner_ids=[self.env.user.id],
#
notify_by_email=False,
#
)
#
self.send_notification_to_self(message)
email_to
=
''
for
partner
in
group
.
channel_partner_ids
:
email_to
+=
f
'
{
partner
.
email
}
, '
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help