rodoo 0.3.0 → 0.4.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +53 -0
- data/lib/rodoo/model.rb +31 -0
- data/lib/rodoo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6296d9a68fe77f42b8a9077cceffbb4f444a72cd2e483e39f5c8e5c2b8e544d7
|
|
4
|
+
data.tar.gz: ae9f0cd4ec90a8b199750929c46ca59e93582b03b77be7cf97b72475f45b99a5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b66d9c307b38d5eb0f9a3de01917dca2d2469a4019193b56806b3e7a41e8957a136a2f354c9a95eaae3f3e9da093cbcffb053f9bedc5bcff644897d1b7715d5
|
|
7
|
+
data.tar.gz: 324854d54a34edf6c2a91ad6f4523db61017ca83dd7a77c6c1f69ba72d452273d93d46ecb0627ccf53bcd3a92866ad8b1c03c7ad20fef6789b38634823581e4a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -107,6 +107,30 @@ all_contacts = Rodoo::Contact.all(limit: 100)
|
|
|
107
107
|
|
|
108
108
|
Supported operators in string conditions: `=`, `!=`, `<>`, `<`, `>`, `<=`, `>=`, `like`, `ilike`, `=like`, `=ilike`
|
|
109
109
|
|
|
110
|
+
### Language-specific responses
|
|
111
|
+
|
|
112
|
+
Use the `lang:` parameter to retrieve translatable fields (like `name`, `description`) in a specific language:
|
|
113
|
+
|
|
114
|
+
```ruby
|
|
115
|
+
# Find with language
|
|
116
|
+
contact = Rodoo::Contact.find(42, lang: "fr_FR")
|
|
117
|
+
contact.name # => "Société Acme" (French translation)
|
|
118
|
+
|
|
119
|
+
# Query with language
|
|
120
|
+
products = Rodoo::Product.where(type: "consu", lang: "es_ES")
|
|
121
|
+
|
|
122
|
+
# All records with language
|
|
123
|
+
contacts = Rodoo::Contact.all(limit: 100, lang: "de_DE")
|
|
124
|
+
|
|
125
|
+
# Find by with language
|
|
126
|
+
contact = Rodoo::Contact.find_by(email: "john@example.com", lang: "it_IT")
|
|
127
|
+
|
|
128
|
+
# Create with language (for translatable field values)
|
|
129
|
+
contact = Rodoo::Contact.create({ name: "Nouveau Contact" }, lang: "fr_FR")
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The language code should match one of the languages installed in your Odoo instance (e.g., `en_US`, `fr_FR`, `es_ES`, `de_DE`).
|
|
133
|
+
|
|
110
134
|
### Creating records
|
|
111
135
|
|
|
112
136
|
```ruby
|
|
@@ -149,6 +173,35 @@ contact.destroy
|
|
|
149
173
|
contact.destroyed? # => true
|
|
150
174
|
```
|
|
151
175
|
|
|
176
|
+
### Posting messages (chatter)
|
|
177
|
+
|
|
178
|
+
Post internal notes or messages to a record's chatter using Odoo's mail thread functionality:
|
|
179
|
+
|
|
180
|
+
```ruby
|
|
181
|
+
invoice = Rodoo::CustomerInvoice.find(42)
|
|
182
|
+
|
|
183
|
+
# Post an internal note
|
|
184
|
+
invoice.message_post(
|
|
185
|
+
body: "<p>This is an internal note</p>",
|
|
186
|
+
message_type: "comment",
|
|
187
|
+
subtype_xmlid: "mail.mt_note"
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
# Post with additional parameters (e.g., notify specific partners)
|
|
191
|
+
invoice.message_post(
|
|
192
|
+
body: "<p>Please review this invoice</p>",
|
|
193
|
+
message_type: "comment",
|
|
194
|
+
subtype_xmlid: "mail.mt_comment",
|
|
195
|
+
partner_ids: [10, 20]
|
|
196
|
+
)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Parameters:**
|
|
200
|
+
- `body:` (required) - HTML content of the message
|
|
201
|
+
- `message_type:` - Type of message: `"comment"` (default), `"notification"`, `"email"`, `"user_notification"`
|
|
202
|
+
- `subtype_xmlid:` - XML ID for subtype (e.g., `"mail.mt_note"` for internal notes, `"mail.mt_comment"` for comments)
|
|
203
|
+
- Additional kwargs are passed directly to Odoo's `message_post` method
|
|
204
|
+
|
|
152
205
|
### Attachments
|
|
153
206
|
|
|
154
207
|
Attach PDF files to accounting entries (invoices, credit notes, journal entries):
|
data/lib/rodoo/model.rb
CHANGED
|
@@ -275,6 +275,37 @@ module Rodoo
|
|
|
275
275
|
@destroyed == true
|
|
276
276
|
end
|
|
277
277
|
|
|
278
|
+
# Posts a message to the record's chatter (mail thread).
|
|
279
|
+
# This is used for internal notes, comments, and notifications in Odoo.
|
|
280
|
+
#
|
|
281
|
+
# @param body [String] HTML content of the message
|
|
282
|
+
# @param message_type [String] Type: "comment", "notification", "email", "user_notification"
|
|
283
|
+
# @param subtype_xmlid [String, nil] XML ID for subtype (e.g., "mail.mt_note" for internal notes)
|
|
284
|
+
# @param kwargs [Hash] Additional parameters to pass to message_post
|
|
285
|
+
# @return [Integer] The ID of the created mail.message record
|
|
286
|
+
# @raise [Rodoo::Error] If the record hasn't been persisted
|
|
287
|
+
#
|
|
288
|
+
# @example Post an internal note
|
|
289
|
+
# invoice.message_post(
|
|
290
|
+
# body: "<p>This is an internal note</p>",
|
|
291
|
+
# message_type: "comment",
|
|
292
|
+
# subtype_xmlid: "mail.mt_note"
|
|
293
|
+
# )
|
|
294
|
+
#
|
|
295
|
+
def message_post(body:, message_type: "comment", subtype_xmlid: nil, **kwargs)
|
|
296
|
+
raise Error, "Cannot post message to a record that hasn't been persisted" unless persisted?
|
|
297
|
+
|
|
298
|
+
params = {
|
|
299
|
+
ids: [id],
|
|
300
|
+
body: body,
|
|
301
|
+
message_type: message_type,
|
|
302
|
+
subtype_xmlid: subtype_xmlid,
|
|
303
|
+
**kwargs
|
|
304
|
+
}.compact
|
|
305
|
+
|
|
306
|
+
self.class.execute("message_post", params)
|
|
307
|
+
end
|
|
308
|
+
|
|
278
309
|
def inspect
|
|
279
310
|
"#<#{self.class.name} id=#{id.inspect} #{inspectable_attributes}>"
|
|
280
311
|
end
|
data/lib/rodoo/version.rb
CHANGED