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
3bc48c45
Commit
3bc48c45
authored
1 year ago
by
rex wu
Browse files
Options
Download
Plain Diff
Merge branch 'project' into '15.0'
fixed(bom): bom2 email to purchase See merge request
!70
parents
f3765fb2
3453c9d7
15.0
deploy
feat-bom2topurchase
feat-requisition
2 merge requests
!71
15.0
,
!70
fixed(bom): bom2 email to purchase
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
extra-addons/kci-mrp/models/mrp_bom.py
+14
-2
extra-addons/kci-mrp/models/mrp_bom.py
extra-addons/kci-mrp/views/mrp_bom_views.xml
+1
-0
extra-addons/kci-mrp/views/mrp_bom_views.xml
with
15 additions
and
2 deletions
+15
-2
extra-addons/kci-mrp/models/mrp_bom.py
+
14
-
2
View file @
3bc48c45
...
...
@@ -65,6 +65,12 @@ class Bom(models.Model):
is_create
=
True
,
url
=
f
'/web#id=
{
new_bom
.
id
}
&view_type=form&model=mrp.bom'
)
def
action_bom2_for_purchase
(
self
):
self
.
action_send_bom_notification
(
bom_name
=
self
.
product_tmpl_id
.
name
,
is_create
=
False
,
is_purchase
=
True
,
url
=
f
'/web#id=
{
self
.
id
}
&view_type=form&model=mrp.bom'
)
def
action_create_quotation
(
self
):
quotation
=
self
.
env
[
'sale.order'
].
create
({
'name'
:
self
.
product_tmpl_id
.
name
,
...
...
@@ -122,13 +128,19 @@ class Bom(models.Model):
mail_template
=
self
.
env
.
ref
(
'kci-mrp.bom_email_template'
)
mail_template
.
send_mail
(
self
.
id
,
force_send
=
True
,
email_values
=
email_values
)
def
action_send_bom_notification
(
self
,
bom_name
,
is_create
,
url
):
def
action_send_bom_notification
(
self
,
bom_name
,
is_create
,
url
,
is_purchase
=
False
):
# 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
)])
if
is_create
:
group_public
=
self
.
env
.
ref
(
'sales.kci_sales_manager_group'
)
elif
is_purchase
:
group_public
=
self
.
env
.
ref
(
'kci-purchase.kci_purchase_group'
)
else
:
group_public
=
self
.
env
.
ref
(
'kci-mrp.kci_mrp_manager_group'
)
group
=
self
.
env
[
'mail.channel'
].
search
([(
'group_public_id'
,
'='
,
group_public
.
id
)])
# group.message_post(author_id=user_id,
# body=message + "請查收",
# message_type='notification',
...
...
This diff is collapsed.
Click to expand it.
extra-addons/kci-mrp/views/mrp_bom_views.xml
+
1
-
0
View file @
3bc48c45
...
...
@@ -14,6 +14,7 @@
<xpath
expr=
"//div[@name='button_box']"
position=
"inside"
>
<button
name=
"action_bom1_to_quotation"
action=
"action_bom1_to_quotation"
string=
"產生報價 BOM 表"
type=
"object"
icon=
"fa-file"
class=
"oe_stat_button"
attrs=
"{'invisible': [('status', '!=', 'internal')]}"
/>
<button
name=
"action_create_quotation"
action=
"action_create_quotation"
string=
"產生報價單"
type=
"object"
icon=
"fa-dollar"
class=
"oe_stat_button"
attrs=
"{'invisible': [('status', '!=', 'quotation')]}"
/>
<button
name=
"action_bom2_for_purchase"
action=
"action_bom2_for_purchase"
string=
"通知採購"
type=
"object"
icon=
"fa-file"
class=
"oe_stat_button"
attrs=
"{'invisible': [('status', '!=', 'external')]}"
/>
</xpath>
<xpath
expr=
"//field[@name='product_id']"
position=
"after"
>
<field
name=
"project_id"
/>
...
...
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