I have some data that I need to pass to every website views in Odoo. The problem is that I don't know the proper way to do that. I have thought about manually add them to every render method, but it doesn't feel right for me. And it violated DRY, of course.
I am using Odoo 12. Thank for your help!!
every page of odoo call website.layout template (for header & footer) so you can place your data in layout template and it will available in every page
Related
Title says it all. I want to create a custom prestashop page, but I don't know how.
What I actually want to do: create a button that opens a custom page. I can't find anything useful in the internet so I came here to ask for help. Could someone explain me how to do that?
There are many ways to add a new page, it depending in your needs.
By a CMS page, you can add the content you need in the HTML editor, like the product description: http://doc.prestashop.com/display/PS16/CMS+-+Managing+Static+Content
By a front controller from a module: https://devdocs.prestashop.com/1.7/modules/concepts/controllers/front-controllers/
By creating a new page, here my explanation: Prestashop custom page with own template
The point 1 is the most easy way for a common user, the rest of the points require advanced knowledge.
I am creating a custom module with additional part numbers on a separate tab in the products screen. I have built the module, but am having trouble figuring out how to display the information so it matches the layout in the attached image. I have tried tree view but have not been able to get the fields on the same line. Can this only be accomplished through css or is there a table view that I am not aware of?
I also need to make sure that all of the information in row 1 stays tethered together for additional forms, etc. My plan is to make the field names for each row end with a different number (i.e. x_mfrname1,x_mfrpn1,x_mfrname2,x_mfrpn2, etc.). Can somebody please just tell me if I am on the right track. This is the initial Odoo setup for a client of mine and I don't want them to come back to me down the line and find out I forgot something. I have been scouring the internet and reading a few books but I am not completely confident.
Here is a link to a layout of what I am talking about:
MFG Part Number Tab
Thanks!
class sub_part_details(models.Model)
_name='sub.part.detail'
primary_pn=fields.Boolean('Primary P/N')
obsolete=fields.Boolean('Obsolete')
pn=fields.Char('P/N')
desc=fields.Char('Description')
upgrade=fields.Char('Upgrade')
part_detail_id=fields.Many2one('part.details')
class part_details(models.Model)
_name='part.details'
cat=fields.Char('CAT')
sub_ass=fields.Char('Subassembly')
main_ass=fields.Char('Main Assembly')
notes=fields.Text('Notes')
sub_details_ids=fields.One2Many(''sub.part.detail','part_detail_id')
It might be helpful
I'm newbie in CakePHP and I have a few questions.
I'm trying to set up my first CakePHP website, and I want to display menu with links in my layout. I've created model called MenuItem, then I've created controller "MenuItemsController" and then a function show. When I access /menuitems/show/ all my links are displayed. So here's the problem. I want do call this controller in my layout so links will be visible on every subpage. First question is how to call this controller, and second how will output look like ? Do I have to create view for this cotroller if I don't want to use /menuitems/show/ or it's okay to set controller to output just array of data ?
Thank you!
First question is how to call this controller, and second how will output look like ?
Use requestAction() to request the data from the view OR better, set it based on the page you're on in your AppController::beforeFfilter() method.
In your layout simply use an element $this->element('menu'); and use the set data in it or, if you go for requestAction() do this call inside the element, you can even cache the element.
Read the links to the CakePHP book in the text, the book contains example code as well.
I am confused when I should use a custom widget or renderPartial in my view files. Sometimes I use widget and sometimes I use renderPartial.
Widget
You use widget when your application logic is defined in a separate CLASS file and the logic is somehow separated and standalone.
Widget's are chosen when the functionality is repeatedly used elsewhere, on lot of pages.
renderPartial
You use renderPartial for VIEW files that you want to embed into something bigger, or when you want to print something without using the application layouts.
renderPartial is chosen when all the variables it need to access are already prepared in the current action.
Widget
You can use widget when your site has some common part like header and footer or sometime some kind filter which require on every page of site.
renderPartial
Take example of search form of yii crude which is called by using renderPartial because that serach form is changing according to requirement of pages.
Sorry for english.
I would like to show a form in prestashop module and would like to store that value in database. How is it possible?? Is there any prestashop expert ??
You may use custom HTML block and add your form code inside that. And off course have to use a hook to show up that HTML block in the site.
There are lots of free Custom HTML block modules available.
You should take a look at all the modules available in the modules/ directory.
If you want to display a form in the back and/or the front office, you'll have to override different methods of the Module class, and you'll have to use the different hooks available..
Best regards,
Try this free module :
https://www.prestashop.com/forums/topic/391966-megablock-16-module-gratuit/
With this one you can add HTML in some hooks from back-office.
Everything is stored in database.
You should use Helpers and Tools class (Helpers show forms and Tools::getValues() does what it says...)
In MegaBlock there is also TinyMCE available. Have a look, this module is really useful ;-)
you can develop a module by using hooks based on the hooks used the form will be displayed in that position in prestashop while using hooks you need to assign a tpl file in that tpl file you can write the codings to display a form
And also you can develop a module with a separate controller and you can assign a tpl for that controller.