Comments (5)
any hope?
from odoo-rpc-dart.
Are you setting bin_size=True
in the context? Which field of ir.attachment
are you reading?
from odoo-rpc-dart.
i m reading 'datas' field.. i tried with bin_size=True and bin_size=False both
from odoo-rpc-dart.
List attachmentIds = [];
if (_attachmentResult != null && _attachmentResult!.files.isNotEmpty) {
final attachmentInfo = _attachmentResult!.files.first;
print('Selected attachmentInfo: $attachmentInfo');
final attachmentData = attachmentInfo.bytes ??
await File(attachmentInfo.path!).readAsBytes();
print('Read attachmentData: $attachmentData');
if (attachmentData != null) {
final attachment = await orpc?.callKw({
'model': 'ir.attachment',
'method': 'create',
'args': [
{
'name': attachmentInfo.name,
'type': 'binary',
'datas': base64Encode(attachmentData),
'res_model': 'crm.lead',
'res_id': widget.messageId,
'mimetype': attachmentInfo.extension != null
? 'application/${attachmentInfo.extension}'
: 'application/octet-stream',
}
],
'kwargs': {
'context': {'bin_size': true}
},
});
print('Created attachment with ID: $attachment');
attachmentIds.add(attachment);
} else {
print('Failed to read attachment data.');
}
} else {
print('No attachment selected.');
}
print('Creating message...');
final message = await orpc?.callKw({
'model': 'mail.message',
'method': 'create',
'args': [
{
'model': 'crm.lead',
'body': _responseController.text,
'res_id': widget.messageId,
'message_type': 'comment',
'subtype_id': 1,
'attachment_ids': attachmentIds.isNotEmpty
? [
[6, 0, attachmentIds]
]
: [],
}
],
'kwargs': {
'context': {'bin_size': true}
},
});
if (message != null) {
print('Created message with ID: $message');
_responseController.clear();
setState(() {
_attachmentResult = null;
});
fetchResponse(); // Refresh the messages list
}
check this one use filepicker for this
from odoo-rpc-dart.
any hope?
once check the code i mentioned
from odoo-rpc-dart.
Related Issues (20)
- New Odoo Change data type in Saas DB HOT 1
- [Request] Flutter example - Login & session Management HOT 2
- [Request] Anyone tried using this plugin with Open ERP ? HOT 2
- message: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. HOT 6
- How to store Odoosession in flutter app HOT 1
- ClientException (Connection closed while receiving data) HOT 1
- Authentication issue on web HOT 1
- Update http dependency to the latest version (1.1.0) HOT 2
- how to use callRPC to create new elements HOT 2
- error OdooException: {code: 200, message: Odoo Server Error, data: {name: builtins.ValueError, debug: Traceback (most recent call last): HOT 1
- Extract a flutter application using Odoo_rpc package HOT 3
- Update code function : callRPC HOT 1
- type 'Null' is not a subtype of type 'int' in type cast HOT 2
- orpc.authenticate raise a null pointer exception HOT 4
- __last_update field not appearing on the api requests HOT 1
- pulling images like contact avatar HOT 8
- Using totp_token via orpc authenticate HOT 1
- Session Expired Exception
- Does this support odoo 17? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from odoo-rpc-dart.