Skip to content

Commit 83c75ee

Browse files
author
patryk.bujalla
committed
add account move models
1 parent c561aae commit 83c75ee

4 files changed

Lines changed: 1043 additions & 3 deletions

File tree

PortaCapena.OdooJsonRpcClient.Example/CompanyRepository.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Linq;
2-
using System.Threading.Tasks;
1+
using System.Threading.Tasks;
32
using FluentAssertions;
43
using PortaCapena.OdooJsonRpcClient.Shared;
54
using PortaCapena.OdooJsonRpcClient.Shared.Models;

PortaCapena.OdooJsonRpcClient.Example/OdooClientRequests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public async Task Should_get_products_with_selected_properties_using_query()
187187
public async Task Get_DotNet_model_should_return_string()
188188
{
189189
var odooClient = new OdooClient(Config);
190-
var tableName = "account.account.type";
190+
var tableName = "account.move.line";
191191
var modelResult = await odooClient.GetModelAsync(tableName);
192192

193193
modelResult.Succeed.Should().BeTrue();
Lines changed: 363 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,363 @@
1+
using System;
2+
using System.Runtime.Serialization;
3+
using Newtonsoft.Json;
4+
using Newtonsoft.Json.Converters;
5+
using PortaCapena.OdooJsonRpcClient.Attributes;
6+
using PortaCapena.OdooJsonRpcClient.Converters;
7+
using PortaCapena.OdooJsonRpcClient.Models;
8+
9+
namespace PortaCapena.OdooJsonRpcClient.Shared.Models
10+
{
11+
[OdooTableName("account.move.line")]
12+
[JsonConverter(typeof(OdooModelConverter))]
13+
public class AccountMoveLineOdooModel : IOdooModel
14+
{
15+
16+
// account.move
17+
// required
18+
[JsonProperty("move_id")]
19+
public long MoveId { get; set; }
20+
21+
[JsonProperty("move_name")]
22+
public string MoveName { get; set; }
23+
24+
[JsonProperty("date")]
25+
public DateTime? Date { get; set; }
26+
27+
[JsonProperty("ref")]
28+
public string Ref { get; set; }
29+
30+
[JsonProperty("parent_state")]
31+
public StatusAccountMoveLineOdooEnum? ParentState { get; set; }
32+
33+
// account.journal
34+
[JsonProperty("journal_id")]
35+
public long? JournalId { get; set; }
36+
37+
// res.company
38+
[JsonProperty("company_id")]
39+
public long? CompanyId { get; set; }
40+
41+
// res.currency
42+
[JsonProperty("company_currency_id")]
43+
public long? CompanyCurrencyId { get; set; }
44+
45+
// res.country
46+
[JsonProperty("tax_fiscal_country_id")]
47+
public long? TaxFiscalCountryId { get; set; }
48+
49+
// account.account
50+
[JsonProperty("account_id")]
51+
public long? AccountId { get; set; }
52+
53+
[JsonProperty("account_internal_type")]
54+
public InternalTypeAccountMoveLineOdooEnum? AccountInternalType { get; set; }
55+
56+
[JsonProperty("account_internal_group")]
57+
public InternalGroupAccountMoveLineOdooEnum? AccountInternalGroup { get; set; }
58+
59+
// account.root
60+
[JsonProperty("account_root_id")]
61+
public long? AccountRootId { get; set; }
62+
63+
[JsonProperty("sequence")]
64+
public int? Sequence { get; set; }
65+
66+
[JsonProperty("name")]
67+
public string Name { get; set; }
68+
69+
[JsonProperty("quantity")]
70+
public double? Quantity { get; set; }
71+
72+
[JsonProperty("price_unit")]
73+
public double? PriceUnit { get; set; }
74+
75+
[JsonProperty("discount")]
76+
public double? Discount { get; set; }
77+
78+
[JsonProperty("debit")]
79+
public decimal? Debit { get; set; }
80+
81+
[JsonProperty("credit")]
82+
public decimal? Credit { get; set; }
83+
84+
[JsonProperty("balance")]
85+
public decimal? Balance { get; set; }
86+
87+
[JsonProperty("cumulated_balance")]
88+
public decimal? CumulatedBalance { get; set; }
89+
90+
[JsonProperty("amount_currency")]
91+
public decimal? AmountCurrency { get; set; }
92+
93+
[JsonProperty("price_subtotal")]
94+
public decimal? PriceSubtotal { get; set; }
95+
96+
[JsonProperty("price_total")]
97+
public decimal? PriceTotal { get; set; }
98+
99+
[JsonProperty("reconciled")]
100+
public bool? Reconciled { get; set; }
101+
102+
[JsonProperty("blocked")]
103+
public bool? Blocked { get; set; }
104+
105+
[JsonProperty("date_maturity")]
106+
public DateTime? DateMaturity { get; set; }
107+
108+
// res.currency
109+
// required
110+
[JsonProperty("currency_id")]
111+
public long CurrencyId { get; set; }
112+
113+
// res.partner
114+
[JsonProperty("partner_id")]
115+
public long? PartnerId { get; set; }
116+
117+
// uom.uom
118+
[JsonProperty("product_uom_id")]
119+
public long? ProductUomId { get; set; }
120+
121+
// product.product
122+
[JsonProperty("product_id")]
123+
public long? ProductId { get; set; }
124+
125+
// uom.category
126+
[JsonProperty("product_uom_category_id")]
127+
public long? ProductUomCategoryId { get; set; }
128+
129+
// account.reconcile.model
130+
[JsonProperty("reconcile_model_id")]
131+
public long? ReconcileModelId { get; set; }
132+
133+
// account.payment
134+
[JsonProperty("payment_id")]
135+
public long? PaymentId { get; set; }
136+
137+
// account.bank.statement.line
138+
[JsonProperty("statement_line_id")]
139+
public long? StatementLineId { get; set; }
140+
141+
// account.bank.statement
142+
[JsonProperty("statement_id")]
143+
public long? StatementId { get; set; }
144+
145+
// account.tax
146+
[JsonProperty("tax_ids")]
147+
public long[] TaxIds { get; set; }
148+
149+
// account.tax
150+
[JsonProperty("tax_line_id")]
151+
public long? TaxLineId { get; set; }
152+
153+
// account.tax.group
154+
[JsonProperty("tax_group_id")]
155+
public long? TaxGroupId { get; set; }
156+
157+
[JsonProperty("tax_base_amount")]
158+
public decimal? TaxBaseAmount { get; set; }
159+
160+
[JsonProperty("tax_exigible")]
161+
public bool? TaxExigible { get; set; }
162+
163+
// account.tax.repartition.line
164+
[JsonProperty("tax_repartition_line_id")]
165+
public long? TaxRepartitionLineId { get; set; }
166+
167+
// account.account.tag
168+
[JsonProperty("tax_tag_ids")]
169+
public long[] TaxTagIds { get; set; }
170+
171+
[JsonProperty("tax_audit")]
172+
public string TaxAudit { get; set; }
173+
174+
[JsonProperty("amount_residual")]
175+
public decimal? AmountResidual { get; set; }
176+
177+
[JsonProperty("amount_residual_currency")]
178+
public decimal? AmountResidualCurrency { get; set; }
179+
180+
// account.full.reconcile
181+
[JsonProperty("full_reconcile_id")]
182+
public long? FullReconcileId { get; set; }
183+
184+
// account.partial.reconcile
185+
[JsonProperty("matched_debit_ids")]
186+
public long[] MatchedDebitIds { get; set; }
187+
188+
// account.partial.reconcile
189+
[JsonProperty("matched_credit_ids")]
190+
public long[] MatchedCreditIds { get; set; }
191+
192+
[JsonProperty("matching_number")]
193+
public string MatchingNumber { get; set; }
194+
195+
// account.analytic.line
196+
[JsonProperty("analytic_line_ids")]
197+
public long[] AnalyticLineIds { get; set; }
198+
199+
// account.analytic.account
200+
[JsonProperty("analytic_account_id")]
201+
public long? AnalyticAccountId { get; set; }
202+
203+
// account.analytic.tag
204+
[JsonProperty("analytic_tag_ids")]
205+
public long[] AnalyticTagIds { get; set; }
206+
207+
[JsonProperty("recompute_tax_line")]
208+
public bool? RecomputeTaxLine { get; set; }
209+
210+
[JsonProperty("display_type")]
211+
public DisplayTypeAccountMoveLineOdooEnum? DisplayType { get; set; }
212+
213+
[JsonProperty("is_rounding_line")]
214+
public bool? IsRoundingLine { get; set; }
215+
216+
[JsonProperty("exclude_from_invoice_tab")]
217+
public bool? ExcludeFromInvoiceTab { get; set; }
218+
219+
// ir.attachment
220+
[JsonProperty("move_attachment_ids")]
221+
public long[] MoveAttachmentIds { get; set; }
222+
223+
// purchase.order.line
224+
[JsonProperty("purchase_line_id")]
225+
public long? PurchaseLineId { get; set; }
226+
227+
// purchase.order
228+
[JsonProperty("purchase_order_id")]
229+
public long? PurchaseOrderId { get; set; }
230+
231+
[JsonProperty("predict_from_name")]
232+
public bool? PredictFromName { get; set; }
233+
234+
[JsonProperty("expected_pay_date")]
235+
public DateTime? ExpectedPayDate { get; set; }
236+
237+
[JsonProperty("internal_note")]
238+
public string InternalNote { get; set; }
239+
240+
[JsonProperty("next_action_date")]
241+
public DateTime? NextActionDate { get; set; }
242+
243+
// sale.order.line
244+
[JsonProperty("sale_line_ids")]
245+
public long[] SaleLineIds { get; set; }
246+
247+
// account.asset
248+
[JsonProperty("asset_ids")]
249+
public long[] AssetIds { get; set; }
250+
251+
// account_followup.followup.line
252+
[JsonProperty("followup_line_id")]
253+
public long? FollowupLineId { get; set; }
254+
255+
[JsonProperty("followup_date")]
256+
public DateTime? FollowupDate { get; set; }
257+
258+
// sale.subscription
259+
[JsonProperty("subscription_id")]
260+
public long? SubscriptionId { get; set; }
261+
262+
[JsonProperty("subscription_start_date")]
263+
public DateTime? SubscriptionStartDate { get; set; }
264+
265+
[JsonProperty("subscription_end_date")]
266+
public DateTime? SubscriptionEndDate { get; set; }
267+
268+
[JsonProperty("subscription_mrr")]
269+
public decimal? SubscriptionMrr { get; set; }
270+
271+
[JsonProperty("id")]
272+
public long Id { get; set; }
273+
274+
[JsonProperty("display_name")]
275+
public string DisplayName { get; set; }
276+
277+
// res.users
278+
[JsonProperty("create_uid")]
279+
public long? CreateUid { get; set; }
280+
281+
[JsonProperty("create_date")]
282+
public DateTime? CreateDate { get; set; }
283+
284+
// res.users
285+
[JsonProperty("write_uid")]
286+
public long? WriteUid { get; set; }
287+
288+
[JsonProperty("write_date")]
289+
public DateTime? WriteDate { get; set; }
290+
291+
[JsonProperty("__last_update")]
292+
public DateTime? LastUpdate { get; set; }
293+
}
294+
295+
296+
[JsonConverter(typeof(StringEnumConverter))]
297+
public enum StatusAccountMoveLineOdooEnum
298+
{
299+
[EnumMember(Value = "draft")]
300+
Draft = 1,
301+
302+
[EnumMember(Value = "posted")]
303+
Posted = 2,
304+
305+
[EnumMember(Value = "cancel")]
306+
Cancelled = 3,
307+
}
308+
309+
310+
// The 'Internal Type' is used for features available on different types of accounts: liquidity type is for cash or bank accounts, payable/receivable is for vendor/customer accounts.
311+
[JsonConverter(typeof(StringEnumConverter))]
312+
public enum InternalTypeAccountMoveLineOdooEnum
313+
{
314+
[EnumMember(Value = "other")]
315+
Regular = 1,
316+
317+
[EnumMember(Value = "receivable")]
318+
Receivable = 2,
319+
320+
[EnumMember(Value = "payable")]
321+
Payable = 3,
322+
323+
[EnumMember(Value = "liquidity")]
324+
Liquidity = 4,
325+
}
326+
327+
328+
// The 'Internal Group' is used to filter accounts based on the internal group set on the account type.
329+
[JsonConverter(typeof(StringEnumConverter))]
330+
public enum InternalGroupAccountMoveLineOdooEnum
331+
{
332+
[EnumMember(Value = "equity")]
333+
Equity = 1,
334+
335+
[EnumMember(Value = "asset")]
336+
Asset = 2,
337+
338+
[EnumMember(Value = "liability")]
339+
Liability = 3,
340+
341+
[EnumMember(Value = "income")]
342+
Income = 4,
343+
344+
[EnumMember(Value = "expense")]
345+
Expense = 5,
346+
347+
[EnumMember(Value = "off_balance")]
348+
OffBalance = 6,
349+
}
350+
351+
352+
// Technical field for UX purpose.
353+
[JsonConverter(typeof(StringEnumConverter))]
354+
public enum DisplayTypeAccountMoveLineOdooEnum
355+
{
356+
[EnumMember(Value = "line_section")]
357+
Section = 1,
358+
359+
[EnumMember(Value = "line_note")]
360+
Note = 2,
361+
}
362+
363+
}

0 commit comments

Comments
 (0)