Dropdown depending on other drodown value in portal template - odoo-14

I have to place two fields in vendor portal template as Company and Branch. Branch depends on company selection.
if user select the first company, then branch should be changed following the selected company. Model used for this is res.company and res.branch.
Please guide.

Related

I have problem with multi companies flow when confirm order Odoo 15

I have a multi companies flow where Purchase Order from Company A will create Sale Order for Company B, I am trying to automatically confirm that Sale Order. Each Company has different flow when confirm Sale Order.
I am running the code with OdooBot because I need access to both Companies, but when confirm Sale Order for company B, it always trigger the flow of confirming order of company A, I dont know why.
If I choose both companies on the top right multi-company widget and then confirm the SO, the same problem happens.
If I only choose company B on the top right multi-company widget and then confirm the SO, it will work fine.
How am I gonna simulate this behavior by code? I tried with_company and with_context(allowed_company_ids), nothing worked
so_res.with_company(so_res.company_id).action_confirm()
It still triggers the flow of company A

Ecommerce checkout: when and where to create intermediate and final order for items in cart in relational database

I am working on a ecommerce project(in Django and it is based on rest API) where users can place orders. Users can add items they are interested to buy in a shopping cart which is persistent. They go through the checkout process to place the order.
I am not clear how to store and manage intermediate order stage before creating final order in order table in case of rest API based service which does not have request session.
I am thinking of these options:
using separate cart, order table: cart table will have items selected by the user. when they click checkout, create an order but with a flag which says it is in intermediate stage. when payment is initiated, it will be marked as a final order.
using separate table for cart, checkout and order: cart table will have items selected by the user. when they click checkout, create a checkout entry. when payment is initiated, create an entry in the order table. here checkout needs to have replica of the order structure. this seems to duplicate lot functionality
using cart+checkout(combined), order table: cart table will have items selected by the user. when they click checkout, checkout stages will be stored in same table. this is similar to the magento sales_flat_quote table. when payment is initiated, a final order entry is created in order table.
I am not clear about the pros and cons for the above ways. What is the standard approach?
And any references regarding the same.
There are multiple ways of doing it. Antonio Melé has a great approach outlined in his book "Django 3 By Example"
They have the book's myshop app repository public on Github.
The book outlines having 2 apps (cart, order).
Order has two models- Order, OrderItems
Cart doesn't have any model. It saves the added items to the django session. Checkout the carts.py file.
In addition, I personally used a Shipping app to manage variable delivery charges.

Different prices for multiple countries in PrestaShop

I need to set up a store in PrestaShop 1.6 where the prices are different for every delivery country.
Could someone point me to the correct approach of setting such a request?
My current idea is to set up for each country a new shop in MultiStore, but having 107 countries is too time-consuming. Is there any other solution?
You don't have to create multistore. Probably some of the shipping options are the same (in terms of price). You can create custom zone (e.g., Western Europe, Eastern Europe...) and then set price rule.
http://doc.prestashop.com/display/PS16/Managing+Carriers
Creating a New Carrier using the Carrier Wizard In this section, we
are going to create a complete carrier, from A to Z, using the Carrier
Wizard. You can create as many carriers as you wish. If one carrier
has different shipping services, you should create as many carriers in
PrestaShop, and differentiate them with their names: Many of the
details asked by PrestaShop's forms should be provided by your
carriers once you have set up an account or are under contract with
them directly. Check with them in order to make sure everything is
configured correctly. To create a new carrier, click on the "Add new"
button in the "Carriers" page. This will open the Carrier Wizard on
the first of its four panels.
Panel 2: Shipping locations and costs
"Shipping locations and costs" is the place where you can use your custom zone. It will appear automatically based on your settings.
http://nemops.com/prestashop-shipping-zones-countries/#.VaQ4-RvtlBc

Asserting on data that is derived from a previous step

When a piece of data that I want to assert on in a later test is derived from an earlier step, is there an accepted method of storing and recalling that data later on in the scenario?
For example:
Scenario: Recently viewed product
Given I am on a product category page
And I click on the first product
When I am on a product category page
Then the recently viewed products should list the product I just viewed
On the step And I click on the first product can I somehow persist the product name so that I can assert that I am actually seeing that product in the last step? The reason I can't specify an actual product name in the feature file is that this could and will become out of sync with live product data.
Thanks!
It's entirely up to you how you implement this. The simplest way is in your "I click on the first product" step definition store the clicked product information in a static variable (or as a global variable) and then use it in "the recently viewed products should list the product I just viewed" step to verify it's present.
Store the values you need to persist between steps as FeatureContext class properties.
Don't forget to clear them when the Scenario ends, or before each new Scenario.

Partner branch locations

I have a partner A with different branches (A, branch1) , (A, branch2) in OpenERP 6.1
Do I need to create a separate partner for all branches and then point their parent partner field accordingly or am I missing something ?
Thanks.
The question is, do you deal directly with each of the branches (sales orders, invoices, etc.) ?
If you do , you should open a Partner for each branch, so you can relate
each document with the corresponding Partner's Branch.
If not, the
you are dealing with a partner having with several branches, and it
will suffice to have a Partner with several Contact addresses.
I would suggest ask the branches if they have separate bank accounts. If so then you should create a separate partner account otherwise make one partner account and find a way to put different branch accounts into that.