Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
31a01ea7
Commit
31a01ea7
authored
10 years ago
by
Alexis de Lattre
Committed by
Josse Colpaert
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fixes #3851 Create invoice from picking copies some parameters from the order to the invoice
parent
8eae018b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
addons/purchase/stock.py
+10
-0
10 additions, 0 deletions
addons/purchase/stock.py
addons/sale_stock/sale_stock.py
+12
-0
12 additions, 0 deletions
addons/sale_stock/sale_stock.py
addons/stock_account/stock.py
+4
-4
4 additions, 4 deletions
addons/stock_account/stock.py
with
26 additions
and
4 deletions
addons/purchase/stock.py
+
10
−
0
View file @
31a01ea7
...
@@ -158,6 +158,16 @@ class stock_picking(osv.osv):
...
@@ -158,6 +158,16 @@ class stock_picking(osv.osv):
invoice_line_obj
.
write
(
cr
,
uid
,
inv_lines
,
{
'
invoice_id
'
:
invoice_id
},
context
=
context
)
invoice_line_obj
.
write
(
cr
,
uid
,
inv_lines
,
{
'
invoice_id
'
:
invoice_id
},
context
=
context
)
return
invoice_id
return
invoice_id
def
_get_invoice_vals
(
self
,
cr
,
uid
,
key
,
inv_type
,
journal_id
,
move
,
context
=
None
):
inv_vals
=
super
(
stock_picking
,
self
).
_get_invoice_vals
(
cr
,
uid
,
key
,
inv_type
,
journal_id
,
move
,
context
=
context
)
if
move
.
purchase_line_id
and
move
.
purchase_line_id
.
order_id
:
purchase
=
move
.
purchase_line_id
.
order_id
inv_vals
.
update
({
'
fiscal_position
'
:
purchase
.
fiscal_position
.
id
,
'
payment_term
'
:
purchase
.
payment_term_id
.
id
,
})
return
inv_vals
class
stock_warehouse
(
osv
.
osv
):
class
stock_warehouse
(
osv
.
osv
):
_inherit
=
'
stock.warehouse
'
_inherit
=
'
stock.warehouse
'
...
...
This diff is collapsed.
Click to expand it.
addons/sale_stock/sale_stock.py
+
12
−
0
View file @
31a01ea7
...
@@ -444,3 +444,15 @@ class stock_picking(osv.osv):
...
@@ -444,3 +444,15 @@ class stock_picking(osv.osv):
created_lines
=
sale_line_obj
.
invoice_line_create
(
cr
,
uid
,
sale_line_ids
,
context
=
context
)
created_lines
=
sale_line_obj
.
invoice_line_create
(
cr
,
uid
,
sale_line_ids
,
context
=
context
)
invoice_line_obj
.
write
(
cr
,
uid
,
created_lines
,
{
'
invoice_id
'
:
invoice_id
},
context
=
context
)
invoice_line_obj
.
write
(
cr
,
uid
,
created_lines
,
{
'
invoice_id
'
:
invoice_id
},
context
=
context
)
return
invoice_id
return
invoice_id
def
_get_invoice_vals
(
self
,
cr
,
uid
,
key
,
inv_type
,
journal_id
,
move
,
context
=
None
):
inv_vals
=
super
(
stock_picking
,
self
).
_get_invoice_vals
(
cr
,
uid
,
key
,
inv_type
,
journal_id
,
move
,
context
=
context
)
sale
=
move
.
picking_id
.
sale_id
if
sale
:
inv_vals
.
update
({
'
fiscal_position
'
:
sale
.
fiscal_position
.
id
,
'
payment_term
'
:
sale
.
payment_term
.
id
,
'
user_id
'
:
sale
.
user_id
.
id
,
'
name
'
:
sale
.
client_order_ref
or
''
,
})
return
inv_vals
This diff is collapsed.
Click to expand it.
addons/stock_account/stock.py
+
4
−
4
View file @
31a01ea7
...
@@ -250,7 +250,7 @@ class stock_picking(osv.osv):
...
@@ -250,7 +250,7 @@ class stock_picking(osv.osv):
invoices
+=
self
.
_invoice_create_line
(
cr
,
uid
,
moves
,
journal_id
,
type
,
context
=
context
)
invoices
+=
self
.
_invoice_create_line
(
cr
,
uid
,
moves
,
journal_id
,
type
,
context
=
context
)
return
invoices
return
invoices
def
_get_invoice_vals
(
self
,
cr
,
uid
,
key
,
inv_type
,
journal_id
,
origin
,
context
=
None
):
def
_get_invoice_vals
(
self
,
cr
,
uid
,
key
,
inv_type
,
journal_id
,
move
,
context
=
None
):
if
context
is
None
:
if
context
is
None
:
context
=
{}
context
=
{}
partner
,
currency_id
,
company_id
,
user_id
=
key
partner
,
currency_id
,
company_id
,
user_id
=
key
...
@@ -261,7 +261,7 @@ class stock_picking(osv.osv):
...
@@ -261,7 +261,7 @@ class stock_picking(osv.osv):
account_id
=
partner
.
property_account_payable
.
id
account_id
=
partner
.
property_account_payable
.
id
payment_term
=
partner
.
property_supplier_payment_term
.
id
or
False
payment_term
=
partner
.
property_supplier_payment_term
.
id
or
False
return
{
return
{
'
origin
'
:
origin
,
'
origin
'
:
move
.
picking_id
.
name
,
'
date_invoice
'
:
context
.
get
(
'
date_inv
'
,
False
),
'
date_invoice
'
:
context
.
get
(
'
date_inv
'
,
False
),
'
user_id
'
:
user_id
,
'
user_id
'
:
user_id
,
'
partner_id
'
:
partner
.
id
,
'
partner_id
'
:
partner
.
id
,
...
@@ -287,7 +287,7 @@ class stock_picking(osv.osv):
...
@@ -287,7 +287,7 @@ class stock_picking(osv.osv):
if
key
not
in
invoices
:
if
key
not
in
invoices
:
# Get account and payment terms
# Get account and payment terms
invoice_vals
=
self
.
_get_invoice_vals
(
cr
,
uid
,
key
,
inv_type
,
journal_id
,
origin
,
context
=
context
)
invoice_vals
=
self
.
_get_invoice_vals
(
cr
,
uid
,
key
,
inv_type
,
journal_id
,
move
,
context
=
context
)
invoice_id
=
self
.
_create_invoice_from_picking
(
cr
,
uid
,
move
.
picking_id
,
invoice_vals
,
context
=
context
)
invoice_id
=
self
.
_create_invoice_from_picking
(
cr
,
uid
,
move
.
picking_id
,
invoice_vals
,
context
=
context
)
invoices
[
key
]
=
invoice_id
invoices
[
key
]
=
invoice_id
...
@@ -309,4 +309,4 @@ class stock_picking(osv.osv):
...
@@ -309,4 +309,4 @@ class stock_picking(osv.osv):
res
.
update
({
'
invoice_state
'
:
op
.
picking_id
.
invoice_state
})
res
.
update
({
'
invoice_state
'
:
op
.
picking_id
.
invoice_state
})
if
op
.
linked_move_operation_ids
:
if
op
.
linked_move_operation_ids
:
res
.
update
({
'
price_unit
'
:
op
.
linked_move_operation_ids
[
-
1
].
move_id
.
price_unit
})
res
.
update
({
'
price_unit
'
:
op
.
linked_move_operation_ids
[
-
1
].
move_id
.
price_unit
})
return
res
return
res
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment