Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cgscop_cotisation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hervé Silvant - CGScop
cgscop_cotisation
Commits
70caae1d
Commit
70caae1d
authored
3 years ago
by
jordan
Browse files
Options
Downloads
Patches
Plain Diff
[update] refactor cotiz to generate 1 invoice per quarter
parent
548aae3c
Branches
Branches containing commit
Tags
v1.0.2
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/scop_cotisation.py
+0
-75
0 additions, 75 deletions
models/scop_cotisation.py
with
0 additions
and
75 deletions
models/scop_cotisation.py
+
0
−
75
View file @
70caae1d
...
@@ -84,81 +84,6 @@ class ScopCotisation(models.AbstractModel):
...
@@ -84,81 +84,6 @@ class ScopCotisation(models.AbstractModel):
# ------------------------------------------------------
# ------------------------------------------------------
# Global functions
# Global functions
# ------------------------------------------------------
# ------------------------------------------------------
def
create_contribution
(
self
,
product
,
partner
,
type_contribution
,
liasse
=
None
,
amount
=
0
,
date
=
False
,
journal_id
=
False
,
account_id
=
False
,
type_invoice
=
'
out_invoice
'
,
is_regul
=
False
,
bordereau
=
False
):
"""
Create invoice from Contribution Base
:param product: product_id
:param partner: partner_id
:param type_contribution: type_contribution (CG, UR, Fédé)
:param liasse: liasse_fiscale_id (reference)
:param amount: contribution amount (float)
:param date: date invoice
:param journal_id: journal
:param account_id: customer_account_id
:param type_invoice: invoice or refund
:param is_regul: used for CG Scop regul
:return: invoice
"""
Invoice
=
self
.
env
[
'
account.invoice
'
]
InvoiceLine
=
self
.
env
[
'
account.invoice.line
'
]
domain
=
[
(
'
partner_id
'
,
'
=
'
,
partner
.
id
),
(
'
year
'
,
'
=
'
,
self
.
year
),
(
'
type_contribution_id
'
,
'
=
'
,
type_contribution
),
]
if
bordereau
:
domain
.
append
((
'
bordereau_id
'
,
'
=
'
,
bordereau
.
id
))
exisiting_invoice
=
Invoice
.
search
(
domain
)
if
not
exisiting_invoice
or
is_regul
:
date_invoice
=
date
if
date
else
self
.
date_cotisation
journal_id
=
self
.
company_id
.
contribution_journal_id
\
if
not
journal_id
else
journal_id
account_id
=
partner
.
property_account_receivable_id
\
if
not
account_id
else
account_id
member_invoice
=
Invoice
.
create
({
'
partner_id
'
:
partner
.
id
,
'
liasse_fiscale_id
'
:
liasse
.
id
,
'
type
'
:
type_invoice
,
'
year
'
:
self
.
year
,
'
is_contribution
'
:
True
,
'
type_contribution_id
'
:
type_contribution
,
'
journal_id
'
:
journal_id
.
id
,
'
state
'
:
'
draft
'
,
'
account_id
'
:
account_id
.
id
,
'
payment_term_id
'
:
self
.
payment_term_id
.
id
,
'
payment_mode_id
'
:
partner
.
customer_payment_mode_id
.
id
,
'
date_invoice
'
:
date_invoice
,
})
else
:
member_invoice
=
exisiting_invoice
# Création de la ligne CG Scop
exisiting_invoice_line_ids
=
InvoiceLine
.
search
([
(
'
invoice_id
'
,
'
=
'
,
member_invoice
.
id
),
(
'
product_id
'
,
'
=
'
,
product
.
id
)
])
if
not
exisiting_invoice_line_ids
or
is_regul
:
InvoiceLine
.
create
({
'
invoice_id
'
:
member_invoice
.
id
,
'
product_id
'
:
product
.
id
,
'
account_id
'
:
product
.
property_account_income_id
.
id
,
'
invoice_line_tax_ids
'
:
[(
6
,
0
,
product
.
taxes_id
.
ids
)],
'
name
'
:
product
.
name
,
'
price_unit
'
:
amount
})
else
:
exisiting_invoice_line_ids
[
0
].
write
({
'
price_unit
'
:
amount
})
return
member_invoice
@api.multi
@api.multi
def
get_members
(
self
):
def
get_members
(
self
):
self
.
ensure_one
()
self
.
ensure_one
()
...
...
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