odoo-addon-sale-commission-product-criteria-fiscal-position-type 16.0.1.0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/README.rst +114 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/__init__.py +3 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/__manifest__.py +21 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/i18n/es.po +47 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/i18n/sale_commission_product_criteria_fiscal_position_type.pot +41 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/models/__init__.py +6 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/models/account_invoice_line_agent.py +20 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/models/commission_item.py +15 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/models/commission_line_mixin.py +35 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/models/sale_order_line_agent.py +22 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/readme/CONTRIBUTORS.md +4 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/readme/DESCRIPTION.md +2 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/readme/USAGE.md +8 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/static/description/icon.png +0 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/static/description/icon.svg +79 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/static/description/index.html +458 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/tests/__init__.py +3 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/tests/test_sale_commission_product_criteria_fiscal_position_type.py +152 -0
- odoo/addons/sale_commission_product_criteria_fiscal_position_type/views/commission_item_views.xml +54 -0
- odoo_addon_sale_commission_product_criteria_fiscal_position_type-16.0.1.0.0.2.dist-info/METADATA +131 -0
- odoo_addon_sale_commission_product_criteria_fiscal_position_type-16.0.1.0.0.2.dist-info/RECORD +23 -0
- odoo_addon_sale_commission_product_criteria_fiscal_position_type-16.0.1.0.0.2.dist-info/WHEEL +5 -0
- odoo_addon_sale_commission_product_criteria_fiscal_position_type-16.0.1.0.0.2.dist-info/top_level.txt +1 -0
odoo/addons/sale_commission_product_criteria_fiscal_position_type/static/description/index.html
ADDED
@@ -0,0 +1,458 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
|
+
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
|
6
|
+
<title>README.rst</title>
|
7
|
+
<style type="text/css">
|
8
|
+
|
9
|
+
/*
|
10
|
+
:Author: David Goodger (goodger@python.org)
|
11
|
+
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
|
12
|
+
:Copyright: This stylesheet has been placed in the public domain.
|
13
|
+
|
14
|
+
Default cascading style sheet for the HTML output of Docutils.
|
15
|
+
Despite the name, some widely supported CSS2 features are used.
|
16
|
+
|
17
|
+
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
18
|
+
customize this style sheet.
|
19
|
+
*/
|
20
|
+
|
21
|
+
/* used to remove borders from tables and images */
|
22
|
+
.borderless, table.borderless td, table.borderless th {
|
23
|
+
border: 0 }
|
24
|
+
|
25
|
+
table.borderless td, table.borderless th {
|
26
|
+
/* Override padding for "table.docutils td" with "! important".
|
27
|
+
The right padding separates the table cells. */
|
28
|
+
padding: 0 0.5em 0 0 ! important }
|
29
|
+
|
30
|
+
.first {
|
31
|
+
/* Override more specific margin styles with "! important". */
|
32
|
+
margin-top: 0 ! important }
|
33
|
+
|
34
|
+
.last, .with-subtitle {
|
35
|
+
margin-bottom: 0 ! important }
|
36
|
+
|
37
|
+
.hidden {
|
38
|
+
display: none }
|
39
|
+
|
40
|
+
.subscript {
|
41
|
+
vertical-align: sub;
|
42
|
+
font-size: smaller }
|
43
|
+
|
44
|
+
.superscript {
|
45
|
+
vertical-align: super;
|
46
|
+
font-size: smaller }
|
47
|
+
|
48
|
+
a.toc-backref {
|
49
|
+
text-decoration: none ;
|
50
|
+
color: black }
|
51
|
+
|
52
|
+
blockquote.epigraph {
|
53
|
+
margin: 2em 5em ; }
|
54
|
+
|
55
|
+
dl.docutils dd {
|
56
|
+
margin-bottom: 0.5em }
|
57
|
+
|
58
|
+
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
59
|
+
overflow: hidden;
|
60
|
+
}
|
61
|
+
|
62
|
+
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
63
|
+
dl.docutils dt {
|
64
|
+
font-weight: bold }
|
65
|
+
*/
|
66
|
+
|
67
|
+
div.abstract {
|
68
|
+
margin: 2em 5em }
|
69
|
+
|
70
|
+
div.abstract p.topic-title {
|
71
|
+
font-weight: bold ;
|
72
|
+
text-align: center }
|
73
|
+
|
74
|
+
div.admonition, div.attention, div.caution, div.danger, div.error,
|
75
|
+
div.hint, div.important, div.note, div.tip, div.warning {
|
76
|
+
margin: 2em ;
|
77
|
+
border: medium outset ;
|
78
|
+
padding: 1em }
|
79
|
+
|
80
|
+
div.admonition p.admonition-title, div.hint p.admonition-title,
|
81
|
+
div.important p.admonition-title, div.note p.admonition-title,
|
82
|
+
div.tip p.admonition-title {
|
83
|
+
font-weight: bold ;
|
84
|
+
font-family: sans-serif }
|
85
|
+
|
86
|
+
div.attention p.admonition-title, div.caution p.admonition-title,
|
87
|
+
div.danger p.admonition-title, div.error p.admonition-title,
|
88
|
+
div.warning p.admonition-title, .code .error {
|
89
|
+
color: red ;
|
90
|
+
font-weight: bold ;
|
91
|
+
font-family: sans-serif }
|
92
|
+
|
93
|
+
/* Uncomment (and remove this text!) to get reduced vertical space in
|
94
|
+
compound paragraphs.
|
95
|
+
div.compound .compound-first, div.compound .compound-middle {
|
96
|
+
margin-bottom: 0.5em }
|
97
|
+
|
98
|
+
div.compound .compound-last, div.compound .compound-middle {
|
99
|
+
margin-top: 0.5em }
|
100
|
+
*/
|
101
|
+
|
102
|
+
div.dedication {
|
103
|
+
margin: 2em 5em ;
|
104
|
+
text-align: center ;
|
105
|
+
font-style: italic }
|
106
|
+
|
107
|
+
div.dedication p.topic-title {
|
108
|
+
font-weight: bold ;
|
109
|
+
font-style: normal }
|
110
|
+
|
111
|
+
div.figure {
|
112
|
+
margin-left: 2em ;
|
113
|
+
margin-right: 2em }
|
114
|
+
|
115
|
+
div.footer, div.header {
|
116
|
+
clear: both;
|
117
|
+
font-size: smaller }
|
118
|
+
|
119
|
+
div.line-block {
|
120
|
+
display: block ;
|
121
|
+
margin-top: 1em ;
|
122
|
+
margin-bottom: 1em }
|
123
|
+
|
124
|
+
div.line-block div.line-block {
|
125
|
+
margin-top: 0 ;
|
126
|
+
margin-bottom: 0 ;
|
127
|
+
margin-left: 1.5em }
|
128
|
+
|
129
|
+
div.sidebar {
|
130
|
+
margin: 0 0 0.5em 1em ;
|
131
|
+
border: medium outset ;
|
132
|
+
padding: 1em ;
|
133
|
+
background-color: #ffffee ;
|
134
|
+
width: 40% ;
|
135
|
+
float: right ;
|
136
|
+
clear: right }
|
137
|
+
|
138
|
+
div.sidebar p.rubric {
|
139
|
+
font-family: sans-serif ;
|
140
|
+
font-size: medium }
|
141
|
+
|
142
|
+
div.system-messages {
|
143
|
+
margin: 5em }
|
144
|
+
|
145
|
+
div.system-messages h1 {
|
146
|
+
color: red }
|
147
|
+
|
148
|
+
div.system-message {
|
149
|
+
border: medium outset ;
|
150
|
+
padding: 1em }
|
151
|
+
|
152
|
+
div.system-message p.system-message-title {
|
153
|
+
color: red ;
|
154
|
+
font-weight: bold }
|
155
|
+
|
156
|
+
div.topic {
|
157
|
+
margin: 2em }
|
158
|
+
|
159
|
+
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
160
|
+
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
161
|
+
margin-top: 0.4em }
|
162
|
+
|
163
|
+
h1.title {
|
164
|
+
text-align: center }
|
165
|
+
|
166
|
+
h2.subtitle {
|
167
|
+
text-align: center }
|
168
|
+
|
169
|
+
hr.docutils {
|
170
|
+
width: 75% }
|
171
|
+
|
172
|
+
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
173
|
+
clear: left ;
|
174
|
+
float: left ;
|
175
|
+
margin-right: 1em }
|
176
|
+
|
177
|
+
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
178
|
+
clear: right ;
|
179
|
+
float: right ;
|
180
|
+
margin-left: 1em }
|
181
|
+
|
182
|
+
img.align-center, .figure.align-center, object.align-center {
|
183
|
+
display: block;
|
184
|
+
margin-left: auto;
|
185
|
+
margin-right: auto;
|
186
|
+
}
|
187
|
+
|
188
|
+
table.align-center {
|
189
|
+
margin-left: auto;
|
190
|
+
margin-right: auto;
|
191
|
+
}
|
192
|
+
|
193
|
+
.align-left {
|
194
|
+
text-align: left }
|
195
|
+
|
196
|
+
.align-center {
|
197
|
+
clear: both ;
|
198
|
+
text-align: center }
|
199
|
+
|
200
|
+
.align-right {
|
201
|
+
text-align: right }
|
202
|
+
|
203
|
+
/* reset inner alignment in figures */
|
204
|
+
div.align-right {
|
205
|
+
text-align: inherit }
|
206
|
+
|
207
|
+
/* div.align-center * { */
|
208
|
+
/* text-align: left } */
|
209
|
+
|
210
|
+
.align-top {
|
211
|
+
vertical-align: top }
|
212
|
+
|
213
|
+
.align-middle {
|
214
|
+
vertical-align: middle }
|
215
|
+
|
216
|
+
.align-bottom {
|
217
|
+
vertical-align: bottom }
|
218
|
+
|
219
|
+
ol.simple, ul.simple {
|
220
|
+
margin-bottom: 1em }
|
221
|
+
|
222
|
+
ol.arabic {
|
223
|
+
list-style: decimal }
|
224
|
+
|
225
|
+
ol.loweralpha {
|
226
|
+
list-style: lower-alpha }
|
227
|
+
|
228
|
+
ol.upperalpha {
|
229
|
+
list-style: upper-alpha }
|
230
|
+
|
231
|
+
ol.lowerroman {
|
232
|
+
list-style: lower-roman }
|
233
|
+
|
234
|
+
ol.upperroman {
|
235
|
+
list-style: upper-roman }
|
236
|
+
|
237
|
+
p.attribution {
|
238
|
+
text-align: right ;
|
239
|
+
margin-left: 50% }
|
240
|
+
|
241
|
+
p.caption {
|
242
|
+
font-style: italic }
|
243
|
+
|
244
|
+
p.credits {
|
245
|
+
font-style: italic ;
|
246
|
+
font-size: smaller }
|
247
|
+
|
248
|
+
p.label {
|
249
|
+
white-space: nowrap }
|
250
|
+
|
251
|
+
p.rubric {
|
252
|
+
font-weight: bold ;
|
253
|
+
font-size: larger ;
|
254
|
+
color: maroon ;
|
255
|
+
text-align: center }
|
256
|
+
|
257
|
+
p.sidebar-title {
|
258
|
+
font-family: sans-serif ;
|
259
|
+
font-weight: bold ;
|
260
|
+
font-size: larger }
|
261
|
+
|
262
|
+
p.sidebar-subtitle {
|
263
|
+
font-family: sans-serif ;
|
264
|
+
font-weight: bold }
|
265
|
+
|
266
|
+
p.topic-title {
|
267
|
+
font-weight: bold }
|
268
|
+
|
269
|
+
pre.address {
|
270
|
+
margin-bottom: 0 ;
|
271
|
+
margin-top: 0 ;
|
272
|
+
font: inherit }
|
273
|
+
|
274
|
+
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
275
|
+
margin-left: 2em ;
|
276
|
+
margin-right: 2em }
|
277
|
+
|
278
|
+
pre.code .ln { color: gray; } /* line numbers */
|
279
|
+
pre.code, code { background-color: #eeeeee }
|
280
|
+
pre.code .comment, code .comment { color: #5C6576 }
|
281
|
+
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
282
|
+
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
283
|
+
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
284
|
+
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
285
|
+
pre.code .inserted, code .inserted { background-color: #A3D289}
|
286
|
+
|
287
|
+
span.classifier {
|
288
|
+
font-family: sans-serif ;
|
289
|
+
font-style: oblique }
|
290
|
+
|
291
|
+
span.classifier-delimiter {
|
292
|
+
font-family: sans-serif ;
|
293
|
+
font-weight: bold }
|
294
|
+
|
295
|
+
span.interpreted {
|
296
|
+
font-family: sans-serif }
|
297
|
+
|
298
|
+
span.option {
|
299
|
+
white-space: nowrap }
|
300
|
+
|
301
|
+
span.pre {
|
302
|
+
white-space: pre }
|
303
|
+
|
304
|
+
span.problematic, pre.problematic {
|
305
|
+
color: red }
|
306
|
+
|
307
|
+
span.section-subtitle {
|
308
|
+
/* font-size relative to parent (h1..h6 element) */
|
309
|
+
font-size: 80% }
|
310
|
+
|
311
|
+
table.citation {
|
312
|
+
border-left: solid 1px gray;
|
313
|
+
margin-left: 1px }
|
314
|
+
|
315
|
+
table.docinfo {
|
316
|
+
margin: 2em 4em }
|
317
|
+
|
318
|
+
table.docutils {
|
319
|
+
margin-top: 0.5em ;
|
320
|
+
margin-bottom: 0.5em }
|
321
|
+
|
322
|
+
table.footnote {
|
323
|
+
border-left: solid 1px black;
|
324
|
+
margin-left: 1px }
|
325
|
+
|
326
|
+
table.docutils td, table.docutils th,
|
327
|
+
table.docinfo td, table.docinfo th {
|
328
|
+
padding-left: 0.5em ;
|
329
|
+
padding-right: 0.5em ;
|
330
|
+
vertical-align: top }
|
331
|
+
|
332
|
+
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
333
|
+
font-weight: bold ;
|
334
|
+
text-align: left ;
|
335
|
+
white-space: nowrap ;
|
336
|
+
padding-left: 0 }
|
337
|
+
|
338
|
+
/* "booktabs" style (no vertical lines) */
|
339
|
+
table.docutils.booktabs {
|
340
|
+
border: 0px;
|
341
|
+
border-top: 2px solid;
|
342
|
+
border-bottom: 2px solid;
|
343
|
+
border-collapse: collapse;
|
344
|
+
}
|
345
|
+
table.docutils.booktabs * {
|
346
|
+
border: 0px;
|
347
|
+
}
|
348
|
+
table.docutils.booktabs th {
|
349
|
+
border-bottom: thin solid;
|
350
|
+
text-align: left;
|
351
|
+
}
|
352
|
+
|
353
|
+
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
354
|
+
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
355
|
+
font-size: 100% }
|
356
|
+
|
357
|
+
ul.auto-toc {
|
358
|
+
list-style-type: none }
|
359
|
+
|
360
|
+
</style>
|
361
|
+
</head>
|
362
|
+
<body>
|
363
|
+
<div class="document">
|
364
|
+
|
365
|
+
|
366
|
+
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
|
367
|
+
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
|
368
|
+
</a>
|
369
|
+
<div class="section" id="sale-commission-product-criteria-fiscal-position-type">
|
370
|
+
<h1>Sale Commission Product Criteria Fiscal Position Type</h1>
|
371
|
+
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
372
|
+
!! This file is generated by oca-gen-addon-readme !!
|
373
|
+
!! changes will be overwritten. !!
|
374
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
375
|
+
!! source digest: sha256:1a8799aba26355dd89ecb6d74c64287e30585bc769dc4e5ad5b50de5313a94e5
|
376
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
377
|
+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/commission/tree/16.0/sale_commission_product_criteria_fiscal_position_type"><img alt="OCA/commission" src="https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/commission-16-0/commission-16-0-sale_commission_product_criteria_fiscal_position_type"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/commission&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
378
|
+
<p>This module extends the functionality of
|
379
|
+
sale_commission_product_criteria and
|
380
|
+
account_fiscal_position_partner_type to apply different commissions
|
381
|
+
rules depending on the fiscal_position_type field of the customer.</p>
|
382
|
+
<p><strong>Table of contents</strong></p>
|
383
|
+
<div class="contents local topic" id="contents">
|
384
|
+
<ul class="simple">
|
385
|
+
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
|
386
|
+
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
|
387
|
+
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
|
388
|
+
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
|
389
|
+
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
|
390
|
+
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
|
391
|
+
</ul>
|
392
|
+
</li>
|
393
|
+
</ul>
|
394
|
+
</div>
|
395
|
+
<div class="section" id="usage">
|
396
|
+
<h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
|
397
|
+
<p>To use this module, you need to:</p>
|
398
|
+
<ol class="arabic simple">
|
399
|
+
<li>Go to Commissions > Configuration > Commission Types.</li>
|
400
|
+
<li>Create or open a Commission Type with type = “Product criteria”.</li>
|
401
|
+
<li>Open or create a rule, appart from the “Apply On” field, you can fill
|
402
|
+
the “Fiscal Position Type” to filter whose customers this rule will
|
403
|
+
be applied to. If the field is empty, it will be applied to all
|
404
|
+
customers.</li>
|
405
|
+
<li>The rules will be sorted according to his priority, rules with fiscal
|
406
|
+
position types are more prioritary than rules without it.</li>
|
407
|
+
</ol>
|
408
|
+
<p>When selling or invoicing to a customer, Odoo will query the commission
|
409
|
+
rules, filtering by the fiscal position type of the customer if set.
|
410
|
+
Before that, odoo will apply the first commission rule found, as it is
|
411
|
+
done in the sale_commission_product_criteria module.</p>
|
412
|
+
</div>
|
413
|
+
<div class="section" id="bug-tracker">
|
414
|
+
<h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
|
415
|
+
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/commission/issues">GitHub Issues</a>.
|
416
|
+
In case of trouble, please check there if your issue has already been reported.
|
417
|
+
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
418
|
+
<a class="reference external" href="https://github.com/OCA/commission/issues/new?body=module:%20sale_commission_product_criteria_fiscal_position_type%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
419
|
+
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
420
|
+
</div>
|
421
|
+
<div class="section" id="credits">
|
422
|
+
<h2><a class="toc-backref" href="#toc-entry-3">Credits</a></h2>
|
423
|
+
<div class="section" id="authors">
|
424
|
+
<h3><a class="toc-backref" href="#toc-entry-4">Authors</a></h3>
|
425
|
+
<ul class="simple">
|
426
|
+
<li>Sygel</li>
|
427
|
+
</ul>
|
428
|
+
</div>
|
429
|
+
<div class="section" id="contributors">
|
430
|
+
<h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
|
431
|
+
<ul class="simple">
|
432
|
+
<li><a class="reference external" href="https://www.sygel.es">Sygel</a>:<ul>
|
433
|
+
<li>Alberto Martínez</li>
|
434
|
+
<li>Valentin Vinagre</li>
|
435
|
+
<li>Harald Panten</li>
|
436
|
+
</ul>
|
437
|
+
</li>
|
438
|
+
</ul>
|
439
|
+
</div>
|
440
|
+
<div class="section" id="maintainers">
|
441
|
+
<h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
|
442
|
+
<p>This module is maintained by the OCA.</p>
|
443
|
+
<a class="reference external image-reference" href="https://odoo-community.org">
|
444
|
+
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
|
445
|
+
</a>
|
446
|
+
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
447
|
+
mission is to support the collaborative development of Odoo features and
|
448
|
+
promote its widespread use.</p>
|
449
|
+
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
450
|
+
<p><a class="reference external image-reference" href="https://github.com/tisho99"><img alt="tisho99" src="https://github.com/tisho99.png?size=40px" /></a></p>
|
451
|
+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/commission/tree/16.0/sale_commission_product_criteria_fiscal_position_type">OCA/commission</a> project on GitHub.</p>
|
452
|
+
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
453
|
+
</div>
|
454
|
+
</div>
|
455
|
+
</div>
|
456
|
+
</div>
|
457
|
+
</body>
|
458
|
+
</html>
|
@@ -0,0 +1,152 @@
|
|
1
|
+
# Copyright 2025 Alberto Martínez <alberto.martinez@sygel.es>
|
2
|
+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
3
|
+
|
4
|
+
from odoo.tests.common import TransactionCase
|
5
|
+
|
6
|
+
|
7
|
+
class TestSaleCommissionProductCriteriaFiscalPositionType(TransactionCase):
|
8
|
+
@classmethod
|
9
|
+
def setUpClass(cls):
|
10
|
+
super().setUpClass()
|
11
|
+
cls.agent = cls.env.ref("sale_commission_product_criteria.demo_agent_rules")
|
12
|
+
cls.partner_b2c = cls.env["res.partner"].create(
|
13
|
+
{
|
14
|
+
"name": "Test B2C",
|
15
|
+
"fiscal_position_type": "b2c",
|
16
|
+
"agent_ids": [(4, cls.agent.id)],
|
17
|
+
}
|
18
|
+
)
|
19
|
+
cls.partner_b2b = cls.env["res.partner"].create(
|
20
|
+
{
|
21
|
+
"name": "Test B2B",
|
22
|
+
"fiscal_position_type": "b2b",
|
23
|
+
"agent_ids": [(4, cls.agent.id)],
|
24
|
+
}
|
25
|
+
)
|
26
|
+
cls.partner_no_type = cls.env["res.partner"].create(
|
27
|
+
{
|
28
|
+
"name": "Test B2B",
|
29
|
+
"fiscal_position_type": "",
|
30
|
+
"agent_ids": [(4, cls.agent.id)],
|
31
|
+
}
|
32
|
+
)
|
33
|
+
cls.product = cls.env.ref("product.product_product_4")
|
34
|
+
cls.product_2 = cls.env.ref("product.product_product_1")
|
35
|
+
cls.commission = cls.env.ref(
|
36
|
+
"sale_commission_product_criteria.demo_commission_rules"
|
37
|
+
)
|
38
|
+
cls.com_item_1 = cls.env.ref(
|
39
|
+
"sale_commission_product_criteria.demo_commission_rules_item_1"
|
40
|
+
)
|
41
|
+
cls.com_item_1.fiscal_position_type = False
|
42
|
+
cls.com_item_1_amount = 10
|
43
|
+
cls.com_item_2 = cls.env.ref(
|
44
|
+
"sale_commission_product_criteria.demo_commission_rules_item_2"
|
45
|
+
)
|
46
|
+
cls.com_item_2.fiscal_position_type = "b2b"
|
47
|
+
cls.com_item_2_amount = 20
|
48
|
+
cls.com_item_3 = cls.env.ref(
|
49
|
+
"sale_commission_product_criteria.demo_commission_rules_item_3"
|
50
|
+
)
|
51
|
+
cls.com_item_3.fiscal_position_type = "b2c"
|
52
|
+
cls.com_item_4 = cls.env.ref(
|
53
|
+
"sale_commission_product_criteria.demo_commission_rules_item_4"
|
54
|
+
)
|
55
|
+
cls.com_item_4.fiscal_position_type = "b2c"
|
56
|
+
cls.com_item_4_amount = 150
|
57
|
+
cls.com_item_5_amount = 5
|
58
|
+
cls.com_item_5 = cls.env["commission.item"].create(
|
59
|
+
{
|
60
|
+
"commission_id": cls.commission.id,
|
61
|
+
"applied_on": "0_product_variant",
|
62
|
+
"commission_type": "fixed",
|
63
|
+
"fixed_amount": cls.com_item_5_amount,
|
64
|
+
"product_id": cls.product_2.id,
|
65
|
+
"fiscal_position_type": False,
|
66
|
+
}
|
67
|
+
)
|
68
|
+
cls.com_item_6_amount = 6
|
69
|
+
cls.com_item_6 = cls.env["commission.item"].create(
|
70
|
+
{
|
71
|
+
"commission_id": cls.commission.id,
|
72
|
+
"applied_on": "0_product_variant",
|
73
|
+
"commission_type": "fixed",
|
74
|
+
"fixed_amount": cls.com_item_6_amount,
|
75
|
+
"product_id": cls.product_2.id,
|
76
|
+
"fiscal_position_type": "b2b",
|
77
|
+
}
|
78
|
+
)
|
79
|
+
cls.com_item_7 = cls.com_item_5.copy()
|
80
|
+
|
81
|
+
def _create_sale_order(self, product, partner):
|
82
|
+
return self.env["sale.order"].create(
|
83
|
+
{
|
84
|
+
"partner_id": partner.id,
|
85
|
+
"order_line": [
|
86
|
+
(
|
87
|
+
0,
|
88
|
+
0,
|
89
|
+
{
|
90
|
+
"name": product.name,
|
91
|
+
"product_id": product.id,
|
92
|
+
"product_uom_qty": 1.0,
|
93
|
+
"product_uom": product.uom_id.id,
|
94
|
+
"price_unit": 1000,
|
95
|
+
},
|
96
|
+
)
|
97
|
+
],
|
98
|
+
}
|
99
|
+
)
|
100
|
+
|
101
|
+
def _create_account_invoice(self, product, partner):
|
102
|
+
return self.env["account.move"].create(
|
103
|
+
{
|
104
|
+
"partner_id": partner.id,
|
105
|
+
"move_type": "out_invoice",
|
106
|
+
"invoice_line_ids": [
|
107
|
+
(
|
108
|
+
0,
|
109
|
+
0,
|
110
|
+
{
|
111
|
+
"name": product.name,
|
112
|
+
"product_id": product.id,
|
113
|
+
"quantity": 1.0,
|
114
|
+
"product_uom_id": product.uom_id.id,
|
115
|
+
"price_unit": 1000,
|
116
|
+
},
|
117
|
+
)
|
118
|
+
],
|
119
|
+
}
|
120
|
+
)
|
121
|
+
|
122
|
+
def test_sale_order(self):
|
123
|
+
so1 = self._create_sale_order(self.product, self.partner_b2c)
|
124
|
+
so1.recompute_lines_agents()
|
125
|
+
self.assertEqual(so1.order_line.agent_ids.amount, self.com_item_4_amount)
|
126
|
+
|
127
|
+
so2 = self._create_sale_order(self.product, self.partner_b2b)
|
128
|
+
so2.recompute_lines_agents()
|
129
|
+
self.assertEqual(so2.order_line.agent_ids.amount, self.com_item_2_amount)
|
130
|
+
|
131
|
+
so3 = self._create_sale_order(self.product, self.partner_no_type)
|
132
|
+
so3.recompute_lines_agents()
|
133
|
+
self.assertEqual(so3.order_line.agent_ids.amount, self.com_item_1_amount)
|
134
|
+
|
135
|
+
def test_invoice(self):
|
136
|
+
in1 = self._create_account_invoice(self.product, self.partner_b2c)
|
137
|
+
in1.recompute_lines_agents()
|
138
|
+
self.assertEqual(in1.invoice_line_ids.agent_ids.amount, self.com_item_4_amount)
|
139
|
+
|
140
|
+
in2 = self._create_account_invoice(self.product, self.partner_b2b)
|
141
|
+
in2.recompute_lines_agents()
|
142
|
+
self.assertEqual(in2.invoice_line_ids.agent_ids.amount, self.com_item_2_amount)
|
143
|
+
|
144
|
+
in3 = self._create_account_invoice(self.product, self.partner_no_type)
|
145
|
+
in3.recompute_lines_agents()
|
146
|
+
self.assertEqual(in3.invoice_line_ids.agent_ids.amount, self.com_item_1_amount)
|
147
|
+
|
148
|
+
def test_commission_order(self):
|
149
|
+
# Test that commissions with fiscal position types are applied before
|
150
|
+
in1 = self._create_account_invoice(self.product_2, self.partner_b2b)
|
151
|
+
in1.recompute_lines_agents()
|
152
|
+
self.assertEqual(in1.invoice_line_ids.agent_ids.amount, self.com_item_6_amount)
|
odoo/addons/sale_commission_product_criteria_fiscal_position_type/views/commission_item_views.xml
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
2
|
+
<!-- Copyright 2025 Alberto Martínez <alberto.martinez@sygel.es>
|
3
|
+
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
4
|
+
<odoo>
|
5
|
+
|
6
|
+
<record id="sale_commission_form_lines_mod_fiscal_position" model="ir.ui.view">
|
7
|
+
<field name="name">commission.form.view.inherit.fiscal.position</field>
|
8
|
+
<field name="model">commission</field>
|
9
|
+
<field name="priority">18</field>
|
10
|
+
<field
|
11
|
+
name="inherit_id"
|
12
|
+
ref="sale_commission_product_criteria.sale_commission_form_lines_mod"
|
13
|
+
/>
|
14
|
+
<field name="arch" type="xml">
|
15
|
+
<xpath
|
16
|
+
expr="//field[@name='item_ids']/tree//field[@name='name']"
|
17
|
+
position="after"
|
18
|
+
>
|
19
|
+
<field name="fiscal_position_type" optional="show" />
|
20
|
+
</xpath>
|
21
|
+
</field>
|
22
|
+
</record>
|
23
|
+
|
24
|
+
<record id="commission_item_tree_view_fiscal_position" model="ir.ui.view">
|
25
|
+
<field name="name">commission.item.tree.fiscal.position</field>
|
26
|
+
<field name="model">commission.item</field>
|
27
|
+
<field name="priority">18</field>
|
28
|
+
<field
|
29
|
+
name="inherit_id"
|
30
|
+
ref="sale_commission_product_criteria.commission_item_tree_view"
|
31
|
+
/>
|
32
|
+
<field name="arch" type="xml">
|
33
|
+
<field name="name" position="after">
|
34
|
+
<field name="fiscal_position_type" optional="show" />
|
35
|
+
</field>
|
36
|
+
</field>
|
37
|
+
</record>
|
38
|
+
|
39
|
+
<record id="commission_item_form_view_fiscal_position" model="ir.ui.view">
|
40
|
+
<field name="name">commission.item.form.fiscal.position</field>
|
41
|
+
<field name="model">commission.item</field>
|
42
|
+
<field name="priority">18</field>
|
43
|
+
<field
|
44
|
+
name="inherit_id"
|
45
|
+
ref="sale_commission_product_criteria.commission_item_form_view"
|
46
|
+
/>
|
47
|
+
<field name="arch" type="xml">
|
48
|
+
<field name="applied_on" position="after">
|
49
|
+
<field name="fiscal_position_type" />
|
50
|
+
</field>
|
51
|
+
</field>
|
52
|
+
</record>
|
53
|
+
|
54
|
+
</odoo>
|